Nnn: ToDo list

Created on 6 Oct 2019  Â·  72Comments  Â·  Source: jarun/nnn

Rolled from #332.

Ready for next release

  • run custom (non-shell-interpreted) commands like plugins
  • sessions (thanks @annagrram)
  • configure _cd-on-quit_ as the default behaviour
  • _copy as_ and _move as_ workflow
  • edit , flush selection buffer (thanks @KlzXS)
  • changed the key to size sort to z
  • ignore events during selection so the + symbol is not lost
  • mount archives using archivemount
  • smoother double click handling
  • keybind collision checker (for users setting custom keybinds) (thanks @annagrram)
  • show size of file in bytes in status bar in disk usage mode
  • pass unresolved path as second argument ($2) to plugin
  • mechanism for plugins to control active directory
  • plugins

    • getplugs - a lot of intelligence added to the plugin installer (thanks @KlzXS)

    • drag-file & drop-file: drag & drop files using dragon

    • gutenread: browse, download and read from Project Gutenberg

    • suedit - edit file with superuser permissions

    • fzhist - fuzzy select commands from history, edit and run

    • fzcd - change to a fuzzy-searched directory

    • pskill - fuzzy list a process or zombies by name and kill

    • exetoggle - toggle executable status of hovered file

    • treeview - informative tree output with file permissions and size

    • checksum - recursively calculate checksum for files in hovered directory

    • fzy-open renamed to fzopen

  • additional key ; to execute plugin
  • more explicit force removal message
  • export current file as $NNN (instead of $NN)
  • fix opening files from browser

Proposed features and tasks (up for grabs)

  • [ ] print disk usage and directory snapshot
  • [ ] a video exploring nnn plugins
  • [ ] script to duplicate files in selection

Anything else which would add value (please discuss in this thread).

List of completed features and tasks.

Most helpful comment

@0xACE wow! I can't appreciate you enough for this!

All 72 comments

I've been meaning to ask, what exactly does "script to duplicate selection in respective directories" mean? Does it mean if I selected some entries in dirx that it should select all available entries with the same name in diry? Should this be a plugin?

@KlzXS the script would ask for a suffix from the user and create duplicates of paths in selection. I don't see a pressing need for it right now.

Right. I just wanted to clear up the wording a bit, I found it to be a bit ambiguous.

@0xACE wow! I can't appreciate you enough for this!

@0xACE @KlzXS I am planning to make a release in a few hours. Any last minute additions?

@0xACE wow! I can't appreciate you enough for this!

Anytime bro.

@0xACE @KlzXS I am planning to make a release in a few hours. Any last minute additions?

Nah, go ahead from me. I'm working on a patch for the mouse support but it will not be done in time I'm afraid...

Go ahead. There's nothing I have right now.

@0xACE No problem! This release is a massive one. I don't think we have added so many features in a single release in any of my projects ever! Thank you both for your active contribution.

@0xACE the first release (v1.0) of nnn was on 13 Apr, 2017. Can you please update?

I have updated the initial release date on Wiki.

Hey guys! We have archive mounting in place now. Optional dep but it's quite useful.

I also made some improvements to unmount:

  • the same keybind works with both mounted archives and remotes
  • now you can just highlight the mounted dir and press u to unmount
  • if the highlighted dir is not a mount point it would as for the hostname to unmount

Is there a way to get traversed path in a plugin? That is, working directory displayed next to context numbers on top. Both pwd -L and pwd -P give physcial path of working directory avoiding any symlinks, as does $PWD.

@lawnowner do you mean to say you are only seeing absolute paths? That's the intended behaviour.

I mean I'm seeing absolute paths with symlinks resolved in plugins (canonical paths), e.g. when the nnn top bar display working directory as "/home/lo/Pictures/Mechanisms", $PWD or pwd -L command gives "/mnt/data1/Pictures/Mechanisms" in a plugin.

Hmmm... I'll fix this if you promise to award a star to the project. It's been some time I'm running your errands. ;) :laughing:

Will definitely do, as deserved, and much appreciated!

Test with commit 087380968d4cd828881995b1196181a3c8c23a9f. Unresolved path will be passed as $2 to the plugin.

@KlzXS @0xACE @annagrram with the change from @KlzXS yesterday, the binary size of nnn has exceeded 60KB. We may have to find some ways to reduce it again. The const strings add to the size but what we have currently (help, patterns and keybinds help) are inevitable.

