zsh vim mode
http://dougblack.io/words/zsh-vi-mode.html
zsh open new tab at the same directory:
在選項appearence裡面的Working Directory選擇 Reuse previous session's directory
:! sh aaa.sh %
vip: select the current paragraph
vis: select the current sentence
V3j選了4行
V3j> Visually mark and then indent 3 lines
Ctrl + v + 2e
Ctrl + v + iw
Ctrl + v + ^. Ctrl + v + $
:help text-object
< 和 > 可用:
<
>
:sp filename , :vsp filename, 或:vs filename
http://www.bestofvim.com/tip/auto-reload-your-vimrc/
http://blog.smalleycreative.com/tutorials/using-git-and-github-to-manage-your-dotfiles/
http://chriskempson.github.io/base16/
可以考慮(或許可以透明背景?) https://github.com/chriskempson/tomorrow-theme
https://github.com/plasticboy/vim-markdown
gx : open the link under the cursor
:Toc, :Toch open a nav table
]],[[ 跳到下/上個heading
利用 HTML Tidy with HTML5 support + syntastic
https://github.com/htacg/tidy-html5
https://github.com/scrooloose/syntastic/wiki/HTML:---tidy
let g:syntastic_html_tidy_exec = 'tidy5'
或直接使用js-beautify command :
https://github.com/beautify-web/js-beautify
使用vim版本wrapper: (用這!!)
https://github.com/maksimr/vim-jsbeautify
ctrl-f就會自動format
使用 youcompleteme和 tern_for_vim
https://github.com/marijnh/tern_for_vim
用 vundle安裝後, 注意修改~/.vim/bundle/tern_for_vim的package.json
將tern改成最新版的套件
npm install 和 npm install -g tern
設定~/.vim/bundle/tern_for_vim/.tern-project:
{
"libs": [
"browser",
"ecma5",
"ecma6",
"jquery"
],
"plugins": {
"node": {}
}
}
http://vim.wikia.com/wiki/Jumping_to_previously_visited_locations
ctrl+o jump back to the previous (order) location, 打開vim後, 我們可以利用這個指令跳到我們上次修改的位置
ctrl+i jump forward to the next (newer) location
:jumps 列出jump list
jump line col file/text
4 102 0 somefile.txt
3 93 0 -invalid-
2 23 0 the current line 23 is shown here
1 89 34 the current line 89 is shown here
> 0 22 40 Display the jump list for the current window with:
1 39 0 the current line 39 is shown here
2 995 0 anotherfile.txt
3 53 102 the current line 53 is shown here
Ctrl-I to jump to line 39 in the current buffer.
Ctrl-O to jump to line 89 in the current buffer.
4 then Ctrl-O to jump to line 102 in file somefile.txt.
3 then Ctrl-I to jump to line 53 in the current buffer.
ctrl - d move half page down
ctrl - u move half page up
利用hjkl才能跟數字組成快速motion, 例如游標往上移動三行 3k
.news { bakcground-position: 180px 0px }
假設游標開始在.,
執行w會跑到n再來跑到{再來b再來-再來p再來:再來1
執行W會跑到{再來跑到b再來跑到1
b和B同理
$ sudo npm install -g csslint
.vimrc加入:
let g:syntastic_csslint_args="--ignore=outline-none"
使用surrend 插件
cs + 單引號+雙引號將單引號改成雙引號
cs'<q>會把 'Hello World' 改成 Hello World
ds'會把 'Hello World'刪掉引好變成 Hello World
:ls
:b# 跳到所選號碼檔案去
:db# 刪除某個buffer
:db 關掉目前所在的buffer
將目前的buffer變成split一個新的切割視窗: sb#, 如果要切成垂直split, 那前面要加vert, 變成使用 :vert sb#
先:然後使用上下箭頭找執行過的指令。
或是直接@:就可執行上一個指令。
$ sudo apt-get install exuberant-ctags
使用vundle: https://github.com/majutsushi/tagbar
.vimrc加入快速鍵(可以任意):
nmap <F8> :TagbarToggle<CR>
按F8救出tage list