|
|
@ -115,15 +115,20 @@ augroup DisableAutoComment
|
|
|
|
autocmd BufEnter * setlocal formatoptions-=o
|
|
|
|
autocmd BufEnter * setlocal formatoptions-=o
|
|
|
|
augroup END
|
|
|
|
augroup END
|
|
|
|
|
|
|
|
|
|
|
|
" https://vim.fandom.com/wiki/Autocomplete_with_TAB_when_typing_words
|
|
|
|
" :help ins-completion
|
|
|
|
function! TabOrComplete()
|
|
|
|
function! CleverTab()
|
|
|
|
if col('.')>1 && strpart( getline('.'), col('.')-2, 3 ) =~ '^\w'
|
|
|
|
if strpart( getline('.'), 0, col('.')-1 ) =~ '^\s*$'
|
|
|
|
return "\<C-N>"
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
return "\<Tab>"
|
|
|
|
return "\<Tab>"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
" https://vim.fandom.com/wiki/Smart_mapping_for_tab_completion
|
|
|
|
|
|
|
|
elseif exists('&omnifunc') && &omnifunc != ''
|
|
|
|
|
|
|
|
return "\<C-X>\<C-O>"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
return "\<C-N>"
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
endfunction
|
|
|
|
endfunction
|
|
|
|
inoremap <tab> <c-r>=TabOrComplete()<cr>
|
|
|
|
inoremap <Tab> <C-R>=CleverTab()<CR>
|
|
|
|
|
|
|
|
|
|
|
|
" }}}
|
|
|
|
" }}}
|
|
|
|
|
|
|
|
|
|
|
|