Hacker News new | past | comments | ask | show | jobs | submit login
Roamer: A Plain-Text File Manager (github.com/abaldwin88)
174 points by tetraodonpuffer on Aug 29, 2017 | hide | past | favorite | 66 comments



It's really nice to see that the author includes detailed instructions for installing without root. It's pretty much how you'd expect it, but a lot of software these days assumes you'll give some random library root access or worse pipe curl to bash:

https://github.com/abaldwin88/roamer/blob/master/doc/faq.md


As a python package developer, I'd assume that being able to install with pip in user space or in a virtual environment is a standard technique. Why duplicate the dozens of tutorials on the internet?


Not every potential user of roamer is a Python package developer.


But every potential user of roamer does need to have pip installed, and know something about it...


Seems like a reasonable use-case for a brief tutorial.


If your EDITOR is already emacs, just use 'wdired'.

https://www.gnu.org/software/emacs/manual/html_node/emacs/Wd...


This, plus the multiple-cursors package, can save entire minutes off tedious file-renaming operations. (That may not sound like a lot but trust me every second counts when you're just renaming files.)


Heh I've used emacs for years and never knew about this.

I actually don't tend to use emacs as a file manager for whatever reason. I find shell file utility commands along with sed, awk, xargs to be adequate.


wdired was a revelation on what an editor can do with capable and imaginative developers on it.


Emacs mostest problem : too many features unless you spend 5 years in it

I liked that roamer has a similar idea, the name/hash lines seems very straightforward. Also a bit of acme in it where text as a bit of meaning.

Maybe it will give wdired ideas too.


Yes, like 'M-x calc' which gives you a very decent RPN calculator.


oh calc is way more than that. it's a cute CAS. And a nice RPN calc. (which I think is simple-calc-mode actually)

Emacs also has bindat, a nice DSL to create bytes structures (for network packets or FFI)

And that's just the vanilla distribution.. Anyway lisp.


Out of curiosity, why did you capitalise editor?


It's the name of an environment variable that most programs respect when opening an editor.


Ah, fair enough. I wasn't sure it emphasis as part of the whole "editor vs ide" dealio.


For things like renaming files, I use a similar utility called "qmv", from renameutils.[1] It is super useful, and one of my most-used commands in the terminal.

For many other file-related operations in my terminal I use Midnight Commander.[2]

I've tried emacs' dired-mode, but I didn't see it being particularly useful compared to Midnight Commander without a ton of time spent on configuring it to work the way I like. I might do that sometime, but until then, Midnight Commander already has so many useful features without any of the time commitment or pain of virtually rewriting much of the same functionality in emacs.

[1] - http://www.nongnu.org/renameutils/

[2] - https://www.midnight-commander.org


A lot of the pain with renaming files can be mitigated using brace expansion in e.g. Bash:

  $ mv path/to/{orig,dest}.foo
  # expands into
  $ mv path/to/orig.foo path/to/dest.foo


Your tip is appreciated, but that pales in comparison to what you could do with vim or emacs and a tool like qmv when renaming files.

You could, for instance, rename by regular expressions, easily do block selections and substitutions, use complex macros, etc. The sky is really the limit.

Then there are unlimited undo features of modern editors, and even branching undo histories where you can get back to a state that would be unreachable with linear undos.

Finally, tools like qmv do sanity checking on your renaming plan, so that if you (for example) wind up renaming two files to the same name, it'll warn you and safely let you rename the original files and try again.

As a result of the power and safety these tools provide, I no longer rename directly using my shell's renaming features (like the ones you describe) except for the absolute simplest and foolproof situations. For anything more complex, I use qmv.


I appreciate the clarification. My comfort with shell (which is one of my primary languages for countless tasks) makes it a more viable option for me and blinds me to the issues many people have. That's definitely not the case for many people.

I can certainly recognize the power of what you are describing. Perhaps I'll give it a try in the future.

Out of curiosity: what do you find are your most compelling use cases for the tool(s)?


Hey Mike, I'm not the original poster, but I'm a good candidate to answer since I'm reasonably comfortable with the shell and I've been looking for a tool like Roamer/qmv specifically because of shortcomings in shell renaming (or my knowledge thereof). My most common case for this is renaming a batch of files to a different naming scheme. For example I was recently renaming 15 or so files that were named like "08/30/2017 John Smith 478939da-b172-4952-b428-d77c4f4f6674.doc" and I wanted them all to be named like "john-smith.doc". I did end up renaming them with the shell but through doing something like `for i in *; do { mv $i \`echo $i | tr '[A-Z]' '[a-z]' | tr ' ' '-'\` } done` (I don't have the final script anymore). Which is slower to write and less elegant than the Roamer/qmv approach. But I'm very curious if there's a better approach to this problem on the shell.


Emacs (w)dired can do that in a snap.


Yup, agree 100%! Using `wdired` was my introduction to "editor-based file-system editing". Maintaining an emacs setup for this feature is overkill though.


zmv is great for when doing mass renaming of files, in zshell. You can for example rename all .jade files to .pug with:

    autoload -U zmv # or put this line in your ~/.zshrc
    zmv -w 'src/**/*.jade' 'src/$1$2.pug'

You can do a dry run by using the `-n` flag too.


The same thing can be done in a kinda portable way with the pre/post substitution/expansion operators (at the moment don't recall their correct name):

  for a in **/*.jade; do echo mv "$a" "${a%jade}pug"; done
If I'm not wrong it should work in Bash and Ksh too (bar the double * expansion), this when I don't have an Emacs at hand.

In the first invocation I prefer to do a "dry run", if it looks good I proceed removing the echo.

P.S. Your example above should use double quote instead of single quote, otherwise the content is not expanded by Zsh

P.P.S. One recall the pre/post operator looking at the symbols on a US keyboard, the post follows the variable symbol...


I think the single quotes are correct, and are whats in my history. I think they're arguments to the zmv program, which itself does the expansion and $1 substitutions. Otherwise I think that $1 would be substituted once when you run it instead of for each file.

I've used zmv to also reorganize the directory structure of files too, something that seems easier to do with its glob/variable replace syntax.

Nice to have a cross platform option for usage in scripts though.


One of the things I love about dired-mode is wdired, which lets you edit the contents of the dired buffer as if it were a file, and then hit C-c C-c to make your changes happen: renamings, deletions, even file permission changes.

https://www.gnu.org/software/emacs/manual/html_node/emacs/Wd...


Used all those and been happy with them, until I found ranger: https://github.com/ranger/ranger


I just tried qmv, briefly. I couldn't figure out how to move files to a different directory, and create that directory if it does not exist.

Let's say I do:

    qmv a.txt
And I get this in qmv:

   a.txt                   a.txt
This does not work:

   a.txt                   foo/a.txt
I was expecting qmv to create the foo/ directory if it does not exist. Even if it exists, it does not work.

Do you know if this works? If it does, how do I do it?


It works for me if the directory exists.


Sorry, I was mistaken. I confirm that that works too. I was just comparing with wdired.. wdired (Emacs) creates that foo/ dir if it doesn't exist.


I use Larry Wall's rename, I just wish I could tell it to use "git mv" instead. Seems like qmv allow that with the --command flag, I'll have to try it, thanks!


qmv and qcp looks really useful, never heard of them before!


I'm hourly user of Midnight Commander on linux, bash.exe, cygwin, mingw, whenever it comes.

And staunch FAR Commander supporter for Windows. I sometimes call mc from FAR and back and forth (okay, very rarely :))

Long time ago there was PC Tools, and a program called.. yes "File Manager" for DOS - both were single-column, yet very powerful - browsing megabytes of text files effortless on 286 :)

back then, there was a tool that allowed direct directory manipulation - renaming, copying, but nothing like the tool demonstrated. Thank you!


Not to be a negative nelly, more just curiosity, but why would you use a different file manager in windows?


Because you have the command-line + browser at the same time. You can quickly copy, view, move files. Change quickly to folders remembered in history. Go in archives, copy, view from there to outside. Sort by various things. Execute directly files.

For example, if I need to run one exe, not in my PATH over some file, I have them both in left and right window. I go to the left, type "Ctrl+F" - e.g. get me the full name (in this case executable), then go to the other window, type "Ctrl+F" again - get me the file to become first argument on the executable and run.

Ctrl+O (in midnight commander too), switches to almost fullscreen command-line - so in a way it's always better than just a command-line.

Search in Files, compare dirs, and many other features (there are tons of plugins).

Also checking SMB shares, FTP, System Processes (though I prefer SysInternals ProcExp.exe there)

I use the Windows Explorer (the file manager) only for very few things - certain context menu items, some forms of preview. It's always there by typing "explorer ." from the current folder.


Having tabs is a big reason for a lot of people that use a different file manager in Windows, at least for the people I talked to about this.


The same reasons one might use an alternative file manager on any other OS: because their workflow suits it better.


One reason might be performance on low powered devices.


DosNavigator was "the shit" back in the day


I remember using M602 (a Czech clone of Norton Commander), it was great.


Was that earlier than Norton Commander?


If you're into plain-text file managers, and vim, you might like Ranger[0]. Like Roamer, it's written in Python.

[0] http://ranger.nongnu.org/


Ranger includes the fantastic `:bulkrename` which allows you to safely edit the marked files with _your editor of choice_.


I really like Ranger[1] as a TUI file manager. It's quite full featured (supporting previews of most things -- even images with libcaca) and has a vim-like interface. It also has `:bulkrename` to allow you to rename a set of files with whatever $EDITOR you want.

[1]: http://ranger.nongnu.org/


this one has a ton of features https://github.com/FedeDP/ncursesFM well written and commented C code.

full list of features: https://github.com/FedeDP/ncursesFM/wiki/Getting-Started

just to name a few advanced ones:

* Search support: it will search your string in current directory tree. It can search your string inside archives too.

* Basic print support through libcups.

* Extract/compress files/folders through libarchive.

* Powermanagement inhibition while processing a job (eg: while pasting a file) to avoid data loss.

* Internal udisks2 monitor, to poll for new devices. It can automount new connected devices too. Device monitor will list only mountable devices, eg: dvd reader will not be listed until a cd/dvd is inserted.

* Drives/usb sticks/ISO files (un)mount through udisks2.

* Distro package files installation through packagekit.


That file manager might be excellent, but did you look at the link? This FM uses your text editor to manage files, which is totally different from a ncurses interface.


vidir is another one of these. Despite the name it works with any EDITOR.

https://github.com/trapd00r/vidir

Seems like the main difference compared to Roamer is that it just uses numbered lines instead of hashes.


vidir is included in moreutils which is packaged for pretty much every distro out there.

http://joeyh.name/code/moreutils/


https://github.com/trapd00r/vidir looks like a fork of moreutils' vidir.


Quite a dangerous tool.

What happens if I copypaste some random text into the file and press save, by mistake? Are there mechanisms to limit the damage?

Also, when I remove a hash and save, the file is gone permanently, even if I paste it elsewhere, right?


No more "dangerous" than any other file manager, because that's what it was designed to do.


I think that's what the demo showed, a deleted file is put into roamer's trash directory. So when a file is deleted (or moved), the hash points to the new location, the trash in this case.


Does it work with Sublime Text? Its multi-cursor abilities would be useful here.


I don't see why it wouldn't -- you might need to use the '-w' flag to make Sublime block until the file is closed (i.e. "export EDITOR='subl -w'")


I wrote my own one of these too (in 30 lines of shell):

http://dnr.im/tech/articles/mvdir/

(for renaming and deleting only)


I love stuff like this. I'm a fairly basic linux user -- mainly basic server stuff. Since I moved to OSX a few years back (from Windows) for my main system, I've been trying to go CLI with as much as possible. Fortunately, brew has almost everything I've wanted to far.

Renaming a lot of files is something I do on a regular basis, so this is another piece I can ditch the trackpad for.


Emacs Dired mode is my go to here


This is similar to hg histedit, where the "ui" is simply a text editor.


vifm works for me.


thx for the tip. just tried it .. very vim, very nice.


Midnight Commander is pretty good.


Anyone else having issues with EDITOR=code ? It seems to open the files blank.


maybe it's because the code binary is exiting right after it starts the editor, and roamer deletes the file

try EDITOR="code -w". It'll open a new instance, in the foreground


Well that sort of worked, however it seems to wait for the whole VS Code process to end which obviously is a pain if you have a bunch of stuff open, which is a shame.


reminds me of Oscar's Renamer http://www.mediachance.com/free/renamer.htm


Better or worse than ranger?




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: