Changed Clevertab to return <Tab> in text files

This commit is contained in:
Andrea Mistrali 2014-03-15 11:50:50 +00:00
parent 7e93e9f162
commit 90e85e7bea
1 changed files with 10 additions and 6 deletions

View File

@ -90,11 +90,13 @@ colorscheme railscasts
" Function that returns tab if called on an "empty" line " Function that returns tab if called on an "empty" line
" C-N elsewhere " C-N elsewhere
function! CleverTab() function! CleverTab()
if strpart( getline('.'), 0, col('.')-1 ) =~ '^\s*$' if &ft=="text"
return "\<Tab>" return "\<Tab>"
else elseif strpart( getline('.'), 0, col('.')-1 ) =~ '^\s*$'
return "\<C-N>" return "\<Tab>"
endfunction else
return "\<C-N>"
endfunction
" map the function to Tab " map the function to Tab
" inoremap <C-\> <C-R>=CleverTab()<CR> " inoremap <C-\> <C-R>=CleverTab()<CR>
inoremap <Tab> <C-R>=CleverTab()<CR> inoremap <Tab> <C-R>=CleverTab()<CR>
@ -234,9 +236,11 @@ else
endif endif
" Map Ctrl-T to new tab and Ctrl-W to close tab " Map Ctrl-T to new tab and Ctrl-W to close tab
" Map Ctrl-S to save
if !(has('mac') || has('macunix')) if !(has('mac') || has('macunix'))
nnoremap <silent> <C-T> :tabnew<CR> nnoremap <silent> <C-T> :tabnew<CR>
nnoremap <silent> <C-W> :tabclose<CR> nnoremap <silent> <C-W> :tabclose<CR>
nnoremap <silent> <C-S> :w<CR>
endif endif
" <Leader>hh opens my help file " <Leader>hh opens my help file
@ -245,7 +249,7 @@ nnoremap <silent> <Leader>hh :help akmap<CR>
" Vim5 comes with syntaxhighlighting. If you want to enable syntaxhightlighting " Vim5 comes with syntaxhighlighting. If you want to enable syntaxhightlighting
" by default uncomment the next three lines. " by default uncomment the next three lines.
if has("syntax") if has("syntax")
syntax on " Default to no syntax highlightningendif " has("syntax") syntax on " Default to no syntax highlightningendif " has("syntax")
endif endif
if has("autocmd") if has("autocmd")