1. open file 1
2. :vsplit OR :vnew
3. open file 1
http://trac.nchc.org.tw/grid/attachment/wiki/gpxe-sis900/08-02-12_VIMDIFF_UTF8.txt
:diffget :diffput 將左右兩邊的差異互拷
do, dp short hotkey
windows vim config
" windows version vim config file
set nocompatible
source $VIMRUNTIME/vimrc_example.vim
source $VIMRUNTIME/mswin.vim
behave mswin
set diffexpr=MyDiff()
function MyDiff()
let opt = '-a --binary '
if &diffopt =~ 'icase' | let opt = opt . '-i ' | endif
if &diffopt =~ 'iwhite' | let opt = opt . '-b ' | endif
let arg1 = v:fname_in
if arg1 =~ ' ' | let arg1 = '"' . arg1 . '"' | endif
let arg2 = v:fname_new
if arg2 =~ ' ' | let arg2 = '"' . arg2 . '"' | endif
let arg3 = v:fname_out
if arg3 =~ ' ' | let arg3 = '"' . arg3 . '"' | endif
let eq = ''
if $VIMRUNTIME =~ ' '
if &sh =~ '\<cmd'
let cmd = '""' . $VIMRUNTIME . '\diff"'
let eq = '"'
else
let cmd = substitute($VIMRUNTIME, ' ', '" ', '') . '\diff"'
endif
else
let cmd = $VIMRUNTIME . '\diff'
endif
silent execute '!' . cmd . ' ' . opt . arg1 . ' ' . arg2 . ' > ' . arg3 . eq
endfunction
" up config is from vim 7.3 windows version
set t_Co=256
colorscheme zenburn
set ruler
set number
set ch=2
set backup
set backupext=.bak
set incsearch
set ic
set guifont=Monaco:h12
" vim + ctags config ref http://blogold.chinaunix.net/u3/111185/showart_2270485.html
" http://vim.wikia.com/wiki/Browsing_programs_with_tags
" search parent directory for tags file
set tags=tags;
set autochdir
map <F2> :NERDTreeToggle<CR>
map <F3> :MRU<CR>
map <F4> :TlistToggle<CR>
http://freehaha.blogspot.com/2008/02/vim-buffer-tab.html
vim buffer->tab
:tab ball
http://www.rayninfo.co.uk/vimtips.html
Best of Vim Tips
----------------------------------------
" Absolutely essential
----------------------------------------
* # g* g# : find word under cursor (<cword>) (forwards/backwards)
% : match brackets {}[]()
. : repeat last modification
@: : repeat last : command (then @@)
matchit.vim : % now matches tags <tr><td><script> <?php etc
<C-N><C-P> : word completion in insert mode
<C-X><C-L> : Line complete SUPER USEFUL
/<C-R><C-W> : Pull <cword> onto search/command line
/<C-R><C-A> : Pull <CWORD> onto search/command line
:set ignorecase : you nearly always want this
:set smartcase : overrides ignorecase if uppercase used in search string (cool)
:syntax on : colour syntax in Perl,HTML,PHP etc
:set syntax=perl : force syntax (usually taken from file extension)
:h regexp<C-D> : type control-D and get a list all help topics containing
regexp (plus use TAB to Step thru list)
::show current edit file name and path
http://groups.google.com/group/comp.editors/browse_thread/thread/85e969ca3651da80
But how can I see the full path of the file I am currently editing?
:echo expand('%:p')