Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ToDo list and discussion #1454

Closed
1 task done
jarun opened this issue Aug 5, 2022 · 71 comments
Closed
1 task done

ToDo list and discussion #1454

jarun opened this issue Aug 5, 2022 · 71 comments
Labels

Comments

@jarun
Copy link
Owner

jarun commented Aug 5, 2022

Rolled from #1416.

Cooking

  • add correct check for Wayland in clipboard plugins

Up for grabs

None open at the time.

For anything else please discuss in this thread.

Contribution guideline.

@jarun jarun added the planning label Aug 5, 2022
@rieje
Copy link

rieje commented Aug 5, 2022

I'm not able to clear selection with printf "%s" "-l" > "$NNN_PIPE", am I missing something? Full script run using NNN_PLUG='p:!&nnn-mpv-playlist'. It just runs mpv with a playlist of selected items, but doesn't clear selection.

@jarun
Copy link
Owner Author

jarun commented Aug 6, 2022

I am unable to reproduce the issue with the same script. Selection is cleared. Files also play is sequence as they should.

  • Please confirm you are on the latest.
  • Why pass l? It is to list. That's not your use case,

@rieje
Copy link

rieje commented Aug 6, 2022

I am unable to reproduce the issue with the same script. Selection is cleared. Files also play is sequence as they should.

* Please confirm you are on the latest.

* Why pass `l`? It is to list. That's not your use case,

Just tried both latest stable and master. To be explicit, I am now using printf "%s" "-l" > "$NNN_PIPE in the script" and run the command: NNN_SEL="/tmp/.nnn-selection" NNN_PLUG='p:!&nnn-mpv-playlist' /usr/bin/nnn ~/downloads.

Then I press spacebar on some files hovered over, hit ;p and mpv plays, but selected files are not cleared even after exiting mpv (files are still selected as indicated by the plus symbol and the contents of $NNN_SEL as well as Ctrl-l to redraw. I am on zsh shell but ran on bash shell as well.

@jarun
Copy link
Owner Author

jarun commented Aug 6, 2022

! is to run external commands. External commands which page (|)/execute a gui application (&) cannot clear nnn selections.
I will document that explicitly.

BTW, please do not use the ToDo list for problem resolution. Raise a defect.

@jarun
Copy link
Owner Author

jarun commented Aug 6, 2022

This is a nice plugin idea. I am considering adding it to the plugin list if i can tweak it to my liking. ;)

@vaygr
Copy link
Contributor

vaygr commented Aug 7, 2022

I'm wondering if undo function was considered before.

E.g. you moved a file from one place to another, and undo key would just revert that. Maybe keep history for the last 10 changes (or make it configurable).

@jarun
Copy link
Owner Author

jarun commented Aug 7, 2022

The files modified within the last 5 mins are timestamp-highlighted. So sort by time, select them and move back. Can't waste 40K because of someone's indecision.

Also, we support bulk movements. No point remembering 10/20.

@vaygr
Copy link
Contributor

vaygr commented Aug 7, 2022

Move is just one example, there could be many in what nnn does: rename, delete, batch rename, copy, etc.

@jarun
Copy link
Owner Author

jarun commented Aug 7, 2022

That's user history. nnn doesn't track. As soon as such features are added, novices would ask for a way to see the list also.

We are not writing a toy app here.

@N-R-K
Copy link
Collaborator

N-R-K commented Aug 7, 2022

Move is just one example, there could be many in what nnn does: rename, delete, batch rename, copy, etc.

I don't think this is feasible:

  1. How can we "undo" a rm operation when user isn't using $NNN_TRASH?
  2. Plugins are allowed to perform any arbitrary actions. How will we even keep track of it, let alone "undo"-ing it?
  3. Things might change externally which can completely invalidate the "undo buffer". E.g nnn renames file_A -> file_B and then the user renames it again from file_B -> file_C from another terminal.

