nnn: CLIな高速ファイルマネージャ

多数の文書ファイルがある場合、ファイルマネージャーの使い勝手は作業効率を左右するキモである。nnnはコンソール上でviちっくに1キーコマンド操作する非常に使い勝手の良いファイルマネージャーだ。しかもコンパクトで高速。

  • hjklでカーソル移動、gでリスト頭、Gでリスト末、/で検索。
  • dで詳細表示、. でドットファイル表示、t でソート。
  • SPACEで選択し、p,vでコピーや移動、rで名前変更、xで削除。
  • bookmarkやcontext(タブ?)でディレクトリ間操作も便利。
  • Alt-p でプレビュー

2. Shortcut

2.1 NAVIGATION

Key Command Key Command
k Up PgUp ^U Scroll up
j Down PgDn ^D Scroll down
h Parent ~ ` @ - ~, /, start, prev
l Open ' First file/match
g Top . Toggle hidden
G End + Toggle auto-advance
b Bookmark key B , Bookmark CWD (, only current session)
1-4 Context 1-4 (S-)Tab Cycle/new context
Esc Send to FIFO ^L Redraw
Q Pick/err, quit ^G QuitCD
q Quit context 2Esc Quit
? Help, conf

2.2 FILTER & PROMPT

Key Command Key Command
/ Filter A-Esc Unfilter, quit context
Esc Exit prompt ^L Clear prompt/last filter
^N Toggle type-to-nav

2.3 FILES

Key Command Key Command
o Open with... n Create new/link
f File details d Detail mode toggle
^R Rename/dup r Batch rename
z Archive e Edit file
* Toggle exe > Export list
Space (Un)select m-m Mark range/clear sel
a Select all A Invert sel
p Copy sel here w Cp/mv sel as
v Move sel here E Edit sel
x Delete

2.4 MISC

Key Command Key Command
A-; Select plugin = Launch app
! Shell ] Cmd prompt
c Connect remote ENTER,^D Exit Cmd prompt
t Sort toggles u Unmount remote/archive
T Set time type s Manage session
0 Lock

3. プラグイン

プラグインを追加することで、機能が増える。 (プラグインの一覧

$ curl -Ls https://raw.githubusercontent.com/jarun/nnn/master/plugins/getplugs | sh

3.1 プレビュー機能の追加

追加方法は、こちらを参考にした。

  • Alt-pでpreview-tuiが動くように指定(tmux用)
$ export NNN_PLUG='p:preview-tui'
  • aオプションを付けて実行
$ nnn -a
  • Alt-p でプレビューのON/OFF

4. 他のコンソールファイルマネージャーとの比較

rangerも良さげだが n3 の方がコンパクト。

A. Links