From 614cb0642b9fce1dc98ce7a33405cbe48ca79460 Mon Sep 17 00:00:00 2001 From: Nick Nisi Date: Tue, 13 Nov 2012 07:46:05 -0600 Subject: [PATCH] Added smart mapping for tab-completion via http://vim.wikia.com/wiki/Smart_mapping_for_tab_completion --- vim/vimrc.symlink | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/vim/vimrc.symlink b/vim/vimrc.symlink index efe653d..4ae0b18 100644 --- a/vim/vimrc.symlink +++ b/vim/vimrc.symlink @@ -288,6 +288,28 @@ function! ApplyLocalSettings(dirname) endfunction autocmd! BufEnter * call ApplyLocalSettings(expand(":p:h")) +" smart tab completion +function! Smart_TabComplete() + let line = getline('.') + let substr = strpart(line, -1, col('.')+1) + + let substr = matchstr(substr, "[^ \t]*$") + if (strlen(substr) == 0) + return "<\tab>" + endif + let has_period = match(substr, '\.') != -1 + let has_slash = match(substr, '\/') != -1 + if (!has_period && !has_slash) + return "\\" + elseif (has_slash) + return "\\" + else + return "\\" + endif +endfunction + +inoremap =Smart_TabComplete() + """"""""""""""""""""""""""""""""""""""""""""""""""""""""""" " => Plugins """""""""""""""""""""""""""""""""""""""""""""""""""""""""""