From 856ba03563c239000574f652e9eed830fe98623f Mon Sep 17 00:00:00 2001 From: Mischievous Meerkat Date: Fri, 10 Apr 2020 17:03:25 +0530 Subject: [PATCH] Updated Power toys (markdown) --- Power-toys.md => Cool-stuff.md | 102 ++++++++++++++++----------------- 1 file changed, 51 insertions(+), 51 deletions(-) rename Power-toys.md => Cool-stuff.md (97%) diff --git a/Power-toys.md b/Cool-stuff.md similarity index 97% rename from Power-toys.md rename to Cool-stuff.md index 72770ee..eeb99dc 100644 --- a/Power-toys.md +++ b/Cool-stuff.md @@ -1,4 +1,54 @@ -### 1. Redirect selection to a command +### 1. Pin a frequently visited directory + +If you need to repeat a directory repeatedly, you can pin it during a session using the shortcut ,. When you have a pinned directory, pressing the bookmark key (b or \^/) will list `,` as the first key: + + bookmark keys: , w t m i d v n + +Press , after the bookmark key to visit the pinned directory. + +You can pin one directory at a time. + +### 2. Filter filtered entries + +Filtering is the `nnn` way to search files in a directory. Did you know it's possible to apply a new filter on already filtered results? + +- Go to a directory +- Press filter key (/) and type a filter +- Press Esc or Up or Down (the filter will disappear from the status bar) +- Press filter key again +- Type a new filter to find matches in the earlier filtered results + +### 3. Mount and modify archives + +`nnn` provides you an option to mount archives when you press Enter on an archive. Press m to mount the archive and `nnn` will mount the archive and take you to the mountpoint of the mounted archive. + +Add some files in the mounted archive, go back to the `nnn` config directory (`${XDG_CONFIG_HOME:-$HOME/.config}/nnn`) and hover on the archive mount point. Press u to unmount the archive and generate a package with the new files. The original package is saved with the extension `.orig`. + +### 4. Hovered file path in `$nnn` + +`nnn` exports the hovered file path as `$nnn` when you press the command prompt or spawn shell shortcuts. You can use the variable to run a command on the hovered file: + +```sh +ls -l "$nnn" +``` + +### 5. Preview and edit files + +You can easily edit and view the changes to Markdown, man pages etc. in `nnn`. For this you need to use a CLI file opener. You can use plugin [`nuke`](https://github.com/jarun/nnn/blob/master/plugins/nuke), a customizable example opener to specify your preferred apps. To set nuke as the default opener: + +```sh +export NNN_OPENER=/absolute/path/to/nuke +``` + +and start `nnn` as `nnn -c`. + +The option `-c` indicates to `nnn` that the opener is a CLI-only opener (note that `nuke` can open files in GUI apps as well; please read the documentation in the file). + +Now when you press Enter on a Markdown file `nuke` will try to open it in `glow` or a man page in `man`. + +To edit the file in `$VISUAL` (or `$EDITOR`, or `vi`), hover on the file and press e. + +### 6. Redirect selection to a command `nnn` allows users to select a file at a time, a range of files or all files in a directory together. Once you are done selecting, you can run a command on all the files by using the selection file as input: @@ -20,56 +70,6 @@ xargs -0 ls -l < $sel Many plugins work this way! -### 2. Pin a frequently visited directory - -If you need to repeat a directory repeatedly, you can pin it during a session using the shortcut ,. When you have a pinned directory, pressing the bookmark key (b or \^/) will list `,` as the first key: - - bookmark keys: , w t m i d v n - -Press , after the bookmark key to visit the pinned directory. - -You can pin one directory at a time. - -### 3. Filter filtered entries - -Filtering is the `nnn` way to search files in a directory. Did you know it's possible to apply a new filter on already filtered results? - -- Go to a directory -- Press filter key (/) and type a filter -- Press Esc or Up or Down (the filter will disappear from the status bar) -- Press filter key again -- Type a new filter to find matches in the earlier filtered results - -### 4. Mount and modify archives - -`nnn` provides you an option to mount archives when you press Enter on an archive. Press m to mount the archive and `nnn` will mount the archive and take you to the mountpoint of the mounted archive. - -Add some files in the mounted archive, go back to the `nnn` config directory (`${XDG_CONFIG_HOME:-$HOME/.config}/nnn`) and hover on the archive mount point. Press u to unmount the archive and generate a package with the new files. The original package is saved with the extension `.orig`. - -### 5. Hovered file path in `$nnn` - -`nnn` exports the hovered file path as `$nnn` when you press the command prompt or spawn shell shortcuts. You can use the variable to run a command on the hovered file: - -```sh -ls -l "$nnn" -``` - -### 6. Preview and edit files - -You can easily edit and view the changes to Markdown, man pages etc. in `nnn`. For this you need to use a CLI file opener. You can use plugin [`nuke`](https://github.com/jarun/nnn/blob/master/plugins/nuke), a customizable example opener to specify your preferred apps. To set nuke as the default opener: - -```sh -export NNN_OPENER=/absolute/path/to/nuke -``` - -and start `nnn` as `nnn -c`. - -The option `-c` indicates to `nnn` that the opener is a CLI-only opener (note that `nuke` can open files in GUI apps as well; please read the documentation in the file). - -Now when you press Enter on a Markdown file `nuke` will try to open it in `glow` or a man page in `man`. - -To edit the file in `$VISUAL` (or `$EDITOR`, or `vi`), hover on the file and press e. - ### 7. Prompt shortcuts Even if you compile `nnn` without libreadline, the native input prompts support several readline-like keys - \^A, \^B, \^D, \^E, \^F, \^K, \^U, \^W.