qpkorr / vim-renamer

Git repo for http://www.vim.org/scripts/script.php?script_id=1721
MIT License
82 stars 11 forks source link

Renaming Hidden Files #11

Closed alanxoc3 closed 5 years ago

alanxoc3 commented 6 years ago

I found a bunch of files that were hidden in a directory and I wanted to rename them with vim, but the files didn't show up with ':Ren'... So, it would be nice to show hidden files as well as non-hidden files. Maybe this could be a documented option, but I would argue that it would be fine to make this a default as well (Maybe just putting all hidden files at the end.)

qpkorr commented 6 years ago

Hi, thanks, yep, makes sense, good suggestion :) Though just to check - are you referring to files on unix starting with a period (dot) - or files on DOS with the "Hidden" attribute set? I had a look and the latter looks somewhat harder to deal with than the former!

alanxoc3 commented 6 years ago

Yeah. Just Unix. Forget about windows! :smile:

qpkorr commented 5 years ago

Took a while, but if you're still interested, I just added a first pass as this. Hit Ctrl-T to toggle hidden files (including recursively if multiple levels are displayed with the '>' key). You can also set g:RenamerShowHidden (hmm - which I've not actually tested yet...) to enable hidden files by default. If you try it, please let me know how it goes!

kraxli commented 5 years ago

I get an error that b:RenamerShowHiddenEnabled cannot be found (on windows 10). Shouldn't be s:RenamerShowHiddenEnabled in autoload/renamer.vim?

kraxli commented 5 years ago

b:RenamerShowHiddenEnabled seems also to exist on linux (linux mint 19.1)

alanxoc3 commented 5 years ago

Sorry, I didn't reply yet, but cool!!! Both setting the variable and the ctrl-T toggle work fine and as expected as I tested a little bit. Thank you! EDIT: I don't know what you mean by b:RenamerShowHiddenEnabled or s:RenamerShowHiddenFileEnabled, but g:RenamerShowHiddenEnabled worked fine for me.

qpkorr commented 5 years ago

@kraxli Thanks for the merge request and bug report - though like alanxoc3, I'm a little confused by the b:RenamerShowHiddenEnabled or s:RenamerShowHiddenFileEnabled thing too. My thought was that it's entirely possible to have two windows or tabs in vim with renamer running in them, and this toggle should be specific to each instance. My understanding was that that means it should be at buffer level (b:) not script level (s:) - because we wouldn't want the two instances sharing the same setting necessarily (besides the default setting, which can be set via g:RenamerShowHidden). The autoload script contains the code: if !exists('b:RenamerShowHiddenEnabled') if exists('g:RenamerShowHidden') && g:RenamerShowHidden let b:RenamerShowHiddenEnabled = 1 else let b:RenamerShowHiddenEnabled = 0 endif endif in the start function - which should ensure that b:RenamerShowHiddenEnabled exists. So... as I say, I'm a bit confused! Any further thoughts?

qpkorr commented 5 years ago

*dammit - shouldn't "Insert code" keep the formatting... maybe it needs both carriage return and new line and I only gave it the latter... second try... if !exists('b:RenamerShowHiddenEnabled') if exists('g:RenamerShowHidden') && g:RenamerShowHidden let b:RenamerShowHiddenEnabled = 1 else let b:RenamerShowHiddenEnabled = 0 endif endif

qpkorr commented 5 years ago

ah well - check the renamer/autoload/renamer.vim file yourself, about line 81