- install brew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
- install vim
brew install vim --override-system-vim --HEAD
cd /usr/bin && sudo mv vim BAK_vim && sudo ln -s /usr/local/Cellar/vim/HEAD/bin/vim vim
- if Operation not permitted
- reboot and press
cmd+r
- select Utilities > Terminal from the menu
csrutil disable && reboot
- reboot and press
v
start visual selectSHIFT+v
start visual line select- easier vim install
brew install vim
brew install --with-python3 vim
brew link vim --overwrite
gg
top of fileshift+G
bottom of file- `` returns to the previous line number before a jump
ma
sets amark
position labeleda
- jump to label
a
with `a
- jump to label
:noautocmd vimgrep "pattern" **/*.*
:Ggrep
with vim-fugitive:e
to reload:cw
to list occurrences in quickfix
u
undo previousctrl+r
redo the undodaw
delete a wordcaw
change a word (deletes and then goes into insert mode)- write a visual selection to a file
:w temp
- search/repl in a visual selection
:s/patt/subs/g
>>
indent line/selection=
format indentation line/selectiongg=G
indent entire file:qa
close all buffers:Vex
open directory tree in vertical split
:e.
browse directory to edit a file:ls
or:buffers
show the open file buffers:bn
next buffer:bp
previous buffer:b 1
open (switch to) the file at buffer 1:bd
or:bw
remove current or numbered buffer:vsp | b<n>
open buffer in vertical split pane:vsp <filename>
open a file in vertical split pane:sp
for horizontal splits:q
to close the splitctrl+w
then left/right arrow keys to move between panesctrl+w+w
to move to next pane- shows hidden pane after a maximize
ctrl+w
then=
to normalize size of all panesctrl+w
then|
to maximize size of current panectrl+w
thenr
to rotate the panes to the rightctrl+w
theno
closes all but current panectrl+w
then (n)<
make current pane smaller by (n)ctrl+w
then (n)>
make current pane larger by (n)
:copen
Open the quickfix window:ccl
Close it:cw
Open it if there are "errors", close it otherwise (some people prefer this):cn
Go to the next error in the window:cnf
Go to the first error in the next file
,t
list files,b
list buffers<C-v>
open file in vertical split
!<command>
to run a command in the shell!ls
runls
in the shell:shell
to open the shell. then return to vim withexit
- vim-plug
- add list of plugins to
~/.vimrc
- to install, run
:PlugInstall
from vim - to update, run
:PlugUpdate
- add list of plugins to
matze/vim-move
- keyboard shortcuts to move line/selection up/downpowerline/powerline
- awesome in-editor info bar- download the font Input Mono
- Input Mono font download
- install the font using the native Font Book application
- set the terminal font to use Input Mono
- in
~/.vimrc
- other powerline fonts
- download the font Input Mono
# .vimrc
set guifont=Input\ Mono
let g:Powerline_symbols = 'fancy'
let g:airline_powerline_fonts = 1
let g:airline#extensions#branch#enabled = 1
let g:airline_section_z = '%p%% %l:%v'
# copy/paste without formatting
noremap <C-c> "+y
noremap <C-v> "+p
Bling/vim-airline
- cool info bareasymotion/vim-easymotion
- fuzzy search, etcwincent/Command-T
- easily open files and buffers with,t
- after a
:PlugUpdate
- go to
~/.vim/plugged/Command-T
- run
rake make
git status
, then checkout the changed files- then run
:PlugUpdate
again to verify
- after a
w0ng/vim-hybrid
- BEST color themetomasr/molokai
- GOOD color themepangloss/vim-javascript
- javascript syntax, indentation support, etc