Renaming open files

39 views
Skip to first unread message

Gabriel Gilder

unread,
Feb 24, 2013, 3:33:10 PM2/24/13
to vi...@googlegroups.com
Hey all,

Last meetup I recall we discussed the lack of a good way to rename (and reopen) a file in vim. Well, I looked around today, found one plugin that worked, but not quite to my satisfaction, and decided to just write my own:

https://github.com/ggilder/dotfiles/blob/master/vim/plugin/rename.vim

Hope you find it useful!

-Gabriel

Dan Croak

unread,
Feb 24, 2013, 9:58:56 PM2/24/13
to vi...@googlegroups.com
Just gave it a shot: it works! Nice job.

General question about organization: I've been tossing everything in my vimrc. I'd like to better organize some of the functions in particular. I noticed you put this in vim/plugins. Does anyone have advice on organizing vimscript? Maybe a link to a resource on loading plugins?


--
You received this message because you are subscribed to the Google Groups "VimSF" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vimsf+un...@googlegroups.com.
To post to this group, send email to vi...@googlegroups.com.
Visit this group at http://groups.google.com/group/vimsf?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Gabriel Gilder

unread,
Feb 25, 2013, 2:42:32 AM2/25/13
to vi...@googlegroups.com
Good question, I've been wondering about that myself but haven't actually written that much vimscript. Seems like vim/plugins works fine for lightweight little scripts.

Sascha Faun Winter

unread,
Feb 25, 2013, 5:04:17 PM2/25/13
to vi...@googlegroups.com
Gary Bernhardt takes a slightly different approach:


Faun

Gabriel Gilder

unread,
Feb 26, 2013, 1:23:53 AM2/26/13
to vi...@googlegroups.com
Seems to work ok but it does leave the old file still open in a buffer, which I wanted to avoid.

Faun Winter

unread,
Feb 26, 2013, 1:57:33 AM2/26/13
to vi...@googlegroups.com
The invocation bit is nice: leader-n pre-populates the name of the current file. Just snatch that line, since the function names and the arguments are the same. 

Faun

Sascha Faun Winter

unread,
Mar 4, 2013, 1:22:06 AM3/4/13
to vi...@googlegroups.com
I made the changes mentioned below.

Call rename with leader-n or :Rename and it pre-populates the current filename.

https://github.com/faun/dotfiles/blob/master/vim/plugin/rename.vim

Faun
Reply all
Reply to author
Forward
0 new messages