And these are just some of the things which comes to mind, I'm sure there's plenty of other issues lurking in the shadows.

@severinbratus
Copy link

Configurable macros?

@0xACE
Copy link
Collaborator

0xACE commented Aug 11, 2022

Configurable macros?

Scripts?

@latipun7
Copy link

Able to use custom merge tool when using getplugs, for example, lvim instead of nvim

@greenfoo
Copy link
Contributor

Hi, it just took me an embarrasingly long amount of time to figure out how to use sshfs to mount a specific remote folder.
Maybe it would be useful to others to update the wiki adding some extra details : )

diff --git a/Basic-use-cases.md b/Basic-use-cases.md
index 51315d0..b167b44 100644
--- a/Basic-use-cases.md
+++ b/Basic-use-cases.md
@@ -269,7 +269,9 @@ mocp -a $(nnn -p -)
 
 ## Remote mounts
 
-`nnn` integrates with SSHFS and rclone to support remote mounts. The mount points (for remotes as well as archives) are created within:
+In order to mount a remote folder, press `c` and `nnn` will ask you whether you want the mount point to be created using `sshfs` or `rclone`.
+
+The mount points (for remotes as well as archives) are created within:
 
     ${XDG_CONFIG_HOME:-$HOME/.config}/nnn/mounts
 
