Skip to content

Commit

Permalink
added new plugin, updaed .vimrc
Browse files Browse the repository at this point in the history
  • Loading branch information
Proful committed Aug 10, 2011
1 parent 11d27b9 commit 14a4da7
Show file tree
Hide file tree
Showing 4 changed files with 90 additions and 19 deletions.
35 changes: 35 additions & 0 deletions .vimrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
" Required by pathogen to load all vim plugin available in bundle directory
call pathogen#infect()
" syntax on and filetype should be after calling to pathogen
syntax on "
filetype plugin indent on " all file type plugin will be available
set ruler " show the line number on the bar
set autoread " watch for file change
set number " set line number
set showcmd
set nocompatible " vim, not vi
set autoindent smartindent " enable auto/smart indentation
set expandtab " convert spaces to tabs
set smarttab " tab and backspace are smart .. I don't know what does it means
set tabstop=2 " 2 spaces for one tab
set shiftwidth=2 " 2 spaces for indentation
set noerrorbells
set linebreak
set cmdheight=2 " set command line 2 lines high
set undolevels=1000
set incsearch " incremental search
set ignorecase " search ignoring case
set hlsearch " highlight search
set showmatch " show matching bracket
set mouse=a " enable mouse support
set mousehide " hide mouse when typing
set backup
set backupdir=~/.backup
set history=200
map Y y$ " yank from cursor to end of line
imap jj <Esc> " map jj to escape
map <C-tab> gt " control tab for switching tab
map <C-S-tab> gT
map tt :NERDTreeToggle<cr>
nmap <Space> <C-w><C-w> " switching between windows..
colorscheme molokai
9 changes: 8 additions & 1 deletion config.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
{"plugin":[
{"git":"git://github.com/kchmck/vim-coffee-script.git"},
{"git":"git://github.com/scrooloose/nerdtree.git"}
{"git":"git://github.com/scrooloose/nerdtree.git"},
{"git":"git://github.com/pangloss/vim-javascript.git"},
{"git":"git://github.com/tpope/vim-surround.git"},
{"git":"git://github.com/ervandew/supertab.git"},
{"git":"git://github.com/tpope/vim-markdown.git"},
{"git":"git://github.com/Raimondi/delimitMate.git"},
{"git":"git://github.com/tpope/vim-vividchalk.git"},
{"git":"git://github.com/tomasr/molokai.git"}
]
}
41 changes: 35 additions & 6 deletions index.coffee
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
fs = require('fs')
exec = require('child_process').exec
path = require('path')
util = require('util')
https = require('https')


home = process.env.HOME

# Delete non empty folder (synch)
# From rimraf logic
rmnedirSync = (p)->
s = fs.lstatSync(p)
if not s.isDirectory()
if not s.isDirectory()
fs.unlinkSync(p)
else
fs.readdirSync(p).forEach (f) ->
fs.readdirSync(p).forEach (f) ->
rmnedirSync(path.join(p, f))
fs.rmdirSync(p)

Expand All @@ -31,6 +34,7 @@ rmIfExists = (filePath)->
rmIfExists "#{home}/.vimrc.old"
rmIfExists "#{home}/.gvimrc.old"
rmIfExists "#{home}/.vim.old"
rmIfExists "#{home}/.backup"


# backup .vim directory if already available
Expand All @@ -56,6 +60,11 @@ child = exec script,(error,stdout,stderr)->
console.log 'Created .vim folder'
fs.mkdirSync home + '/.vim/autoload',0777
console.log 'Created .vim/autoload folder'
fs.mkdirSync home + '/.vim/bundle',0777
console.log 'Created .vim/bundle folder'
fs.mkdirSync home + '/.backup',0777
console.log 'Created .backup folder'


# Retrieving pathogen.vim file
options = {
Expand All @@ -67,7 +76,27 @@ child = exec script,(error,stdout,stderr)->
# Retrieving pathogen.vim file and saving in .vim/autoload
https.get options, (res)->
res.on 'data',(d)->
fd = fs.openSync "#{home}/.vim/autoload/pathogen.vim", 'w'
fs.writeSync fd, d.toString()
fs.closeSync fd
console.log 'pathogen.vim copied to ~/.vim/autoload '
fs.writeFileSync "#{home}/.vim/autoload/pathogen.vim", d.toString()
console.log 'pathogen.vim copied to ~/.vim/autoload '


# Reading all the git plugin and cloning under .vim/bundle folder
config = fs.readFileSync "config.json"
configJson = JSON.parse(config)
for plugin in configJson["plugin"]
console.log "Cloning #{plugin['git']}"
script = "cd #{home}/.vim/bundle && git clone #{plugin['git']}"
child = exec script,(error,stdout,stderr)->
if error is not null
console.log "git cloning failed : #{error}"
else
console.log "git cloning successful"

# copying .vimrc files to ~/.vimrc
fs.readFile ".vimrc",(err,buf)->
if(err)
console.log "Error reading .vimrc file"
else
fs.writeFileSync "#{home}/.vimrc",buf
console.log ".vimrc file successfully copied to #{home} directory"

24 changes: 12 additions & 12 deletions test.coffee
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
https = require 'https'
fs = require 'fs'
exec = require('child_process').exec

options = {
host: 'raw.github.com',
port: 443,
path: '/tpope/vim-pathogen/HEAD/autoload/pathogen.vim'
}

https.get options, (res)->
res.on 'data',(d)->
fd = fs.openSync 'pathogen.vim', 'w'
fs.writeSync fd, d.toString()
fs.closeSync fd
home = process.env.HOME
config = fs.readFileSync "config.json"
configJson = JSON.parse(config)
for plugin in configJson["plugin"]
console.log "Cloning #{plugin['git']}"
script = "cd #{home}/.vim/bundle && git clone #{plugin['git']}"
child = exec script,(error,stdout,stderr)->
if error is not null
console.log "git cloning failed : #{error}"
else
console.log "git cloning successful"

0 comments on commit 14a4da7

Please sign in to comment.