File pack/other/start/rename/plugin/Rename.vim changed (mode: 100644) (index 819dccd..cc81c71) |
1 |
1 |
" Rename.vim - Rename a buffer within Vim and on the disk |
" Rename.vim - Rename a buffer within Vim and on the disk |
2 |
2 |
" |
" |
3 |
|
" Copyright June 2007-2011 by Christian J. Robinson <heptite@gmail.com> |
|
|
3 |
|
" Copyright June 2007-2021 by Christian J. Robinson <heptite@gmail.com> |
4 |
4 |
" |
" |
5 |
5 |
" Distributed under the terms of the Vim license. See ":help license". |
" Distributed under the terms of the Vim license. See ":help license". |
6 |
6 |
" |
" |
|
8 |
8 |
" |
" |
9 |
9 |
" :Rename[!] {newname} |
" :Rename[!] {newname} |
10 |
10 |
|
|
11 |
|
command! -nargs=* -complete=file -bang Rename call Rename(<q-args>, '<bang>') |
|
|
11 |
|
command! -nargs=1 -complete=file -bang Rename call Rename(<q-args>, '<bang>') |
12 |
12 |
|
|
13 |
13 |
function! Rename(name, bang) |
function! Rename(name, bang) |
14 |
14 |
let l:name = a:name |
let l:name = a:name |
|
... |
... |
function! Rename(name, bang) |
28 |
28 |
let l:status = 1 |
let l:status = 1 |
29 |
29 |
|
|
30 |
30 |
let v:errmsg = '' |
let v:errmsg = '' |
31 |
|
silent! exe 'saveas' . a:bang . ' ' . l:name |
|
|
31 |
|
silent! exe 'silent! saveas' . a:bang . ' ' . l:name |
32 |
32 |
|
|
33 |
33 |
if v:errmsg =~# '^$\|^E329' |
if v:errmsg =~# '^$\|^E329' |
34 |
34 |
let l:lastbufnr = bufnr('$') |
let l:lastbufnr = bufnr('$') |