@@ -279,7 +281,7 @@ Upon successful unmount, the mount points are removed.
 
 Example primary setup: [connect to SSH sever from desktop](https://gist.github.com/jarun/660fd1d5e79e1a4038de8ba5f2e1a513).
 
-To connect to and mount remote shares using SSHFS, `nnn` requires the ssh configuration file `~/.ssh/config` to have the host entries. sshfs reads this file.
+To connect to and mount remote shares using `sshfs`, `nnn` requires the ssh configuration file `~/.ssh/config` to have the host entries. `sshfs` reads this file.
 
 Example host entry for a Termux environment on Android device:
 
@@ -297,6 +299,13 @@ Host phone
     # ProxyJump jumphost
 ```
 
+Once you press `c` and select sshfs, `nnn` will ask you for the name of the host (`phone` in the example above). You must then type the exact name (as it appears in this file) optionally followed by the path in the remote host you want to mount. Examples:
+
+```
+phone         <----- Mount your remote user's $HOME folder in `phone`
+phone:/tmp    <----- Mount the remote `tmp` folder in `phone`
+```
+
 Host `phone` will be mounted at `${XDG_CONFIG_HOME:-$HOME/.config}/nnn/mounts/phone`.
 
 If you need to pass options to the `sshfs` command, you can do so:
@@ -311,7 +320,7 @@ Options must be preceded by `sshfs` and comma-separated without any space betwee
 
 The remote needs to be [configured and authenticated](https://rclone.org/docs/) beforehand (one-time activity). The name used to configure is all `nnn` needs to connect and mount (as well as unmount) the remote service locally.
 
-Like SSHFS, if you need to pass options, use the dedicated environment variable:
+Like `sshfs`, if you need to pass options, use the dedicated environment variable:
 
 ```sh
 export NNN_RCLONE='rclone mount --read-only --no-checksum'
@@ -385,4 +394,4 @@ Further [reading](https://unix.stackexchange.com/questions/288333/how-can-i-make
 
 ## Disable bold fonts
 
-Most modern terminal emulators have the option to disable bold fonts.
\ No newline at end of file
+Most modern terminal emulators have the option to disable bold fonts.

@jarun
Copy link
Owner Author

jarun commented Aug 15, 2022

@N-R-K or @luukvbaal can you please have a look and update the wiki if necessary?

@jarun
Copy link
Owner Author

jarun commented Aug 16, 2022

@greenfoo I have updated the documentation to simplify it for new users.

@amalgame21
Copy link
Contributor

Any plan to add a feature to temporarily remembering previous hovered path in the same nnn context/instance/session?
This is default feature in ranger.

For example
When a file with path ~/A/B/C/D/E.txt is hovered.
Pressing h 4 times, it goes back to the directory with path ~/A,
And then press l 4 times, it goes right back to ~/A/B/C/D/E.txt

And maybe later I navigate to other file, say ~/D/C/B/A.txt, in the same nnn context/instance/session
Then I somehow navigate back to hover ~/A
With the same context/instance/session, pressing l 4 times now, it also go right back to ~/A/B/C/D/E.txt
It still remember the path.

And maybe later I navigate to other file, say ~/A/A/A/A/A.txt
Pressing h 4 times go to ~/A
And press l 4 times will go back to ~/A/A/A/A/A.txt, but not ~/A/B/C/D/E.txt
But when ~/A/B is hovered later, pressing l 3 times will go to ~/A/B/C/D/E.txt

That means ~/A/A/A/A/A.txt and ~/A/B/C/D/E.txt are both rememberd in the same instance
but because ~/A/A/A/A/A.txt is the latest
pressing l 1 time when ~/A is hovered will jump to ~/A/A, not ~/A/B

Maybe handy for quick navigate back and forth the parent and child folders when there are a lot of directories.
Or when the name of directories are not in English, switching input method and search everytime is painful.

Just a little suggestion, not essential.
Maybe nnn was not designed to use in this way.
Now I just open a new context with tab and go back to parent directories there, to temporary remember the current path in the first context.

@jarun
Copy link
Owner Author

jarun commented Aug 18, 2022

Sorry, no plans.

@G2G2G2G
Copy link

G2G2G2G commented Sep 7, 2022

any plans for moving copy to a different thread/process/background so it doesn't lock entire program for massive copies?

@jarun
Copy link
Owner Author

jarun commented Sep 11, 2022

No. Open a new instance of nnn in a new tab.

@G2G2G2G
Copy link

G2G2G2G commented Sep 12, 2022

yes I know how to do basic tasks thanks

@amalgame21
Copy link
Contributor

Any plan to implement "persistent" tag to visually mark certain items?
Something like + symbol in nnn selection, but persistent and only visually mark certain items and have no special function.

Something like this:
https://github.com/ranger/ranger/wiki/Official-User-Guide#tags

Tags are persistent and will be there until you remove them manually. It may be used for example for marking ebooks you've read or files that need some action.

Thank you!

@jarun
Copy link
Owner Author

jarun commented Sep 22, 2022

Sorry, no plans to add any kind of tracking in nnn.

@sm1999
Copy link

sm1999 commented Sep 29, 2022

Hi, Is there a way to ungroup directories? When sorting directories are always grouped together at top. I want to sort directories and files by modification time but couldn't find a way.

@jarun
Copy link
Owner Author

jarun commented Sep 29, 2022

@sm1999 no there's no way to do that. It's a simple patch in the code though.

@averms
Copy link

averms commented Nov 5, 2022

A workaround for #1476 and #1407 is to create the container with --init, which adds a simple init inside the container that forwards signals and reaps processes. Then the shell inside the container will have PID 2.

Maybe we can add this to the troubleshooting section of the Wiki?

@N-R-K
Copy link
Collaborator

N-R-K commented Nov 5, 2022

Maybe we can add this to the troubleshooting section of the Wiki?

Done. https://github.com/jarun/nnn/wiki/Troubleshooting#running-inside-docker-containers

@rieje
Copy link

rieje commented Nov 13, 2022

When opening files with l, the relative path gets passed to the application opening it, right? Is it possible full path gets passed? For example, for mpv, I have a key bound in mpv that launches a script that depends on the absolute path of the file passed as command line argument. I can use a plugin to take the marked files as absolute paths, but it's not as convenient as the default way to open files and I think absolute path of files give user more control in these type of situations.

@N-R-K
Copy link
Collaborator

N-R-K commented Nov 14, 2022

I have a key bound in mpv that launches a script that depends on the absolute path of the file passed as command line argument.

Why not tune your mpv script to expand the argument path using realpath or readlink ?

@stellarhoof
Copy link

stellarhoof commented Nov 26, 2022

Why limit to 20? This is a sample of all the extensions you support. As you can see, many extensions have bad contrast against a light background (there's more but I could only capture so many in the image).

Image image

Alternatively, instead of supporting per-extension color overrides, we could support only overriding this table.

I personally don't care which colors the icons are displayed in, as long as the are visible.

@jarun
Copy link
Owner Author

jarun commented Nov 26, 2022

As you can see, many extensions have bad contrast against a light background

Well, not too excited by many.

@N-R-K
Copy link
Collaborator

N-R-K commented Nov 26, 2022

Hmm looking a bit more into the way colors are handled, looks it's not going to be as simple as overriding the color on the hash-table. There's some curses code involved here which I'm not familiar with.

Not sure when I'll get the time to take a crack it this. Feel free to give it a try and open a PR if you're up for it @stellarhoof.

@jarun
Copy link
Owner Author

jarun commented Nov 26, 2022

There's some curses code involved here

Which code are you referring to?

@N-R-K
Copy link
Collaborator

N-R-K commented Nov 26, 2022

As you can see, many extensions have bad contrast against a light background (there's more but I could only capture so many in the image).

Also, here's a simpler idea - let's just have a "light mode" that can be turned on at compile time.

diff --git a/Makefile b/Makefile
index 1393d3ac..03638888 100644
--- a/Makefile
+++ b/Makefile
@@ -29,6 +29,7 @@ O_NOUG := 0  # disable user, group name in status bar
 O_NOX11 := 0  # disable X11 integration
 O_MATCHFLTR := 0  # allow filters without matches
 O_NOSORT := 0  # disable sorting entries on dir load
+O_LIGHT  := 0  # enable light mode icon colors
 
 # User patches
 O_COLEMAK := 0 # change key bindings to colemak compatible layout
@@ -137,6 +138,10 @@ ifeq ($(strip $(O_NOSORT)),1)
 	CPPFLAGS += -DNOSORT
 endif
 
+ifeq ($(strip $(O_LIGHT)),1)
+	CPPFLAGS += -DICONS_LIGHT_MODE
+endif
+
 ifeq ($(shell $(PKG_CONFIG) ncursesw && echo 1),1)
 	CFLAGS_CURSES ?= $(shell $(PKG_CONFIG) --cflags ncursesw)
 	LDLIBS_CURSES ?= $(shell $(PKG_CONFIG) --libs   ncursesw)
diff --git a/src/icons.h b/src/icons.h
index 5cefe4d3..9a4b7067 100644
--- a/src/icons.h
+++ b/src/icons.h
@@ -133,6 +133,10 @@
  * Spectrum sorted: https://upload.wikimedia.org/wikipedia/commons/1/15/Xterm_256color_chart.svg
  * Color names: https://www.ditig.com/256-colors-cheat-sheet
  */
+#ifdef ICONS_LIGHT_MODE
+#define COLOR_LIST \
+	/* insert the light mode colors here */
+#else
 #define COLOR_LIST \
 	COLOR_X(COLOR_VIDEO,         45)  /* Turquoise2 */ \
 	COLOR_X(COLOR_VIDEO1,       226)  /* Yellow1 */ \
@@ -155,6 +159,7 @@
 	COLOR_X(COLOR_SHELL,         47)  /* SpringGreen2 */ \
 	COLOR_X(COLOR_VIM,           28)  /* Green4 */ \
 	COLOR_X(COLOR_ELIXIR,       104)  /* MediumPurple */ \
+#endif
 
 /* X-Macro: https://en.wikipedia.org/wiki/X_Macro */
 #define COLOR_X(N, V) N = (V),

@stellarhoof Should be easy for you to pick some colors that look fine against a light background and open a PR.

@N-R-K
Copy link
Collaborator

N-R-K commented Nov 26, 2022

There's some curses code involved here

Which code are you referring to?

Some sort of init color thing going on here:

nnn/src/nnn.c

Lines 2167 to 2172 in 92a0158

#ifdef ICONS_ENABLED
if (!g_state.oldcolor) {
for (uint_t i = 0; i < ELEMENTS(init_colors); ++i)
init_pair(C_UND + 1 + init_colors[i], init_colors[i], -1);
}
#endif

@jarun
Copy link
Owner Author

jarun commented Nov 26, 2022

Those are some default colours for pre-mapped types like directories, ruby files etc.

Add your code to update the table immediately after that for loop and see.

@jarun
Copy link
Owner Author

jarun commented Nov 26, 2022

The COLOR_LIST in icons.h has the complete list of all the colors we use. And we are limited by 256 colors.

In curses, to use a color, we need to call init_pair(). So we use the color_value as the index (first param) for easy lookup.
For all the colors passed, you can just call init_pair(C_UND + 1 + color_value, color_value, -1).

@jarun
Copy link
Owner Author

jarun commented Nov 26, 2022

let's just have a "light mode" that can be turned on at compile time.

@N-R-K I'm fine with that.

@stellarhoof can suggest the colors.

@stellarhoof
Copy link

stellarhoof commented Nov 26, 2022

Having a light mode is too subjective. I can't guarantee the colors I pick will play nice with whatever background other users have set in their terminals. There might also be users with color impairments etc... What about allowing users to override COLOR_LIST? It currently has only 20 items.

@0xACE
Copy link
Collaborator

0xACE commented Nov 26, 2022

Having a light mode is too subjective.

It is true that it is subjective. It's a matter of balancing the costs of pros and cons. Using a light vs dark setup allows for a peace of mind in the simplicity of setting up the environment.

I can't guarantee the colors I pick will play nice with whatever background other users have set in their terminals.

It will never work perfectly unless anyone specifically crafts a solution for their specific environment. I would argue it is about creating a general "good enough" case.

My recommendation would be try to copy the colours of things from Microsoft Windows Explorer, back in the day they had decent contrast to help describe differences.

There might also be users with color impairments etc...

There are so many different types of visual impairments that it would be better to specifically compile a solution for each condition.

infact I would argue our current default blue is a poor choice if we presume the majority of the users use dark background.

@stellarhoof
Copy link

It is true that it is subjective. It's a matter of balancing the costs of pros and cons. Using a light vs dark setup allows for a peace of mind in the simplicity of setting up the environment.

It will never work perfectly unless anyone specifically crafts a solution for their specific environment. I would argue it is about creating a general "good enough" case.

If reducing user customization in the name of simplicity is the goal then I believe the best choice is to limit the colors used by nnn to the 0-16 range, as those are controlled by the user. This will also saves us from having to define dark/light defaults since presumably the user has chosen colors with good contrast for their terminal background.

@0xACE
Copy link
Collaborator

0xACE commented Nov 27, 2022

If reducing user customization in the name of simplicity is the goal then I believe the best choice is to limit the colors used by nnn to the 0-16 range, as those are controlled by the user.

Isn't this the -C 8-bit color scheme we have in place?

This will also saves us from having to define dark/light defaults since presumably the user has chosen colors with good contrast for their terminal background.

No, you would still need to know if the user has a light or dark background. Light and dark do not work with the same colors and it has to do with grayscale. And to be frank, segmenting themes to light and dark makes sense to me:

People say color space (observe the word space, meaning 3D) not color plane (2D), if you look at color having a 3rd dimension it will make more sense

cap

Where the height is the brightness (grayscale), this graph will showcase which colors goes well with dark and light backgrounds. Which is why i complain about our default blue (same argument for red and dark green).

In short luminance carries great importance

@stellarhoof
Copy link

stellarhoof commented Nov 27, 2022

Isn't this the -C 8-bit color scheme we have in place?

The -C flag removes file icons altogether

No, you would still need to know if the user has a light or dark background. Light and dark do not work with the same colors and it has to do with grayscale. And to be frank, segmenting themes to light and dark makes sense to me:

I agree light and dark do not work with the same colors, I'm not proposing we use the same saturation/luminance (hue can be the same) for both dark and light, I'm just proposing leaving it up to the user. Take the red/green/blue you think should be changed. They look fine on my terminal because I've made sure of it:

image

Notice how the icons are also fine except for cases where they are explicitly overridden by nnn to be a different color

image

So to summarize, I see three different approaches to letting the user control and see what they want (which has always been my goal)

  1. Introduce a NNN_ICOLOR variable that overrides COLORS_LIST here
  2. Restrict COLORS_LIST to the 0-8 range
  3. Remove icon coloring altogether and use the same color as the file

Barring any of those solutions I will be left to patch the source code, which I've been trying to avoid

@jarun
Copy link
Owner Author

jarun commented Nov 27, 2022

Barring any of those solutions I will be left to patch the source code, which I've been trying to avoid

We have provided multiple options, you can raise a PR. We really don't have the bandwidth to spend on long discussions on icons and colors. You are welcome to come up with a sensible colorset of light themes. Yes, it will be a compile-time thing but that seems the best option for now.

@ghost
Copy link

ghost commented Dec 1, 2022

A ---update-plugin switch that installs/update the "default" plugins

@ghost
Copy link

ghost commented Dec 1, 2022

Pasting into the same file should work to duplicate it as well

@ahloiscreamo
Copy link

Hello, the theme currently not working on fish shell, because fish did not follow posix compliant, the provided theme just output error if one set it in fish config.

@jarun
Copy link
Owner Author

jarun commented Dec 2, 2022

@875d

A ---update-plugin switch that installs/update the "default" plugins

there is no automated way. Only https://github.com/jarun/nnn/tree/master/plugins#installation

Pasting into the same file should work to duplicate it as well

nnn supports it this way: https://github.com/jarun/nnn/wiki/Basic-use-cases#duplicate-file
Internally call cp to copy/paste so can't do much for bulk file copies.

@ahloiscreamo

Hello, the theme currently not working on fish shell, because fish did not follow posix compliant, the provided theme just output error if one set it in fish config.

What theme?

@ghost
Copy link

ghost commented Dec 2, 2022

there is no automated way. Only https://github.com/jarun/nnn/tree/master/plugins#installation

That's why I put it in the wishlist

@jarun
Copy link
Owner Author

jarun commented Dec 2, 2022

The ask is to download a file and execute it. nnn doesn't do any direct network access by itself today. I would prefer to keep it that way. The documentation is clear what to do. The project is years old and users know plugins are a strength. They will read the document on how to install those.

In addition, the release package has the plugins. Package maintainers can have it them installed/updated as well.

@ahloiscreamo
Copy link

@jarun the theme provided in the wiki

@jarun
Copy link
Owner Author

jarun commented Dec 2, 2022

@ahloiscreamo if you are using fish shell, you should know how to convert the widely used sh/bash syntax to fish. It's not our responsibility to convert to every other script in the world and present it in a plate to users who don't know what they are using but use them because they sound fancy/adventurous.

@ahloiscreamo
Copy link

I see, i can do that, just for convenience purposes for other users.

@jarun
Copy link
Owner Author

jarun commented Dec 2, 2022

It takes years to build a tool like this. We no longer have the bandwidth to provide basic support.

@ahloiscreamo
Copy link

i understand, i appreciate the great work. thanks.

@jarun
Copy link
Owner Author

jarun commented Dec 2, 2022

I appreciate you took it on a positive note. Not too many people do that. Thank you!

@jarun jarun mentioned this issue Dec 3, 2022
5 tasks
@jarun jarun closed this as completed Dec 3, 2022
Repository owner locked and limited conversation to collaborators Dec 3, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests