diff options
Diffstat (limited to 'autoload')
| -rw-r--r-- | autoload/utils.vim | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/autoload/utils.vim b/autoload/utils.vim index 1eeba25..69ef640 100644 --- a/autoload/utils.vim +++ b/autoload/utils.vim @@ -212,12 +212,26 @@ endfunction "------------------------------------------------- " On The Fly Table mode - function! s:isAtStartOfLine(mapping) - let text_before_cursor = getline('.')[0 : col('.')-1] - let mapping_pattern = '\V' . escape(a:mapping, '\') - let comment_pattern = '\V' . escape(substitute(&l:commentstring, '%s.*$', '', ''), '\') - return (text_before_cursor =~? '^' . ('\v(' . comment_pattern . '\v)?') . '\s*\v' . mapping_pattern . '\v$') - endfunction +function! s:isAtStartOfLine(mapping) + let text_before_cursor = getline('.')[0 : col('.')-1] + let mapping_pattern = '\V' . escape(a:mapping, '\') + let comment_pattern = '\V' . escape(substitute(&l:commentstring, '%s.*$', '', ''), '\') + return (text_before_cursor =~? '^' . ('\v(' . comment_pattern . '\v)?') . '\s*\v' . mapping_pattern . '\v$') +endfunction + + +"------------------------------------------------- + +" :Rename {newname} +function! RenameFile() + let old_name = expand('%') + let new_name = input('New file name: ', expand('%'), 'file') + if new_name != '' && new_name != old_name + exec ':saveas ' . new_name + exec ':silent !rm ' . old_name + redraw! + endif +endfunction "------------------------------------------------- |
