From f2fb73da330fe544f1227bddec05a95a10f47169 Mon Sep 17 00:00:00 2001 From: Nick Nisi Date: Thu, 15 Nov 2012 10:09:04 -0600 Subject: [PATCH] fixing smart tab completion --- vim/vimrc.symlink | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/vim/vimrc.symlink b/vim/vimrc.symlink index 4ae0b18..506c71f 100644 --- a/vim/vimrc.symlink +++ b/vim/vimrc.symlink @@ -290,26 +290,26 @@ autocmd! BufEnter * call ApplyLocalSettings(expand(":p:h")) " smart tab completion function! Smart_TabComplete() - let line = getline('.') - let substr = strpart(line, -1, col('.')+1) + let line = getline('.') " current line - let substr = matchstr(substr, "[^ \t]*$") - if (strlen(substr) == 0) - return "<\tab>" + 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 + if (strlen(substr)==0) " nothing to match on empty string + return "\" endif - let has_period = match(substr, '\.') != -1 - let has_slash = match(substr, '\/') != -1 + 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 "\\" - elseif (has_slash) - return "\\" + return "\\" " existing text matching + elseif ( has_slash ) + return "\\" " file matching else - return "\\" + return "\\" " plugin matching endif endfunction - inoremap =Smart_TabComplete() - """"""""""""""""""""""""""""""""""""""""""""""""""""""""""" " => Plugins """"""""""""""""""""""""""""""""""""""""""""""""""""""""""" @@ -331,9 +331,9 @@ nmap r :CtrlPBuffer " CtrlP ignore patterns let g:ctrlp_custom_ignore = { - \ 'dir': '\.git$\|node_modules$\|\.hg$\|\.svn$', - \ 'file': '\.exe$\|\.so$' -\ } + \ 'dir': '\.git$\|node_modules$\|\.hg$\|\.svn$', + \ 'file': '\.exe$\|\.so$' + \ } " search the nearest ancestor that contains .git, .hg, .svn let g:ctrlp_working_path_mode = 2