vimrc cleanup
remove old/unused settings/mappings from vimrc and functions.vim
This commit is contained in:
@@ -13,30 +13,22 @@ function! WinMove(key)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" tell me what syntax group the word below the cursor belongs to
|
||||
function! <SID>SynStack()
|
||||
if !exists("*synstack")
|
||||
return
|
||||
endif
|
||||
echo map(synstack(line('.'), col('.')), 'synIDattr(v:val, "name")')
|
||||
endfunction
|
||||
|
||||
" recursively search up from dirname, sourcing all .vimrc.local files along the way
|
||||
function! ApplyLocalSettings(dirname)
|
||||
" convert windows paths to unix style
|
||||
let l:curDir = substitute(a:dirname, "\\", "/", "g")
|
||||
let l:curDir = substitute(a:dirname, '\\', '/', 'g')
|
||||
|
||||
" walk to the top of the dir tree
|
||||
let l:parentDir = strpart(l:curDir, 0, strridx(l:curDir, "/"))
|
||||
let l:parentDir = strpart(l:curDir, 0, strridx(l:curDir, '/'))
|
||||
if isdirectory(l:parentDir)
|
||||
call ApplyLocalSettings(l:parentDir)
|
||||
endif
|
||||
|
||||
" now walk back down the path and source .vimsettings as you find them.
|
||||
" child directories can inherit from their parents
|
||||
let l:settingsFile = a:dirname . "/.vimrc.local"
|
||||
let l:settingsFile = a:dirname . '/.vimrc.local'
|
||||
if filereadable(l:settingsFile)
|
||||
exec ":source" . l:settingsFile
|
||||
exec ':source' . l:settingsFile
|
||||
endif
|
||||
endfunction
|
||||
|
||||
@@ -47,18 +39,18 @@ function! Smart_TabComplete()
|
||||
let substr = strpart(line, -1, col('.')+1) " from the start of the current
|
||||
" line to one character right
|
||||
" of the cursor
|
||||
let substr = matchstr(substr, "[^ \t]*$") " word till cursor
|
||||
let substr = matchstr(substr, '[^ \t]*$') " word till cursor
|
||||
if (strlen(substr)==0) " nothing to match on empty string
|
||||
return "\<tab>"
|
||||
return '\<tab>'
|
||||
endif
|
||||
let has_period = match(substr, '\.') != -1 " position of period, if any
|
||||
let has_slash = match(substr, '\/') != -1 " position of slash, if any
|
||||
if (!has_period && !has_slash)
|
||||
return "\<C-X>\<C-P>" " existing text matching
|
||||
return '\<C-X>\<C-P>' " existing text matching
|
||||
elseif ( has_slash )
|
||||
return "\<C-X>\<C-F>" " file matching
|
||||
return '\<C-X>\<C-F>' " file matching
|
||||
else
|
||||
return "\<C-X>\<C-O>" " plugin matching
|
||||
return '\<C-X>\<C-O>' " plugin matching
|
||||
endif
|
||||
endfunction
|
||||
|
||||
|
||||
Reference in New Issue
Block a user