diff --git a/.gitmodules b/.gitmodules index 6943c9b..407ea18 100644 --- a/.gitmodules +++ b/.gitmodules @@ -83,3 +83,7 @@ path = bundle/vim-mkdir url = https://github.com/pbrisbin/vim-mkdir ignore = dirty +[submodule "bundle/vim-rename-file"] + path = bundle/vim-rename-file + url = https://github.com/pbrisbin/vim-rename-file + ignore = dirty diff --git a/bundle/vim-rename-file b/bundle/vim-rename-file new file mode 160000 index 0000000..90e27bb --- /dev/null +++ b/bundle/vim-rename-file @@ -0,0 +1 @@ +Subproject commit 90e27bb0b86076d664beafb76a3dfd101e7fd4c9 diff --git a/vimrc b/vimrc index eee4eb8..b7d51a3 100644 --- a/vimrc +++ b/vimrc @@ -62,8 +62,9 @@ inoremap ( ()O nnoremap :nohlsearch -map r :Run map m :make +map n :RenameFile +map r :Run cmap w!! w !sudo tee % >/dev/null:e! @@ -79,14 +80,3 @@ function! RestoreCursor() exe "normal g`\"" endif endfunction - -function! RenameFile() - let old_name = expand('%') - let new_name = input('New file name: ', old_name, 'file') - - if new_name != '' && new_name != old_name - exec 'saveas ' . new_name - call delete(old_name) - endif -endfunction -map n :call RenameFile()