jarun/nnn

ToDo list

jarun opened this issue ยท 56 comments

jarun commented

Rolled from #202.

Completed features

  • central location for files and plugins
  • plugins framework
  • SSHFS support
  • support bsdtar
  • drop dependency on vidir
  • mouse support (thanks @bruce-hill)
  • native batch rename to remove vidir dependency (thanks @bruce-hill)
  • per-context detail/light mode
  • case-insensitive version compare
  • FreeDesktop compliant trashing
  • Show a + symbol before selected entries
  • wild mode (option -w, key ^W) for nav-as-you-type
  • POSIX-compliant GUI app launcher with drop-down menu (key =)
  • show permissions in detail mode
  • cp, mv progress bar for Linux (needs advcpmv) [BSD, macOS shows on ^T]
  • make libreadline an optional dep (reduces memory usage)
  • minimize the number of redraws
  • handle screen resize gracefully
  • option -d to show hidden files (NNN_SHOW_HIDDEN is removed)
  • option -C to disable colors removed
  • per-context initial directory replaced by program start dir
  • use nnn as a file picker with picker.sh
  • user-contributed scripts repository
  • substring search for filters (option -s)
  • version sort (option -n)
  • disk usage calculation abort with ^C
  • create sym/hard link(s) to files in selection
  • archiving of selection
  • show dir symlinks along with dirs on top
  • key N (1 <= N <= 4) to switch to context N
  • bring back NNN_OPENER to specify file opener
  • env var NNN_NOTE and keybind ^N for quick notes
  • handle multiple arguments in VISUAL/EDITOR
  • show the current directory being scanned in du mode
  • select all files
  • use libreadline for command prompt
  • reduce delay on Esc press
  • config option to avoid unexpected behaviour on 0-byte file open (see #187)
  • support custom opener (e.g. mimeopen)
  • run a command (or launch an application)
  • a new demo video (see #167) (thanks @Kallinteris-Andreas)
  • choose script to run from a script directory (see #127)
  • shortcut to run current file as script
  • support a combined set of arguments to $EDITOR, $PAGER and $SHELL
  • remote connection and file transfers (using lftp)
  • per-context directory color
  • support for Cygwin env
  • offer to fore file removal
  • support selection across directories and contexts
  • parse EDITOR or VISUAL for options when NNN_USE_EDITOR is set
  • option to disable file open on navigation (Right Arrow and l keys)
  • vim plugin to use nnn as a file picker within vim
  • retire nlay (no more used by nnn)
  • integrate static analysis on Travis
  • list currently copied files
  • option to disable directory auto-select
  • use $TMPDIR if available
  • support terminal locking on OS X (bashlock) and BSD (lock)
  • support patool
  • run any number of scripts
  • prefer VISUAL over EDITOR
  • add a keybind to run a custom script (see #79)
  • integer get_coolsize() (thanks @arsv)
  • batch rename, move, delete files with vidir integration
  • copy file paths when X is unavailable
  • support copying multiple file names to copier
  • add open with... shortcut
  • add option to open bookmark directly
  • optimize memory usage and algorithms for file name handling
  • list and extract archives
  • show current selection number along with total entries in dir
  • support NNN_NOWAIT to unblock nnn (DE specific)
  • file and directory creation
  • change to light mode if number of cols < 35
  • in-place file rename
  • watch out for current dir changes (if not in filter or du mode)
  • pin and jump to a directory
  • show vol capacity and vol free in help
  • option to use exiftool instead of mediainfo
  • option to show dirs in custom color (default: enabled in blue)
  • show dir content size and number of files in du mode
  • support bookmarks string
  • add option to support opening text files in EDITOR
  • use xdg-open on Linux and open(1) on OS X as desktop opener
  • support multiple apps in nlay
  • use vlock as default terminal screensaver
  • navigate-as-you-type mode
  • subtree search (using gnome-search-tool or catfish)
  • support custom nlay
  • search-as-you-type at filter prompt
  • RPM packages for RHEL/CentOS (thanks @fennm)
  • support cd ..... (with . as PWD, stops at /) (feature removed)
  • jump to initial directory (where nnn was started)
  • nlay - a shell script for actions like open desktop search utility, run screensaver
  • show file details, mediainfo output, help in less
  • show media information (needs mediainfo)
  • use Q to quit to current dir (needs external shell integration)
  • use ^Q to quit (even from filter mode)
  • UTF-8 support
  • add option to start in disk usage analyzer mode
  • open current dir in desktop file manager
  • disk usage analyzer more
  • show unprivileged free blocks in du mode
  • shortcut - to jump to last directory
  • resolve ~ (HOME) at chdir prompt (feature removed)
  • option to show complete stats of just the current entry (name, file type, human readable permission string, byte size... all lstat() details)
  • update noice man page
  • sort entries by size
  • support file path copier script (NNN_COPIER)
  • support detail view (default)
    • file type
    • modification time
    • human-readable file size
    • current item in reverse video
    • full name of currently selected file in bottom "bar"
  • roll navigation with Up and Down at the first and last entries
  • remove restriction on visiting parent dir when opened with a relative dir path
  • case insensitive alphabetic content listing
  • generate optimized binary
  • show total number of files in du mode (apparently it has to be counted in nftw callback, with adjustments like file type check, hardlink check, which means unreasonable overhead)
  • threaded/multicore nftw(3) (overkill, we are already very fast)
  • use scandir instead of readdir (we are using custom alphanum sort, see 6912912)
  • modify packagecore.yml and probably Makefile to generate OpenSUSE Leap package

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

The recycle bin desire is higher on my list now. In the spirit of the other commands, perhaps allowing to replace the command used to rm with an environment variable would a good solution? This would allow someone to specify their own script to handle rm.

jarun commented

I think it wouldn't be a big patch. I will work on it.

jarun commented

@norcalli @redquixote trash files on delete is implemented at commit 7811518.

Please test and confirm things work as you expect them to.

@jarun I tested it. It works fine for when you have NNN_TRASH set, but funnily enough it broke the normal mode with the following error when you drop into shell rm: invalid option -- 'N'. Were you aware of the command rmtrash before implementing this? For instance, that handles the case where you have to put something into the trash on a different drive instantly, whereas with this implementation will move it to another drive, which takes time to mv. It might be worth looking into.

jarun commented

I'll avoid a wrapper over rm and live with the fact that files are moved to a central location at the cost of cross filesystem moves.

it broke the normal mode

I think I faced this and fixed it (but can't remember exactly, I fixed several issues last night). Please check on master.

Thanks for testing it.

it might be good to integrate with trash-cli

jarun commented

If your concern is movement across filesystem, I have decided to live with it. I am not adding a new dependency for this.

Another problem with the way nnn trashes files is that it doesn't make restoring those files easy.

Most desktop environments (GNOME, KDE, LXDE, XFCE) use the Freedesktop Trash specification, which allows users to trash and restore with ease. On KDE, for example, one can use the ktrash command to trash and restore files.
trash-cli is another Freedesktop compliant trash implementation.

Making nnn Freedesktop compliant would also let people manage the same trash from other applications, such as a gui file manager. You can make it an optional dependency, one would just need to set a $NNN_TRASH_COMMAND variable.

Yeah, it's less about the cross directory thing and more about trash compliance and edge cases.

jarun commented

Why not have it in the scripts directory and use it?

Are you guys aware of any C utility that's available in the repos and does the same thing?

jarun commented

Another problem with the way nnn trashes files is that it doesn't make restoring those files easy.

If you see the output of trash-restore, it's more inline with using as a script

$ trash-restore
0 2007-08-30 12:36:00 /home/andrea/foo
1 2007-08-30 12:39:41 /home/andrea/bar
2 2007-08-30 12:39:41 /home/andrea/bar2
3 2007-08-30 12:39:41 /home/andrea/foo2
4 2007-08-30 12:39:41 /home/andrea/foo
What file to restore [0..4]: 4

just need to set a $NNN_TRASH_COMMAND variable.

It's not that simple. None of the utilities are param compatible with rm. Much more change is required to handle the cases separately.

Also, OS X may or may not follow the freedesktop schema.

But I can think of a way. Can you guys check if you create ~/.local/trash as a link to your DE Trash dir that works or not?

Also, OS X may or may not follow the freedesktop schema.

Yeah on macOS it's ~/.Trash

jarun commented

Guys, trashing using trash-put is implemented at commit 5dd5710.

Have fun!

jarun commented

Just set NNN_TRASH=1 and you are good to go!

Note that the previous implementation to move to ~/.local/trash is removed.

There's a good chance I've just missed where it was written, but is there a way to launch nnn such that the terminal's working directory will be the same as the directory that nnn last viewed before closing? (sorry if this isn't the right place to write this, I can't seem to find where else to)

@jarun I was wondering if the behaviour of the selection could allow for discontinuous regions of selection? Something like "Select all, unselect specific file" because it seems as if it isn't directly possible right now. The single file selection isn't a toggle, but an enable.

Also, I forgot to thank you for the trash implementation! Definitely don't neglect your family for us/work in general.

jarun commented

@norcalli what you can do today is - set selection mode, cherry pick and end selection mode.

unselect is not available because we don't keep the whole selection in memory and write it to the .nnncp file as soon as something is selected. To unselect we have to match a specific file in the copier and remove it from there. That would increase the complexity of a simpler solution.

Also, going forward, please consider contributing patches to the project. I am sure nnn has scopes for improvement and I need people to work on them, not just pointing out scopes for improvement.

jarun commented

@creallfluharty nnn has options to begin at a directory and write the last visited directory to a file. You can easily write script(s) that make use of these 2 features and do what you want to do.

@jarun I actually stared implementing the trash solution after I mentioned it, but you created a patch with your own trash version and committed it to master before I could finish, so it was more prudent to ask you to consider changing it at the time. I do contribute to dozens of open source projects.

jarun commented

@norcalli in that case, along with the feature request do add a note that you intend to implement it as well. So that we don't work on the same thing.

  • what about multipliers for movement operations similar to VIM ?
    i.e. 8j to go down 8 lines
  • change directory by typing path in a prompt inside the program
jarun commented
  • multipliers: we don't show serial numbers along with each files. This would be cumbersome if one has to count and type. Filtering with the file name is a better approach.
  • cd prompt: this feature was removed because an important use case of nnn is easy navigation, it shouldn't need a user to type at the prompt to cd. As a later improvement, I have added a shortcut to jump to / in master. The rationale is - at a prompt you start either at the current dir (cd .. OR cd subdir etc.) OR from / (using absolute path). With nnn now you can start navigating from both these locations instantly.
  • about cd prompt not serving to ease navigation. As an example: if I need to arrive at /usr/share/include/ from /home/user/bananas/ I have to type: 3 left keys, /us , observe the screen that the results are narrowed down to the correct folder, or use more navigation keys to arrive at it, then right, /sh... repeat , right, and so on so even more types if I was using up/down/pageup/pagedn.all this takes unnecessary time and effort and stalls me as user if I already know I only want to arrive at /usr/share/include/.

  • page up and down keys should scroll a screenful and not half.

jarun commented

You have to type: ``` to reach root (not 3 left keys). This is in master.
You shouldn't have to press right so many times if auto-select is enabled (which is default).

I have /usr/share/hardening-includes and this is what I pressed:

Esc
`
u
s
s
h
i
n
c

to reach it (from anywhere, as I jumped to / first).

That's just 9 key presses. I've been using nnn in this mode for sometime now and I it's natural I didn't find any lag. I would request you to try nnn for a week or so and see the difference in the experience.

page up/down: that's inherited from noice. I think it's done because you'll notice that if you have many files (e.g. /usr/bin) and you scroll down a bit far the file in the middle is selected rather than the one at the top or bottom. If you want to change it please raise a PR and we'll review how the new behavior is.

Are you sure that auto-select is enabled by default ? I had to run nnn -i to get auto-select in navigate-as-i-type mode but no auto-select in regular mode with regular search.

jarun commented

Auto select is not enabled in normal mode (as filtering by typing characters won't work). It is enabled in navigate-as-you-type mode by default.

jarun commented

@bruce-hill would it be possible to work on a function to eliminate our dependency on vidir?

@bruce-hill would it be possible to work on a function to eliminate our dependency on vidir?

Depends on what the desired use case is. For just renaming files one at a time, it would be very easy to just loop through the selected files, prompt the user to edit the filename, then move it if necessary. For doing a regex rename, that would also not be too hard to do with a shell script and sed, something like: prompt the user for a regex, then run sed -e '<your regex>' copybuf.txt | paste -d'\n' copybuf.txt | xargs -d'\n' -n2 mv. For letting the user rename a bunch of files using their editor of choice, probably easy too: just create a copy of the copybuf file, let the user edit it, then run something like paste -d '\n' copybuf.txt copybuf_copy.txt | xargs -d'\n' -n2 mv (use xargs and paste to run a mv command on corresponding lines of the original and modified copybuf). Replicating the full functionality of vidir (including letting the user delete files) would be a bit more complex, but the functionality of vidir already kinda overlaps with nnn, so it's probably not worth doing everything vidir does.

jarun commented

For letting the user rename a bunch of files using their editor of choice

Just this . For the entries in a directory. We need to match the checksum before and after edit so the content of the dir isn't changed while the user was editing the file. No need to support movement of files. We should also use the index numbers like vidir to ensure the order is right.

jarun commented

Probably we can retain movement and deletion of files. As these are handy. Note that some of the entries can be directories as well.

I have noticed vidir doesn't handle Unicode very well which should not be a problem for us.

No need to support movement of files.

Sorry, I was using "move" and "rename" interchangeably, since renaming is done with the mv command.

We should also use the index numbers like vidir to ensure the order is right.

That increases the complexity considerably, since you would have to do a bunch of error checking and handle deleting files. The changes I was suggesting are basically drop-in shell one-liners that handle the renaming part of vidir. For deleting, you can just delete files in nnn normally by selecting them and pressing X, so I don't think the added complexity of replicating all of vidir's functionality is worth it. I also don't think it's worth worrying about the file numbering, unless there's some reason I'm not thinking of for why users would edit the ordering of the files (other than deleting files). As far as I can tell, vidir just uses the numbers to detect which files get deleted.

If you wanted to be extra safe, you could wrap the shell script with something like if [ $(wc -l copybuf.txt | awk '{print $1}') = $(wc -l copybuf_copy.txt | awk '{print $1}')]; then ...; else echo "File count mismatch"; fi to abort if the user deleted or added lines.

jarun commented

vidir uses the numbers to track which files are changed: https://linux.die.net/man/1/vidir

Yes, I think move/rename is sufficient. No need to have delete (we support delete selection so we are good there).

Can you please raise a PR for this?

jarun commented

Note that we should not use rename() as it doesn't work across filesystems: http://man7.org/linux/man-pages/man2/rename.2.html

Can you please raise a PR for this?

Sure, I can put together a PR in a little while.

jarun commented

Thank you!

I recently discovered agedu and find it quite useful as du replacement, or better, extension. The added value is that it can quickly filter directories and disk usage of long time unused files. Sure, it has some drawbacks but it could be a neat du alternative embedded in nnn. Performance and footprint (besides index files) seems okay to me. What do you think?

jarun commented

@smartmic please have it as a plugin and contribute it back for others if you find it really useful.

For the past few months our efforts are into reducing the number of deps and configs of nnn. There are some obvious benefits - plugins are loosely coupled (we don't have to worry about deps), users can pick and use on a need basis, users can add their own.

Yes, this makes sense. I will have a look into the plugin concept and publish it when I think it works well enough for everybody. Thanks for the tip!

new selection mode doesn't allow for unselecting an item, it is just selected twice, forcing to undo all selection and redo. I think this is unwanted

Also, in a previous version, on my local repo, i colored the output of non-dir files, trying to reproduce the colors of the ls --color=auto. I think this would be a great improvement for readability, maybe making it optional

jarun commented

@Antonio210696 this has been discussed several times in other threads. Please check.

0xACE commented

Hey, I haven't had the chance to try the patch you suggested for #301 but I reckon it will work as intended.

Some thoughts i have of nnn after using it for about a week:

  1. Lack of CONTROL('W") to delete a word in filterentries() or and xreadline(). In my local copy of nnn I have applied a poor mans application for this feature, and could share it if you are interested. (I use CTRL-W in linux more that i use the backspace key, i have killed many webrowser tabs by this habit)
  2. Lack of mouse scroll wheel support. I find it really convenient to be able to use the mouse some times. I have applied it on my local copy of nnn and in my case it is bound to scroll down/up half a screen, and it works fine. Along with this I also moved going back 1 directory to right mouse button rather than middle mouse button.
  3. I didn't like the substring matching, I changed it so that spaces act as a && operator so shazam mkv would match shazam.2019.mkv but not shazam.2019.srt (mkv shazam would work fine too). And I might eventually add leading the filter with a / would switch over to the REGEX method... I also added HJKL to not fill the text in filter mode, and just act as the regular hjkl keys in the normal mode (had to remove SEL_LOCK as i wanted HJKL to work in normal mode for consistency). (Also did it for ~!@# (where # is a alias for - because in filter mode i occasionally search for -) so that you can access those keys without having to exit filter mode) (PE to access p and e without having to exit filter mode first, essentially these changes allows you to do some basic stuff without first having to exit the filter mode)
  4. I accidentally hit the r key in my home directory when i tried to change the name of a file i had hightlighted. And r launches a batch rename on my home directory, out of reflex i immediately hit ZQ to exit out of vim and poof my home directory was broken. I haven't had the chance to debug what actually happened but i applied a patch to stop batch rename working in my home directory. (In my home directory there may have been files with weird names and some symlinks, roughly 2GB of data was lost, again I haven't had the time to research what actually happened, the missing data may have been unrelated to this incident, so its likely safe to ignore it at this point). Since this happened i have added F2 to rename as I usually hit that out of a habit to rename files...
  5. Another one that i wouldn't recommend but I like using it in my local copy is: in filter mode hitting / while highlighting a directory navigates into the directory and returns to the filter mode even if you aren't in navigate-as-you-type mode and lets the user exit it just be pressing escape (i also added q to exit filter mode, Q lets you add a regular q to filter, but that's convoluted for the general population i guess)(in xreadline() (*ch == 'q' && pos == 0) will also cancel the prompt) (I guess it's obvious that I don't have escape mapped to caps lock).

I guess i could create separate issues for my thoughts, but since I can't find a irc channel to just see if these things are even "commonly acceptable". I'll just put them here...

Finally at various places i have read that nnn selections should work between contexts and instances. selecting a file and hitting y works as intended between contexts however if I launch a second (parallel) instance of nnn: hitting y will state empty selection. Am I doing something wrong?

-- Signed a happy nnn user :D

jarun commented

@0xACE

Lack of CONTROL('W") to delete a word in filterentries() or and xreadline().

Please raise the PR and I'll take a look at it

Lack of mouse scroll wheel support.

We have explored this earlier. Some version of ncurses support scrolling, some don't. We decided to leave it out of plan.

I didn't like the substring matching

regex is the default and your the shazm mkv case can be handled with wildcards.

I also added HJKL to not fill the text in filter mode, and just act as the regular hjkl keys in the normal mode

I don't understand what you mean. HJKL characters work in a filter.

Also did it for ~!@#
PE to access p and e

I don't understand. All these keys work as filter chars.

I accidentally hit the r key in my home directory

Please let me know how to reproduce it when you get the time. I tried the steps but didn't see any data loss.

Since this happened i have added F2 to rename

I think it's fine as a local copy. We had this key earlier but removed as it didn't apply for mobile keypads.

in filter mode hitting / while highlighting a directory navigates into the directory

I can't reproduce this. Are you on master?

i also added q to exit filter mode, Q lets you add a regular q to filter

These are different keys and should work as filter chars. There are definite ways to clear a filter: https://github.com/jarun/nnn/wiki/hacking-nnn#prompt-shortcuts

selecting a file and hitting y works as intended between contexts however if I launch a second (parallel) instance of nnn: hitting y will state empty selection. Am I doing something wrong?

Yes, selecting a bunch of files is a per-process activity. You can't distribute the job between 2 instances. When we say selection we mean a group of files selected together_ and not the selection process.

jarun commented

Lack of CONTROL('W") to delete a word in filterentries() or and xreadline().

Let's leave the filter prompt simple as it is without adding too much complexity. Most of the shortcuts do not work there: https://github.com/jarun/nnn/wiki/hacking-nnn#prompt-shortcuts

For xreadline(), if you are missing ^W at the command prompt, compile nnn with the readline library. The native one has several constraints (no history for example) and is for users who are OK to ignore those.

0xACE commented

Maybe I should've clarified, a lot of the things I mentioned are changes I have applied to my own version of nnn, I was hoping the first three would be adopted as I figured they'd be fair for more users, but the others are too much of a personal thing, I guess ill maintain my local copy myself. It is okay to skip down to the bold text as you basically covered the points I'm replying to.

Lack of CONTROL('W") to delete a word in filterentries() or and xreadline().

Please raise the PR and I'll take a look at it

Your next response states that you don't want it. I should mention though that the CTRL-W code version implemented is very similiar to how CTRL-L acts...

Lack of mouse scroll wheel support.

We have explored this earlier. Some version of ncurses support scrolling, some don't. We decided to leave it out of plan.

Fair enough.

I didn't like the substring matching

regex is the default and your the shazm mkv case can be handled with wildcards.

Yeah, the problem i find with regex is that it requires me to type .*mkv for the equivalent. I guess it just fits my personal workflow better. Not a big deal just mentioning my private patches to nnn. I'll just maintain it in my local copy.

I also added HJKL to not fill the text in filter mode, and just act as the regular hjkl keys in the normal mode

I don't understand what you mean. HJKL characters work in a filter.

Again this is a personal change, it allows me to use the keys HJKL to browse the objects in the menu without exiting out of the filter mode, the idea is that i dont like using the arrow keys, and hitting the escape key is a real drag for me... so i just hit /commonnameJJL and it will pick the 3rd entry.

Also did it for ~!@#
PE to access p and e

I don't understand. All these keys work as filter chars.

Again, another personal change. Allows me to access the shortcut keys to `!@- without exiting the filter mode. Though this is a very personal patch, so i dont expect anything form this.

I accidentally hit the r key in my home directory

Please let me know how to reproduce it when you get the time. I tried the steps but didn't see any data loss.

Yeah, sorry the weekend came around and kidnapped me... It will be hard for me to reproduce as the files which possibly were involved are the exact files that should be missing... Maybe i could find the time to reproduce this. Interestingly recently i found another problem with file names, a .mp4 which was opened differently by nnn I'm guessing the mp4 had a weird name, but I'll have to go back and see what actually happened... (iirc correctly the file started with a space and later had a ', like so: " it's broken.mp4" (Without the quotes)

Since this happened i have added F2 to rename

I think it's fine as a local copy. We had this key earlier but removed as it didn't apply for mobile keypads.

I see.

in filter mode hitting / while highlighting a directory navigates into the directory

I can't reproduce this. Are you on master?

I feel bad; this is a personal implementation. The idea is while you are in filtering mode you could hit / to browse into and remain in filter mode. E.g. hitting these key strokes: ~/down/movie/shaz/shaz mkv<ENTER> would go to the home directory and then enter filter mode, while in filtermode "down" would match "downloads" which is a folder in my pc, hitting / while a folder is selected in filter mode lets you browse into the directory and clear the filter and let you enter another search them, much like navigate-as-you-type but without having to trigger it with CONTROL('T'). This is very much a personal taste thing, the reasoning behind it is / will only be hit when i intend to go deeper into a directory, so I had the the filter utilize it for stepping into directories as a path will not have a /... I don't expect this to get adopted as its not a commonly understood user action...

i also added q to exit filter mode, Q lets you add a regular q to filter

These are different keys and should work as filter chars. There are definite ways to clear a filter: https://github.com/jarun/nnn/wiki/hacking-nnn#prompt-shortcuts

Yeah, i just added it to my local copy. Doubt anyone else would find use for it as it carries along with it a bunch of weird edge cases.

selecting a file and hitting y works as intended between contexts however if I launch a second (parallel) instance of nnn: hitting y will state empty selection. Am I doing something wrong?

Yes, selecting a bunch of files is a per-process activity. You can't distribute the job between 2 instances. When we say selection we mean a group of files selected together_ and not the selection process.

So i interpret this that selections do not pass between different standalone instances of nnn. Though from reading https://github.com/jarun/nnn/wiki/design-considerations

file paths copy-paste should work seamlessly between contexts and instances of nnn

I figured i could select which files i want to copy in one instance of nnn and in another instance just hit P to have them copied to the other instance.

The text above can be ignored as you have mostly addressed it.

Another thing I recall being annoying this weekend which happend frequently:

  1. cmyphone to mount and go into my phone and atleast browse to a subdirectory (sshfs doesnt remove the mount dir, only subdirectories). and while nnn is anywhere inside the sshfs mount and connection is lost to my phone, the ENTIRE nnn session shuts down as the directory i was in dissappeared.

I found this very annoying as sshfs tends to frequently disconnect in my experience, resulting in nnn completely closing and loosing all my progress. In my personal copy of nnn I have applied a patch where nnn jumps to the parent directories until it finds a existing path instead of quitting. I find this change much more convenient than having the program completely quit. I guess sshfs can be setup to not remove subdirs, but I'm not a fan of the program essentially crashing while it is easily solved.

Oh another annoying thing i found just now before i wrote this response is:

  1. Select a directory that contains files say: /home/ace/src/nnn
  2. fyexample.zip<ENTER> to create a zip of the selected directory
  3. F to see the contents of the zip, shows that it saved the absolute full path to the folder and its file.
  4. Hitting ^F on the zip has now created a sub directories with the full path, so in my case it created $PWD/home/ace/src/nnn while i just expected $PWD/nnn

When you select single files it seems to only save the relative path, and behave like expected.

jarun commented

Lack of mouse scroll wheel support.

I did some further digging and it seems you can use libgpm to handle mouse clicks and scrolling independently of ncurses. Please take a look into libgpm and see if you can have a working implementation. You can also look into mc code for reference. It uses GPM.

I figured i could select which files i want to copy in one instance of nnn and in another instance just hit P to have them copied to the other instance.

That's correct. But you cannot ^Y and select some files in one instance. Press ^Y in another instance to end selection.

I found this very annoying as sshfs tends to frequently disconnect in my experience

I can understand. Please raise the PR.

F to see the contents of the zip, shows that it saved the absolute full path to the folder and its file.

That's for a selection. The reason is you can select files across directories in nnn and so you can select two files having the same name from 2 different directories. Hence we use the absolute path for selection.

jarun commented

A note on sshfs disconnection - I see disconnection happening frequently if the display goes off quickly. So I set the mobile to turn off display in 20 minutes and I don't see this problem.

However, please raise the PR. It's the best solution we have in hand.

jarun commented

That's correct. But you cannot ^Y and select some files in one instance. Press ^Y in another instance to end selection.

I see this is broken in master. Need to fix.

jarun commented

Oh, wait:

I launch a second (parallel) instance of nnn: hitting y will state empty selection.

The selection is not shown but cp, mv, rm works with the selection. The selection is not shown because there is no selection in the second instance. For cp, mv, rm, the selection file is read.

jarun commented

The selection listing issue is fixed in commit 41fcbd9.

0xACE commented

Oh, wait:

I launch a second (parallel) instance of nnn: hitting y will state empty selection.

The selection is not shown but cp, mv, rm works with the selection. The selection is not shown because there is no selection in the second instance. For cp, mv, rm, the selection file is read.

I see, the y list is what kept me confused, I never actually tried cp, mv or rm. I just looked at y and figured the selection isn't inter-process based. Though I'm not really sure how it works if each client makes its own selection...

I found this very annoying as sshfs tends to frequently disconnect in my experience

I can understand. Please raise the PR.

I sent a patch for you to review. Since I don't know of a channel to contact you I spent time reading the code multiple times trying to make the right decision. I made multiple ways to apply this fix, but I figured you wouldn't be happy if i changed visit_parent() so that's why i presented the patch as is. So i applied the changed elsewhere while using visit_parent()

A note on sshfs disconnection - I see disconnection happening frequently if the display goes off quickly. So I set the mobile to turn off display in 20 minutes and I don't see this problem.

However, please raise the PR. It's the best solution we have in hand.

Yeah, in my case just calling termux-wakelock or w/e the command is, is enough, but still it will disconnect, sshfs tends to disconnect on other servers i use too, just used the phone as a example as it exacerbates the problem.

Lack of mouse scroll wheel support.

I did some further digging and it seems you can use libgpm to handle mouse clicks and scrolling independently of ncurses. Please take a look into libgpm and see if you can have a working implementation. You can also look into mc code for reference. It uses GPM.

I can't make any promises but at least having this information will help any potential developer.

If there is a irc channel you or any nnn dev frequents I wouldn't mind joining to keep in touch. So far I'm really happy with nnn and intend to use it as my main filemanager.

jarun commented

I sent a patch for you to review

Thanks a lot! I would take a look at the patch.

... will help any potential developer

That's kind of a remote possibility. Despite having numerous users, we don't have any consistent C developer other than me in years. ;)

However, I do have some good news for you. We needed the GPM library mostly for handheld convenience, specially Termux. I see that Termux uses ncurses 6.1 and has the following defined:

#define NCURSES_MOUSE_VERSION 2

So we can add the scroll capability for Termux-only and we should be fine with that. That should be simpler. Please take a look.

If there is a irc channel

I have sent you an invite to join as a collaborator to nnn.

0xACE commented

I sent a patch for you to review

Thanks a lot! I would take a look at the patch.

I sent it to you, I hope it should satisfy your needs :D.

... will help any potential developer

That's kind of a remote possibility. Despite having numerous users, we don't have any consistent C developer other than me in years. ;)

Haha, I have a feeling some of your users has C experience. I'm not sure why they don't contribute though.

However, I do have some good news for you. We needed the GPM library mostly for handheld convenience, specially Termux. I see that Termux uses ncurses 6.1 and has the following defined:

#define NCURSES_MOUSE_VERSION 2

So we can add the scroll capability for Termux-only and we should be fine with that. That should be simpler. Please take a look.

I see, I'll take a look at the problem, but can't make any more promises on that, the reason for this is because I'm busy. But since I use nnn daily chances are patches will be coming from me when things could be improved.

In termux I take it you want scrolling to scroll 1 item at a time per scroll?

On my pc I have set it to scroll half a screen... It's convenient when I'm not actually sitting at the computer and just using the mouse to quickly open files, I might add a "right click-menu" on my local copy just in case (it would basically call another script with a menu upon clicking a mouse button, it could potentially just be an alias for SEL_PLUGIN)

If there is a irc channel

I have sent you an invite to join as a collaborator to nnn.

Thank you, I happily accepted the invitation :D. I won't push things to master without your permission as I'm still getting familiar with the source code. I could create a branch and only apply changes you have permitted.

Alas the weekend has come to kidnap me again,
Cheers

jarun commented

In termux I take it you want scrolling to scroll 1 item at a time per scroll?

I am thinking of the same as SCROLLOFF (currently set to 3)

jarun commented

From 0xACE:

Please take a look at the scroll support with ncurses6. It would be a great value addition for our users on Termux. I am one of them! ;)

I am also a termux user, i addressed your comments from the phone and didn't push the changes until i reached a computer, termux is super nice when I'm on the run.

Regarding termux scroll support I would suggest a specific github issue so that the problem can be tracked from 1 place. As, i would also argue that in termux a "click" should be on the "highlighted" item rather then where the user clicks as it's hard to click on the exact row...

Yeah, frankly from termux I really wish they had this fixed sooner: termux/termux-api#233

My early guess is that it's just a matter of implementing the code, and not a very termux specific problem...

jarun commented

As, i would also argue that in termux a "click" should be on the "highlighted" item rather then where the user clicks as it's hard to click on the exact row...

For now, please leave it as it is. Changing the behaviour breaks the use case where the user actually wants to select another item.

jarun commented

Mouse scrolling support is in at commit 9b0cf4a. ๐Ÿ‘