vinjn / articles

Everything is possible
8 stars 0 forks source link

my_vi_cheatsheet #4

Open vinjn opened 11 years ago

vinjn commented 11 years ago

Get the name of the current file

:echo @%    def/my.txt   directory/name of file
:echo expand('%:t')     my.txt   name of file ('tail')
:echo expand('%:p')     /abc/def/my.txt  full path
:echo expand('%:p:h')   /abc/def     directory containing file ('head')
vinjn commented 11 years ago

list folder structure tree -L 3 | less

vinjn commented 11 years ago

copy (yank) yy for one line 3yy for three lines

paste p

cut dd for one line 3dd for three lines

vinjn commented 11 years ago

Paste mode :set paste p :set nopaste

vinjn commented 11 years ago

show current file name and percent ctrl+g