Commit graph

401 commits

Author SHA1 Message Date
Arun Prakash Jana 465d619b7f
Show cp file when NNN_NO_X is set 2018-04-25 23:25:40 +05:30
Arun Prakash Jana 6dc4176f57
Retire readinput() 2018-04-25 23:09:00 +05:30
Arun Prakash Jana 4fbb36b66b
Tidy up xreadline() 2018-04-25 22:46:21 +05:30
Arun Prakash Jana 18deea6383
Handle all ^ chars in main loop 2018-04-25 22:46:19 +05:30
Arun Prakash Jana 33cec52d4e
Reload contents on archive create, extract 2018-04-25 22:46:09 +05:30
Arun Prakash Jana c27f58555e
Support archive creation 2018-04-25 05:40:07 +05:30
Arun Prakash Jana 28f303699c
Use simpler descriptions 2018-04-24 08:55:14 +05:30
Arun Prakash Jana c6f9af931f
multi-cp: show number of cherrypicked files 2018-04-22 21:37:45 +05:30
Arun Prakash Jana ebb4725204
Two copy modes are exclusive 2018-04-17 02:22:23 +05:30
Arun Prakash Jana f652a4fecb
Fix calculation of remaining copybuf bytes
Start with PATH_MAX bytes and then double each time.
2018-04-14 20:40:07 +05:30
Arun Prakash Jana 511a1031b5
Suppress copier script trace 2018-04-14 14:47:34 +05:30
Arun Prakash Jana 8e4ebbed4c
Move volume capacity, free up 2018-04-14 10:21:39 +05:30
arcadius3d 46dd9f2c4d Added brackets for tcc compliance (#103) 2018-04-10 06:58:52 +05:30
Arun Prakash Jana 48cf378c7b
Prefer VISUAL, if defined over EDITOR 2018-04-08 06:15:24 +05:30
Jakub Jirutka a85ce3348f Show hidden files by default when env NNN_SHOW_HIDDEN is set (#100) 2018-04-04 06:33:26 +05:30
Arun Prakash Jana f09bd47f26
Update help 2018-04-01 23:39:51 +05:30
Arun Prakash Jana 1653414039
Add more phony targets 2018-04-01 22:51:55 +05:30
Arun Prakash Jana 12ffff243c
Show more useful info in help 2018-04-01 03:43:16 +05:30
Arun Prakash Jana 1ea41f2dd0
Show help on typing ? at empty filter prompt 2018-03-31 21:02:35 +05:30
Arun Prakash Jana 3a515585d1
Support screen locking on Linux 2018-03-30 21:23:28 +05:30
Arun Prakash Jana 1e1708c2ec
New shortcut ^] to spawn shell in current dir 2018-03-30 20:53:25 +05:30
Arun Prakash Jana bfb814bca6
Support ^A, ^E, ^U and ignore ^ chars at rename prompt 2018-03-28 08:08:02 +05:30
Arun Prakash Jana 0e623010e6
Switch to current dir to run editor/vidir 2018-03-19 06:18:25 +05:30
Arun Prakash Jana 8d7a56cbaa
Run a custom script support 2018-03-19 06:17:58 +05:30
Arun Prakash Jana 5624905803
Omit sorting if no matches/entries 2018-03-19 03:54:19 +05:30
Arun Prakash Jana dbf60734ba
Free regex 2018-03-19 03:42:56 +05:30
Arun Prakash Jana 298ce7639e
Retain nav-as-you-type mode after exiting spawned shell 2018-03-16 22:46:03 +05:30
Arun Prakash Jana 70c39a063d Fix #81: GUI programs shouldn't exit on closing the parent terminal
Issue reproduction steps:

1. Spawn a GUI program e.g. open a PDF file in zathura or evince.
2. Without quitting `nnn` close the terminal.
3. Notice that the application quits too.

Can be a nagging issue if someone is not using a drop-down terminal.

Fix: detach a GUI child and start it in a new session.

There are 2 aspects to this commit:

- It fixes #81: in cases where we do not wait for a spawned child we can assume
that the child is a GUI process. We detach and spawn the child in a new session.
- It changes the behaviour to @Rahi374's suggestion in PR #40 i.e. invoke the DE
opener in F_NOWAIT mode.
2018-03-16 04:39:49 +05:30
Arun Prakash Jana 460984c154
Replace all sprintf() with snprintf() 2018-03-09 02:32:22 +05:30
Arun Prakash Jana eddc0c93ba
Fix #95: Add ^I as an alternative to Insert 2018-03-07 18:32:48 +05:30
Arun Prakash Jana 91ef394dbd
Integer calculation-only coolsize() 2018-03-05 18:21:39 +05:30
Arun Prakash Jana 928699d4a4
float is suficient and a _little_ faster in coolsize() 2018-03-05 08:46:34 +05:30
Arun Prakash Jana 4d93a7f9fe Revert "Integer-only coolsize() (#84)"
This reverts commit 7be0726164.
2018-03-05 01:12:10 +05:30
Arun Prakash Jana 58d90bfcf6 Revert "fix rounding carry in coolsize() (#91)"
This reverts commit 7654a2e0c6.
2018-03-05 01:11:29 +05:30
Arun Prakash Jana 90e8b81c3e Revert "Fix compilation warning"
This reverts commit 30fdb6ff11.
2018-03-05 01:11:14 +05:30
Arun Prakash Jana 30fdb6ff11
Fix compilation warning 2018-03-05 00:57:31 +05:30
Alex Suykov 7654a2e0c6 fix rounding carry in coolsize() (#91)
Sizes like 1.999 get rounded to (1 + 100/100), which should be displayed
as 2.00 not 1.100 as simple %i.%02i would do without additional measures.
2018-03-05 00:48:10 +05:30
Arun Prakash Jana 3036b8a733
Fix #89: User-specific tmp file for copying filenames
Use distinct (by username) tmp filename to copy file paths.

The pattern used is:
/tmp/nnncp$USER

If username is 'arun', the file name is `/tmp/nnncparun`.
2018-03-04 10:37:18 +05:30
Arun Prakash Jana 43134cdfa8
Support ~, - and & keyboard shortcuts at the bookmark prompt.
In nav-as-you-type mode only control keys are understood when filter is enabled.
We need some way to quicly jump HOME, last visited dir or start dir.
2018-03-03 19:19:06 +05:30
Arun Prakash Jana 10e84a28ed
Both src and dst should be alignment checked separately
The following pattern passes the current check:

src  - 1010
dst  - 0101
mask - 1111
2018-03-03 01:08:15 +05:30
Alex Suykov 7be0726164 Integer-only coolsize() (#84) 2018-03-01 13:22:25 +05:30
Arun Prakash Jana 0f89943d95
Prepare for release v1.7 2018-02-28 01:54:42 +05:30
Arun Prakash Jana 11dac5e3db
Add shortcut ^G to quit and cd 2018-02-24 22:54:54 +05:30
Arun Prakash Jana 58e27fb2de
Use macros for external utils 2018-02-24 20:45:50 +05:30
Arun Prakash Jana ee733a39b1
Support batch file rename in vidir 2018-02-24 19:46:58 +05:30
Arun Prakash Jana a963d166c8
Enable file extract in nav-as-you-type mode 2018-02-24 10:43:06 +05:30
Arun Prakash Jana b22d8c32f9
Support file path copy when X is unavailable 2018-02-24 07:49:59 +05:30
Arun Prakash Jana 035bcdb198
Re-populate after spawning shell 2018-02-15 19:21:58 +05:30
Arun Prakash Jana af35b8a27c
Start dir watch, preserve cur entry when navigate-as-you-type is disabled 2018-02-13 13:28:18 +05:30
Arun Prakash Jana 19e5990d3a
Better message for multi-copy 2018-02-04 22:54:58 +05:30
Arun Prakash Jana 991ef57340
Do not show quotes on ^K 2018-01-29 20:49:38 +05:30
Arun Prakash Jana 1d067df0b5
Show copymode on/off 2018-01-28 12:44:29 +05:30
Arun Prakash Jana 1f87bb3bcb
Interpret ^T in filter mode 2018-01-28 12:23:23 +05:30
Arun Prakash Jana d48e91f011
Support file path quote on single copy 2018-01-28 12:04:56 +05:30
Arun Prakash Jana 6da9d5f499 Support file path quote on copy 2018-01-28 11:34:18 +05:30
Arun Prakash Jana e797a7eefd
Use macro for CRC8 table length 2018-01-19 20:39:23 +05:30
Arun Prakash Jana 98c79a69b5
Redraw if no entries when navigate-as-you-type is turned off
The main reason to do this is to start watching the current dir for changes. In
any case, this does not harm; if there are dir entries shown on redraw that's
better than showing nothing.
2018-01-17 20:22:07 +05:30
Arun Prakash Jana cbfeec5625
keybind to pin current dir - b 2018-01-17 19:32:22 +05:30
Arun Prakash Jana e359f60294
Set to last selection if filter is empty 2018-01-14 14:05:19 +05:30
Arun Prakash Jana bac199d0cf
Use consistent date format 2018-01-14 12:43:20 +05:30
Arun Prakash Jana 9f4199481a
Improve common message handling 2018-01-14 12:11:46 +05:30
Arun Prakash Jana 9bcca1a45c
Use concise and lowercase messages 2018-01-14 10:20:41 +05:30
Arun Prakash Jana e6580c38bf
Replace snprintf() with xstrlcpy() 2018-01-14 03:27:24 +05:30
Arun Prakash Jana a40d29ba9f
Support multiple file path copy
Design overview:

We are introducing multiple file path copy as a mode which can be toggled using
the keybind `^Y`. `^K` works as the individual entry selector. If the user wants
to select a range, (s)he can press `^Y` on the first entry and `^Y` on the last
entry.

We subscribe to notifications, so we need a fail-proof way to detect changes in
the directory contents. For example, if a file is deleted, it becomes difficult
to get the names of all the files in a range containing that file. If the file
is on a range boundary it would lead to wrong calculations. To handle this the
right way we use CRC8 checksum of all the visible entries in the directory. The
checksum is calculated based on the file information buffer. If the CRC changes
on a redraw(), we reset the multi-select mode.

New line (`\n`) works as the delimiter between file paths. Note that you may have
to disable IFS in the `NNN_COPIER` script to show file paths separated by spaces.
2018-01-14 01:43:30 +05:30
Arun Prakash Jana 4800250814
Key changes: ^F - extract archive, ^X - quit 2018-01-13 09:28:29 +05:30
Arun Prakash Jana 34b650aac8
Remap ^S and ^Q.
The replacement keys are:

^J - toggle du mode
^Y - quit

The change is done because ^S, ^Q keybinds are lost in the following case:
- start nnn
- navigate to a different directory
- spawn a shell
- exit the shell

The issue happens only with the 'special' keybinds like ^S, ^Q, ^Z... which get
their original shell interpretation back.

So we are replacing these 2 keybinds with 2 'non-special' combinations.
2018-01-09 14:21:09 +05:30
Arun Prakash Jana 827f7fd662
Sufficient to use refresh() after exitcurses() 2018-01-09 13:32:57 +05:30
Arun Prakash Jana 0a1776e18e
Add shortcut ^S to toggle du mode 2018-01-09 00:31:15 +05:30
Arun Prakash Jana f6fd15e088
Explicitly optimize modulo ops 2018-01-09 00:13:11 +05:30
Arun Prakash Jana 77fec499cb
Open with GUI app - Suppress stdout, stderr 2018-01-08 03:27:41 +05:30
Arun Prakash Jana 9cded0be0e
Simplify detail printing 2018-01-07 20:08:59 +05:30
Arun Prakash Jana afb6a7ab04
Change bookmark prompt and pin dir keys.
New keys:

- bookmark prompt (^B)
- pin directory (B)

The intention of the change is to facilitate opening the bookmark prompt in
navigate-as-you-type mode. The bookmark prompt is used more than the pin
current directory option.
2018-01-07 09:14:25 +05:30
Arun Prakash Jana f7c5a2924d
Highest priority to desktop search, rename 2018-01-07 03:27:09 +05:30
Arun Prakash Jana 2e7722976b
Enable extra shortcuts in navigate-as-you-type mode
Enabled functionality:

- Copy file path (^K)
- Run desktop search utility (^/)
- Rename file (^R)
- Open with... (^O)
- Pin current directory (^B)
- Visit pinned directory (^V)
- Extract archive (^X)
2018-01-06 11:58:01 +05:30
Arun Prakash Jana 542fd2f6e8
Swap weekday and month 2018-01-06 10:01:54 +05:30
Arun Prakash Jana d69365ff3e
Use a date format string 2018-01-06 03:59:36 +05:30
Arun Prakash Jana 5876c61f4c
Rearrange date format in file details 2018-01-06 03:56:09 +05:30
codeliveroil 915df53a04 Use standard date formats. (#74)
- For standard view, use ISO 8601 date format.
- For detailed view (i.e. stat), use default Linux date
  format. Also, remove GMT offset to avoid confusion in
  determining source of offset when reading alongside
  the local time zone.
2018-01-06 03:49:27 +05:30
Arun Prakash Jana fd11b53b4e
Show target for symlinks 2018-01-06 03:46:44 +05:30
Arun Prakash Jana 00533546d4
The *alloc() family is aligned 2018-01-04 17:46:06 +05:30
Arun Prakash Jana 242e22eb2d
Wrap realloc() to return aligned address 2018-01-04 06:23:20 +05:30
Arun Prakash Jana da7e30cd6f
Use aligned large buffers 2017-12-30 13:54:49 +05:30
Arun Prakash Jana 3a88e31a0e
Check alignment and enable -O3 2017-12-29 11:08:07 +05:30
Arun Prakash Jana 9b010b1c03 Fix checkpatch reports 2017-12-28 01:48:12 +05:30
Daniel Lockyer 77b0fe0104 Free allocated resources using regfree (#71) 2017-12-27 16:06:57 +05:30
Arun Prakash Jana 26e739a6d9
Use ffs() tweak. 2017-12-27 09:53:11 +05:30
Arun Prakash Jana ff1c467285
Explicitly cast opaque types 2017-12-27 00:49:43 +05:30
Arun Prakash Jana f1f2a53dbf TAB is not identified on OS X 2017-12-27 00:16:56 +05:30
Dmitri Goutnik 4dca8d7cf9 Lookup xdg-open in PATH on non-Apple platforms (#70) 2017-12-26 23:53:20 +05:30
Arun Prakash Jana 9bfc2fdc29
Use ffs() instead of ffsl() 2017-12-26 23:33:32 +05:30
Dmitri Goutnik c5f19ddd92 Fix compiler warnings on FreeBSD 11.x (#69) 2017-12-26 21:22:45 +05:30
Arun Prakash Jana 9b72fcba03
Replace getorder() by ffsl() 2017-12-25 23:27:37 +05:30
Arun Prakash Jana cd177086ca
OpenSUSE gcc fails at '-fno-tree-loop-vectorize' 2017-12-25 19:10:20 +05:30
Arun Prakash Jana f687463574
Prepare for release v1.6 2017-12-25 17:13:25 +05:30
Arun Prakash Jana 7f804ca8f2
Support 'Open with...' 2017-12-25 15:55:53 +05:30
Arun Prakash Jana f7399b05f9
Optimize xmemrchr() 2017-12-25 01:44:48 +05:30
Arun Prakash Jana 436d2143fd
Reduce sprintf() family usage 2017-12-25 00:28:12 +05:30
Arun Prakash Jana c0255db4f1
Optimize saving, matching old entry 2017-12-24 23:23:52 +05:30
Arun Prakash Jana 78f544c41d
Shorten error messages 2017-12-24 21:22:54 +05:30
Arun Prakash Jana f2387898f3
Limit filter length to NAME_MAX from LINE_MAX 2017-12-24 21:20:36 +05:30