2016年9月29日 星期四

Vim memo

1.
" Map ff to display all lines with keyword under cursor
" and ask which one to jump to
nmap ff [I:let nr = input("Which one: ")exe "normal " . nr ."[\t"

2.
" Easier formatting
nnoremap q gwip

3.
nnoremap tt :TagbarToggle

4.
if isdirectory(expand("~/.vim/bundle/vim-fugitive/"))
nnoremap gs :Gstatus
nnoremap gd :Gdiff
nnoremap gc :Gcommit
nnoremap gb :Gblame
nnoremap gl :Glog
nnoremap gp :Git push
nnoremap gr :Gread
nnoremap gw :Gwrite
nnoremap ge :Gedit
" Mnemonic _i_nteractive
nnoremap gi :Git add -p %
nnoremap gg :SignifyToggle
endif

5.
nnoremap u :UndotreeToggle

6.
,,w easy motion

for completing snippets using Neosnippet.
for completing snippets using Neosnippet.

  Old text                  Command     New text ~
  "Hello *world!"           ds"         Hello world!
  [123+4*56]/2              cs])        (123+456)/2
  "Look ma, I'm *HTML!"     cs"      Look ma, I'm HTML!
  if *x>3 {                 ysW(        if ( x>3 ) {
  my $str = *whee!;         vllllS'     my $str = 'whee!';

  install new plugin
vim +BundleInstall! +BundleClean +q

沒有留言: