"Toggle Number Display
Map <leader> TN: Call toggle_number () <CR>
Function! Toggle_number ()
If! Exists ("B: togglenum ")
Let B: togglenum = 1
Endif
If B: togglenum = 1
Execute "set Nonu"
Let B: togglenum = 0
Else
Let B: togglenum = 1
Execute "set nu"
Endif
Endfunction
"Auto add tags from project rootau bufreadpost, bufnewfile * Call add_tags ()
Function! Add_tags ()
If expand ("%: P: H ")! = Getcwd ()
Echohl warningmsg | echo "fail to make! This file is not in the current Dir! Press <F7> to redirect to the Dir of this file. "| echohl none
Return
Endif
Let srcdir = expand ("%: P: H ")
Let I = 0
While isdirectory (srcdir)
If I> 3
Break
Endif
If filereadable (srcdir. "/tags ")
Let file = srcdir. "/tags"
"Echo printf (" set tags % s ", file)
If I = 0
Execute "set tags =". File
Else
Execute "set tags + =". File
Endif
Endif
Let newdir = fnamemodify (srcdir, ": P: H ")
"Echo printf (" newdir % s ", newdir)
If newdir! = Srcdir
Let srcdir = newdir
Else
Break
Endif
Let I = I + 1
Endwhile
Endfunction