The biggest offender here is browse(). It's the biggest finction, both source code wise and binary wise, and is also the most complex one. We should see if there is any way to simplify it. The nested switches seem like a great thing to eliminate.

The nested switches seem like a great thing to eliminate.

I remember that after grouping cases the size decreased. But yes, if we can refomat that would be great. But I don't see an easy way to do that.

@KlzXS @0xACE @annagrram with the change from @KlzXS yesterday, the binary size of nnn has exceeded 60KB. We may have to find some ways to reduce it again. The const strings add to the size but what we have currently (help, patterns and keybinds help) are inevitable.

Aggressive optimizations for fast execution might cause the executable to grow.
I don't find it too worrisome at the moment (76K stripped on my machine with gcc).
But, if we want an easy and quick solution, we can try use a packer like UPX.
On my machine, it creates a 40K executable, should affect only load time which is unnoticeable, on my machine at least, because the binary is quite small to begin with, so it doesn't have a lot unpacking to do (according to their page, it should be able to unpack the entire binary in a fraction of a second even on ancient systems).

That is, of course, not to say that some code cleanup and refactor (especially of the browse function), might be beneficial.

we can try use a packer like UPX

not yet

That is, of course, not to say that some code cleanup and refactor (especially of the browse function), might be beneficial.

We will try this first. Let's have the important features (cp/mv as, session support) in and stable. If we get rid of the help, we can get back to original size (I tried it). So probably we'll target the strings first - to make them meaningfully shorter. But let's have the features in.

@0xACE AFAIK, you are on Arch Linux. Do you have fusermount3 or fusermount?

@0xACE @KlzXS @annagrram are you getting my messages in the dev discussion group?

Yes

OK, I don't see any response so thought there's a problem.

@0xACE AFAIK, you are on Arch Linux. Do you have fusermount3 or fusermount?

there is fuse3 and fuse2.

  • fuse3 provides fusermount3
  • fuse2 provides fusermount

I have both installed. as dependencies of other packages. In my case sshfs depends on fuse3 and archviemount depends on fuse2

@0xACE @KlzXS @annagrram are you getting my messages in the dev discussion group?

Yessir. My problem is mostly that launching the browser and going to github is a big task for my main machine... My phone is better than my pc... And my phone is shit... The terminal life is friendly though :-D

I am also recieving messages when I turn on data, but I'm in roaming so I'm trying to cut that to a minimum. I will return home on the 24th so until then I probably won't be responding much.

The terminal life is friendly though :-D

Go for a terminal browser then :)

I have both installed. as dependencies of other packages. In my case sshfs depends on fuse3 and archviemount depends on fuse2

In that case, is archivemount with nnn broken for you? Because if it finds fusermount3 it will use it.

In that case, is archivemount with nnn broken for you? Because if it finds fusermount3 it will use it.

broken in which way? i have previously tried archivemount and didn't have issues.

my pc has both fustermount3 and fusermount (represnting fuse2)... From my experience I haven't seen error messages so far...

I can see that unmount() is defaulting to fusermount3. so I ran fusermount3 -u myarchive and it unmounts without errors...

Go for a terminal browser then :)

Some times I do, but really the entire web is a poor experience for me... Mail would be easier considering github works sort of with it, but I'm not inclined to fill my inbox with that just yet...

@0xACE, I must tell you, with your mouse click patch, nnn on Termux is smoother than ever. I use it heavily.

I am working on refactoring browse() to make it thinner wherever possible.

@0xACE would it be possible to combine the drag and drop plugins into one?

@0xACE would it be possible to combine the drag and drop plugins into one?

Absolutely, I'm busy this week, so I won't be able to provide much help, but feel free to do with it as you like...

Absolutely, I'm busy this week, so I won't be able to provide much help, but feel free to do with it as you like...

No hurry. Whenever you get the time. I don't use mouse or have dragon installed. ;)

Well it just happened, I accidentally deleted a file I didn't intend to delete...

Can we implement a method to show what we are about to force delete in both ^X and X?

Any ideas on how that implementation would look/work?

show the selection or current. but we already ask, this is gonna add to delay.

If you need it, make it optional.

For ^X, it's your hovered file. Why do we need to show again? We don't block the view either.

I'm frequently confused by which one is which X vs ^x, and it doesn't help that my tmux has ^x as leader key...

It frequently confuses me. but no worries, ignore that I brought it up, I'll experiment locally to see if there is something I could do about it :)

I'm frequently confused by which one is which X vs ^x

Awwww... you aren't using it enough! ;)

Hey, I cannot see size of dirs. What should I do?

@aryadovoy on which version are you? what do you mean by size of dirs? size in du mode or the regular size?

@aryadovoy on which version are you? what do you mean by size of dirs? size in du mode or the regular size?

Master of 2.7.
I prefer du mode, but any option would be enough.

The cumulative size si shown in du or au mode already. In normal mode the size from stat is shown. Can you share a screenshot of what you are seeing?

I used D-key for checking sizes by bytes, but nothing.
2019-11-01_094015
2019-11-01_094038

D is for the file details. You can already see the du for the dir in the du screen.

If you are looking just for the byte size, what's the use-case?

It's not that difficult though... in the du or au mode we can show the byte-size in the status bar anyway.

If you are looking just for the byte size, what's the use-case?
Exact size of directory for comparing.

OK, I will add a patch for this, It's a good value addition! :+1:

Patch to show file/dir du size is in at commit ef8db1fd45bd57b1f4a807d50cdf6ceb81158bdd.

Patch to show file/dir du size is in at commit ef8db1f.

Perfect!

It would be possible to create package of nnn to OpenWRT project https://github.com/openwrt/openwrt/tree/master/package?

@podtor please feel free to port nnn to OpenWRT. As the deps are less it wouldn't be a monumental task. Please get in touch with the OpenWRT team for porting guideline.

What about toggle a→z to z→a for name, size and time sorting and changing of sorting from ABac to AaBc?
And I have second layout (not english), so commands don't work on this layout.

No other order toggles would be added. You can always roll-over at edges and scan in reverse.

And I have second layout (not english), so commands don't work on this layout

Please elaborate this.

Hey, sort of running around atm, but I noticed a segementation fault:

  1. start nnn
  2. create a empty directory: ndempty_dir
  3. go into the empty directory
  4. Run any NNN_PLUG script
  5. segmentation fault

As I'm not on a workstation I can't debug it atm. But it seems like the key is that the directory is empty and you try to trigger a NNN_PLUG script

I am able to reproduce this.
Here is the gdb backtrace, if anyone's interested:

#0  run_selected_plugin (lastdir=0x7ffc23170630, lastname=0x7ffc23170638, runfile=0x0, rundir=0x7ffc23172990 "/home/[user]/test/empty_dir", newpath=0x7ffc23170990 "/home/[user]/.config/nnn/plugins/checksum", file=0x560ee1af3572 "checksum", path=0x7ffc23170628)
    at src/nnn.c:3410
#1  run_selected_plugin (path=0x7ffc23170628, file=0x560ee1af3572 "checksum", newpath=0x7ffc23170990 "/home/[user]/.config/nnn/plugins/checksum", rundir=0x7ffc23172990 "/home/[user]/test/empty_dir", runfile=0x0, lastname=0x7ffc23170638, lastdir=0x7ffc23170630)
    at src/nnn.c:3388
#2  0x0000560ee0e1a1cd in browse (ipath=0x560ee1af3590 "/home/[user]/nnn", session=<optimized out>) at src/nnn.c:4975
#3  0x0000560ee0e11433 in main (argc=<optimized out>, argv=0x7ffc23175da8) at src/nnn.c:5633

Edit: this is on the latest commit 6ea64288bc7199f

Should be fixed at commit fa4c37f2304e304d53eeabe23713fea082839915. Please confirm.

Yep, after fa4c37f it no longer crashes.

Please elaborate this.

For example, I press P-key for paste, but it's З-key on russian layout. And I should change layout and try again. It's inconvenient.

No other order toggles would be added.

It's a pity, cause I used to AaBc sorting.

@jarun, thanks. It doesn't crash anymore.

For example, I press P-key for paste, but it's З-key on russian layout. And I should change layout and try again. It's inconvenient.

I see what you mean. Unfortunately, I don't think this will be fixed. However you can change nnn.h to represent your needs better.

I have dealt with this problem before, I have tried having programs automatically toggle between languages and I ultimately succumbed to using a full en_US keyboard and mapping my own language extras as "hidden modifiers".

Though I should mention it's not impossible to get it fixed in nnn but, I don't see this happening in reality...

It's a pity, cause I used to AaBc sorting.

Iirc it's not to complicated to use your own sorting algorithm in nnn.

Btw, @jarun what are your opinions on nnn using threads? No need to go deep into this, I'm just lurking on the idea of checking of the size of all files in a directory not locking the interface...

Though I should mention it's not impossible to get it fixed…

Ok, I can live with it.

Iirc it's not to complicated to use your own sorting algorithm in nnn.

But it could be option (flag), no?

I'm just lurking on the idea of checking of the size of all files in a directory not locking the interface...

Are you talking of the du calculation? I am not sure using threads would help a lot.

Ok, I can live with it.

Hehe, bro before you give up try changing/adding bindings in nnn.h :)

But it could be option (flag), no?

Read man 3 qsort you can do it buddy :)

But honestly I think the sorting thing could be reworked slightly, I recall I added my own sorting stuff and it was always troublesome because you have to toggle all the other sorting modifiers. Now as I'm writing this message I'm thinking maybe we could add a function that turns of the other modifiers so you don't have to copy paste that same code each time. (Note i havent looked at that part of the code since I first put in my changes, and it might be different today, and this is just from my memory, i might be thinking of another project)

Are you talking of the du calculation? I am not sure using threads would help a lot.

Yes, the S key, triggering it in a large folder takes a lot of time, and on remote folders it isn't the greatest experience... The idea of a second thread would be that it wouldn't block the interface, and it would update results as it goes... But honestly it's not a big deal. I understand the complexity of implementing a secondary thread. You can disregard I even brought it up :)

The idea of a second thread would be that it wouldn't block the interface, and it would update results as it goes

I would like to see some benchmarks. Try it with threading when you get the time.

I would like to see some benchmarks. Try it with threading when you get the time.

No need to benchmark. The current implementation is blocking until du finishes. And I really cant bother to implement it.

The reason I thought about it is because I was considering adding another column to my local version of nnn and have external scripts be able to fill that extra column as they see fit via some IPC or FIFO-file or w/e, but really nnn serves its purpose fine if you ask me.

I noticed you don't have a website. I make a cross-platform open source website generator called Nift (https://nift.cc) and would be happy to make a website for your project using Nift if you are interested? It would help me showcase what Nift is capable of. Though I may need some help with the content, but am more than happy to set something up and see what you think (don't have to use it if you don't like of course), it's surely preferable to have a website where you guys/girls can add/modify/remove content yourselves anyway.

Nift is the world's fastest website generator, up to 15 times faster than it's closest rival Hugo and can scale to building websites with millions of pages.

They don't have to be, but typically Nift websites are git repositories (so full revision history) with files to build the website and a built version of the website that can standalone by itself (with no way to tell it was made with Nift either).

The Nift website (https://nift.cc) is made with Nift and the HTML5 UP template escape-velocity. https://tron.ai-bots.net is made with Nift and the HTML5 UP template solid-state. https://lvsportsclinic.com is made with Nift and the HTML5 UP template forty (and parallelism for the blog, which is really nice!).

The templates I would have in mind would be any of the following:
https://html5up-nsm-templates.github.io/alpha/
https://html5up-nsm-templates.github.io/helios/
https://html5up-nsm-templates.github.io/landed/
https://html5up-nsm-templates.github.io/telephasic/
https://html5up-nsm-templates.github.io/twenty/
https://html5up-nsm-templates.github.io/txt/

Though you can pick any template from html5up.net or pixelarity.com.

I also have the person who made the Nift bunny and badger mascots on facebook (check the bottom of the Nift website for the badger) and am happy to get him to do a mascot/logo for nnn if you would like too, though I can't get that for you for free sorry. I paid AUD$260 for the bunny.

Let me know if you are interested and we can start working out what template to use and progress from there.

Edit: https://gitlab.com/nifty-site-manager/nifty-site-manager.gitlab.io that's the source code for the gitlab mirror of the Nift website. The files to generate the website are in the content and template directories and the built site in in the site directory.

@KlzXS could you work on the retain modified plugins item? It needs improving the current getplugs script to detect if user has modified a plugin and provide an option to retain, merge (in vimdiff) or overwrite. It would make life very easy. You can also make enhancements like don't overwrite if a plugin has not changed.

Sure thing.

Rolled at #386.

Was this page helpful?
0 / 5 - 0 ratings