Clone this repository to ~/.vim
git clone https://github.com/jeffshantz/vimconfig.git ~/.vim
Install neobundle
:
git clone https://github.com/Shougo/neobundle.vim ~/.vim/bundle/neobundle.vim
Link ~/.vimrc
to ~/.vim/vimrc
ln -s ~/.vim/vimrc ~/.vimrc
Run vim
to have NeoBundle install all plugins, exit, and rerun to ensure all
plugins are loaded.
Install The Silver Searcher for efficient code search (optional but recommended).
Some of the features of this configuration include:
-
Forcing one to use
hjkl
navigation -
Airline status bar
-
Unite
-
Commands
,f
- Fuzzy file open,g
- Recursive grep,y
- Yank history,m
- MRU files,b
- Open buffers,c
- Quick commands
-
When Unite is open:
Esc
orqq
exits UniteCtrl+J
orjj
allows you to select a menu itemCtrl+R
refreshes UniteCtrl+S
opens the selected menu item in a horizontal splitCtrl+V
opens the selected menu item in a vertical split
-
-
Tabularize
- Use
,a=
to align by=
- Use
,a:
to align by:
- Tabularize is called every time you type
|
, which is great for Cucumber tables
- Use
-
Commenting
- Uses vim-commentary to comment out code.
gcc
to toggle the current linegc4j
to toggle the current line + the next 4 linesgcap
to toggle the current paragraphgcar
to toggle the current Ruby block (thanks to the textobj-rubyblock plugin)- etc.
-
Comment boxes
- An 80-character comment box is inserted when you use
,cb #
, where#
is the comment character to use.
- An 80-character comment box is inserted when you use
-
Write using sudo
- Forgot to use
sudo vim
? No problem. Save the file using:w!!
and it will be written asroot
.
- Forgot to use
-
Insert blank lines above/below without going into insert mode
- Above:
,O
- Below:
,o
- Above:
-
Rails
- Uses vim-rails plugin
,q
added to quickly switch back and forth between alternate files (e.g. a class and its spec) rather than having to type:A
each time.
-
Skeleton files
pom.xml
- Angular JS - Edit any new file named
*-ng.html
, and you get a basic Angular skeleton - Bootstrap - Edit any new file named
*-bs.html
, and you get a basic Bootstrap skeleton
-
Snippets
- Plenty of snippets in
.vim/bundle/vim-snippets/snippets/
- I added a few custom Java snippets that I use in my teaching:
pc
-public class ClassName { }
psvm
-public static void main(String[] args) { }
psvmte
-public static void main(String[] args) throws Exception { }
sop
-System.out.println("text");
- Additional snippets can be added to the
.vim/snippets
directory
- Plenty of snippets in