User Tools

Site Tools


linux:vim

vim

:colorscheme desert

open/close folder

zf/zo

 :%!xxd
 :%!xxd -r

Split

:split filename
:vsplit filename
:new filename
:vnew filename
:only
:wall

move

Ctrl+w:h,j,k,l
Ctrl+w:H,J,K,L
Ctrl+w:w

select

v
ctrl+v select a block

Reference

vim-pathogen

vimrc

https://raw.github.com/pjq/config/master/.vimrc

curl -Sso ~/.vimrc https://raw.github.com/pjq/config/master/.vimrc

Install:

mkdir -p ~/.vim/autoload ~/.vim/bundle; \
curl -Sso ~/.vim/autoload/pathogen.vim \
    https://raw.github.com/tpope/vim-pathogen/master/autoload/pathogen.vim
 

Append to ~/.vimrc

execute pathogen#infect()    

NERDTree

https://github.com/scrooloose/nerdtree

Install:

cd ~/.vim/bundle
git clone https://github.com/scrooloose/nerdtree.git

Keyboard Commands(NERDTree 快捷键辑录:http://yang3wei.github.io/blog/2013/01/29/nerdtree-kuai-jie-jian-ji-lu/)

Type :help NERDTreeMappings to read through all of the default keyboard shortcuts. These are the ones I use the most frequently:

t: Open the selected file in a new tab
i: Open the selected file in a horizontal split window
s: Open the selected file in a vertical split window
I: Toggle hidden files
m: Show the NERD Tree menu
R: Refresh the tree, useful if files change outside of Vim
?: Toggle NERD Tree's quick help
C:change tree root to the selected dir,use "C+t" to open the selected dir in new tab.

gt = next tab
gT = previous tab

Maximum Awesome

http://corner.squareup.com/2013/08/fly-vim-first-class.html

git clone https://github.com/square/maximum-awesome.git && cd maximum-awesome && rake

Maximum Awesome Linux

https://github.com/pjq/maximum-awesome-linux

paste

:set paste
:set nopaste

Install the macvim to replace the system vim

brew install macvim --HEAD --override-system-vim

ctags

sudo port install ctags
ctags -R

Append ~/.vimrc

set tags=tags;
set autochdir

taglist

Download the latest taglist from here: http://www.vim.org/scripts/script.php?script_id=273

"taglist
map <silent> <F8> :TlistToggle<cr>  
""""""""""""""""""""""""""""""
" Tag list (ctags)
""""""""""""""""""""""""""""""
let Tlist_Ctags_Cmd = 'ctags'
let Tlist_Show_One_File = 1            "不同时显示多个文件的tag,只显示当前文件的
let Tlist_Exit_OnlyWindow = 1          "如果taglist窗口是最后一个窗口,则退出vim
let Tlist_Use_Right_Window = 1         "在右侧窗口中显示taglist窗口    

run command

!ls
r !ls

Vim tips

^M is retrieve by cmd+v, M

1,%s/^M//g


/var/www/dokuwiki/wiki/data/pages/linux/vim.txt · Last modified: 2016/08/15 16:25 by percy