Permalink
Browse files

My vim config

  • Loading branch information...
0 parents commit 1d51eb444853396ab6cf0bc8e27c01ba21216ff3 krishnen committed May 1, 2012
Showing with 1,296 additions and 0 deletions.
  1. +3 −0 .gitignore
  2. +69 −0 README.md
  3. +78 −0 Rakefile
  4. +139 −0 autoload/pathogen.vim
  5. +49 −0 gvimrc
  6. +126 −0 plugin/javaScriptLint.vim
  7. +623 −0 plugin/jsbeautify.vim
  8. +209 −0 vimrc
@@ -0,0 +1,3 @@
+bundle
+test_files
+.netrwhist
@@ -0,0 +1,69 @@
+#How to get started with mvim#
+
+* Install [macvim](http://code.google.com/p/macvim)
+* git clone https://github.com/neerajdotname/vim
+* cd vim
+* rake
+
+##Setup symbolic links##
+
+ ln -s /Users/nsingh/dev/vim/vimrc ~/.vimrc
+ ln -s /Users/nsingh/dev/vim/gvimrc ~/.gvimrc
+ ln -s /Users/nsingh/dev/vim ~/.vim
+
+##Starting a project##
+
+* cd to your project directory
+* mvim .
+
+##Installing JavaScriptLint##
+
+* [JavaScriptLint](http://www.javascriptlint.com) is a tool that inspects validity of
+JavaScript code every time a JavaScript file is saved. It will flag you if you have a missing semicolon.
+
+* In order to get it working, you need to install spidermonkey. On mac if you have
+port installed then you can do this <tt>sudo port install spidermonkey</tt> . To check if port is properly
+installed just go to command prompt and type <tt>js</tt> .
+
+* [JavaScriptLint](http://www.javascriptlint.com/download.htm) has been included in this vim setting. Add the following line to your <tt>~/.bashrc</tt> so that at command prompt you can type <tt>jsl</tt> .
+
+ export PATH="/Users/nsingh/dev/vim/jsl-0.3.0-mac:$PATH"
+
+* Notice that the full path to where this vim is stored is mentioned in _vimrc_ . Search for _jslint_command_options_ and ensure that this option has right value. [Read this blog](http://neeraj.name/2009/09/08/integrating-javascriptlint-with-mvim-and-getting-rid-of-annoying-warnings.html) for more information.
+
+
+##Installing exuberant ctags (optional)##
+
+ cd ~
+ mkdir src
+ cd src
+ curl -O http://superb-west.dl.sourceforge.net/sourceforge/ctags/ctags-5.8.tar.gz
+ tar xzvf ctags-5.8.tar.gz
+ cd ctags-5.8
+ ./configure
+ make
+ sudo make install
+
+ctags has been installed at <tt>/usr/local/bin</tt> . However mac comes pre installed with ctags from
+a different provider. In order to make sure that exuberant ctags is found first in the
+path, open <tt>~/.bash_profile</tt> and add following line.
+
+ export PATH="/usr/local/bin:$PATH"
+
+Now let's see if exuberant ctags is properly installed.
+
+ source ~/.bash_profile
+ > ctags --version
+ Exuberant Ctags 5.8, Copyright (C) 1996-2009 Darren Hiebert
+ Compiled: Sep 9 2009, 11:41:52
+ Addresses: <dhiebert@users.sourceforge.net>, http://ctags.sourceforge.net
+ Optional compiled features: +wildcards, +regex
+
+ cd demo
+ rake rails:freeze:edge RELLEASE=2.3.5
+
+ ctags -R --exclude=*.js
+
+Now open project type in mvim and take cursor to validates_uniqueness_of method.
+Hit <tt>ctrl ]</tt> and now you should be inside the rails code base. To get back hit <tt>ctrl t</tt> .
+
@@ -0,0 +1,78 @@
+require 'fileutils'
+
+desc "Performs base installation"
+task :base do
+ # In stead of using standard snipmate repository I have my own custom sinpmate where
+ # I have added a few extra goodies. Lookat readme at https://github.com/neerajdotname/snipmate.vim
+ # to see the shortcuts I have added
+ system("git clone git://github.com/neerajdotname/snipmate.vim.git bundle/snipmate")
+ #system("git clone git://github.com/msanders/snipmate.vim.git bundle/snipmate")
+
+
+ system("git clone git://github.com/scrooloose/nerdtree.git bundle/nerdtree")
+ system("git clone git://github.com/scrooloose/nerdcommenter.git bundle/nerdcommenter")
+
+ system("git clone git://github.com/vim-scripts/Color-Sampler-Pack.git bundle/color-sampler-pack")
+
+ # I need only JavaScript validation. Even in that case I need the ability to turn it on and off dynamically
+ # I will have my customized solution.
+ #system("git clone git://github.com/scrooloose/syntastic.git bundle/syntastic")
+ #
+ system("git clone git://github.com/henrik/vim-ruby-runner.git bundle/vim-ruby-runner")
+ system("git clone git://github.com/tpope/vim-endwise.git bundle/endwise")
+ system("git clone git://github.com/tpope/vim-surround.git bundle/surround")
+ system("git clone git://github.com/tpope/vim-unimpaired.git bundle/unimpaired")
+ system("git clone git://github.com/tpope/vim-abolish.git bundle/abolish")
+ system("git clone git://github.com/tpope/vim-repeat.git bundle/repeat")
+ system("git clone git://github.com/tpope/vim-vividchalk.git bundle/vividchalk")
+ system("git clone git://github.com/mileszs/ack.vim.git bundle/ack")
+ system("git clone git://github.com/edsono/vim-matchit.git bundle/matchid")
+ system("git clone git://github.com/tpope/vim-markdown.git bundle/markdown")
+ system("git clone git://github.com/kchmck/vim-coffee-script.git bundle/coffee-script")
+ system("git clone git://github.com/tpope/vim-bundler.git bundle/vim-bundler")
+
+ # http://vimcasts.org/episodes/aligning-text-with-tabular-vim/
+ system("git clone git://github.com/godlygeek/tabular.git bundle/tabular")
+end
+
+desc "Performs git plugins installation"
+task :git do
+ system("git clone git://github.com/tpope/vim-git.git bundle/vim-git")
+ system("git clone git://github.com/tpope/vim-fugitive.git bundle/fugitive")
+end
+
+desc "Installs plugins for rails development"
+task :rails do
+ system("git clone git://github.com/tpope/vim-ragtag.git bundle/ragtag")
+ system("git clone git://github.com/vim-ruby/vim-ruby.git bundle/vim-ruby")
+ system("git clone git://github.com/tpope/vim-rails.git bundle/vim-rails")
+ system("git clone git://github.com/tpope/vim-cucumber.git bundle/vim-cucumber")
+ system("git clone git://github.com/tpope/vim-haml.git bundle/vim-haml")
+end
+
+
+desc "Performs bundle cleanup (delete plugins installed from git source)"
+task :cleanup do
+ path = File.join(File.dirname(__FILE__), 'bundle')
+ Dir.foreach(path) do |entry|
+ if File.exist?(File.join(path, entry, ".git"))
+ FileUtils.rm_rf(File.join(path, entry))
+ end unless entry =~ /\.+/
+ end
+end
+
+desc "Performs plugins update"
+task :update do
+ path = File.join(File.dirname(__FILE__), 'bundle')
+ Dir.foreach(path) do |entry|
+ bundle = File.join(path, entry)
+ if File.exist?(File.join(bundle, ".git"))
+ print "Updating #{entry}: "
+ system("cd #{bundle} && git pull")
+ system("cd #{bundle} && git submodule update") unless `cd #{bundle} && git submodule`.empty?
+ end unless entry =~ /\.+/
+ end
+end
+
+desc "=> base"
+task :default => [:base, :git, :rails]
@@ -0,0 +1,139 @@
+" pathogen.vim - path option manipulation
+" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
+" Version: 1.2
+
+" Install in ~/.vim/autoload (or ~\vimfiles\autoload).
+"
+" API is documented below.
+
+if exists("g:loaded_pathogen") || &cp
+ finish
+endif
+let g:loaded_pathogen = 1
+
+" Split a path into a list.
+function! pathogen#split(path) abort " {{{1
+ if type(a:path) == type([]) | return a:path | endif
+ let split = split(a:path,'\\\@<!\%(\\\\\)*\zs,')
+ return map(split,'substitute(v:val,''\\\([\\,]\)'',''\1'',"g")')
+endfunction " }}}1
+
+" Convert a list to a path.
+function! pathogen#join(...) abort " {{{1
+ if type(a:1) == type(1) && a:1
+ let i = 1
+ let space = ' '
+ else
+ let i = 0
+ let space = ''
+ endif
+ let path = ""
+ while i < a:0
+ if type(a:000[i]) == type([])
+ let list = a:000[i]
+ let j = 0
+ while j < len(list)
+ let escaped = substitute(list[j],'[,'.space.']\|\\[\,'.space.']\@=','\\&','g')
+ let path .= ',' . escaped
+ let j += 1
+ endwhile
+ else
+ let path .= "," . a:000[i]
+ endif
+ let i += 1
+ endwhile
+ return substitute(path,'^,','','')
+endfunction " }}}1
+
+" Convert a list to a path with escaped spaces for 'path', 'tag', etc.
+function! pathogen#legacyjoin(...) abort " {{{1
+ return call('pathogen#join',[1] + a:000)
+endfunction " }}}1
+
+" Remove duplicates from a list.
+function! pathogen#uniq(list) abort " {{{1
+ let i = 0
+ let seen = {}
+ while i < len(a:list)
+ if has_key(seen,a:list[i])
+ call remove(a:list,i)
+ else
+ let seen[a:list[i]] = 1
+ let i += 1
+ endif
+ endwhile
+ return a:list
+endfunction " }}}1
+
+" Returns a hash indicating which filetype features are enabled.
+function! pathogen#filetype() abort " {{{1
+ redir => output
+ silent filetype
+ redir END
+ let result = {}
+ let result.detection = match(output,'detection:ON') >= 0
+ let result.indent = match(output,'indent:ON') >= 0
+ let result.plugin = match(output,'plugin:ON') >= 0
+ return result
+endfunction " }}}1
+
+" \ on Windows unless shellslash is set, / everywhere else.
+function! pathogen#separator() abort " {{{1
+ return !exists("+shellslash") || &shellslash ? '/' : '\'
+endfunction " }}}1
+
+" Convenience wrapper around glob() which returns a list.
+function! pathogen#glob(pattern) abort " {{{1
+ let files = split(glob(a:pattern),"\n")
+ return map(files,'substitute(v:val,"[".pathogen#separator()."/]$","","")')
+endfunction "}}}1
+
+" Like pathogen#glob(), only limit the results to directories.
+function! pathogen#glob_directories(pattern) abort " {{{1
+ return filter(pathogen#glob(a:pattern),'isdirectory(v:val)')
+endfunction "}}}1
+
+" Prepend all subdirectories of path to the rtp, and append all after
+" directories in those subdirectories.
+function! pathogen#runtime_prepend_subdirectories(path) " {{{1
+ let sep = pathogen#separator()
+ let before = pathogen#glob_directories(a:path.sep."*[^~]")
+ let after = pathogen#glob_directories(a:path.sep."*[^~]".sep."after")
+ let rtp = pathogen#split(&rtp)
+ let path = expand(a:path)
+ call filter(rtp,'v:val[0:strlen(path)-1] !=# path')
+ let &rtp = pathogen#join(pathogen#uniq(before + rtp + after))
+ return &rtp
+endfunction " }}}1
+
+" For each directory in rtp, check for a subdirectory named dir. If it
+" exists, add all subdirectories of that subdirectory to the rtp, immediately
+" after the original directory. If no argument is given, 'bundle' is used.
+" Repeated calls with the same arguments are ignored.
+function! pathogen#runtime_append_all_bundles(...) " {{{1
+ let sep = pathogen#separator()
+ let name = a:0 ? a:1 : 'bundle'
+ let list = []
+ for dir in pathogen#split(&rtp)
+ if dir =~# '\<after$'
+ let list += pathogen#glob_directories(substitute(dir,'after$',name.sep.'*[^~]'.sep.'after','')) + [dir]
+ else
+ let list += [dir] + pathogen#glob_directories(dir.sep.name.sep.'*[^~]')
+ endif
+ endfor
+ let &rtp = pathogen#join(pathogen#uniq(list))
+ return 1
+endfunction
+
+" }}}1
+
+" Invoke :helptags on all non-$VIM doc directories in runtimepath.
+function! pathogen#helptags() " {{{1
+ for dir in pathogen#split(&rtp)
+ if dir[0 : strlen($VIM)-1] !=# $VIM && isdirectory(dir.'/doc') && (!filereadable(dir.'/doc/tags') || filewritable(dir.'/doc/tags'))
+ helptags `=dir.'/doc'`
+ endif
+ endfor
+endfunction " }}}1
+
+" vim:set ft=vim ts=8 sw=2 sts=2:
@@ -0,0 +1,49 @@
+" -----------------------------------------------------------------------------
+" | VIM Settings |
+" | GUI stuff |
+" -----------------------------------------------------------------------------
+
+
+" OS Specific *****************************************************************
+set fuoptions=maxvert,maxhorz " fullscreen options (MacVim only), resized window when changed to fullscreen
+"set guifont=Monaco:h22.00
+set guifont=Monaco:h15.00
+
+set guioptions-=m " remove menubar
+set guioptions-=T " remove toolbar
+set guioptions-=r " remove right scroll bar
+set stal=2 " turn on tabs by default
+
+set encoding=utf-8 " User UTF-8 everywhere
+
+set anti " Antialias font
+set antialias " Antialias font
+
+
+" Default size of window
+set columns=120
+set lines=50
+
+" Tab headings
+set gtl=%t gtt=%F
+
+
+" For File Browser
+nnoremap <silent> <F8> :Exp<CR>
+nnoremap <silent> <D-e> :Exp<cr>
+"FuzzyFinderTextMate
+nnoremap <silent><D-r> :FuzzyFinderTextMate<CR>
+
+" save
+noremap <silent> <D-s> :w<CR>
+
+" tabs
+map <silent> <D-t> :tabnew %<cr>
+map <silent> <D-w> :tabclose<cr>
+
+" relative path column number line number total line number percentage
+set statusline=%-40f\ %10((%v)%)\ %10((%l/%L)%)\ %P
+set laststatus=2
+
+map <D-left> :tabp<CR>
+map <D-right> :tabn<CR>
Oops, something went wrong.

0 comments on commit 1d51eb4

Please sign in to comment.