Vifm
関連記事
Vifm のホームページより:
- Vifm は ncurses ベースのファイルマネージャで、vi のようなキーバインディング/モード/オプション/コマンド/設定を備えています。また、mutt からもアイデアを頂戴しています。vi を使っているのであれば、Vifm では新しいコマンドセットを覚えなくても完全にファイルをキーボードで制御できるでしょう。
目次
インストール
任意で、ファイルのプレビューを使いたい場合は以下もインストールしてください:
ヘルプファイル
vifm の基本的な情報はヘルプファイルに書かれています。vifm を開いて次を入力することでヘルプファイルを見ることができます:
:h
他の情報は man ページを見てください。
Vifm のカスタマイズ
Vifm creates and populates a .vifm folder in your home directory containing the following:
- vifmrc - a well commented configuration file that can be edited to suit your working style.
- vifm-help.txt - the help text
- vifminfo - bookmarks and trash contents - it is not recommended to edit this file by hand
- Trash/ directory - self explanatory
- colors/ directory - color schemes
- Default - well commented default color scheme - can be copied to create user-created color schemes
To get started, read the information avaliable in:
/usr/share/vifm/vifm.txt
/usr/share/vifm/vifm-help.txt
カラースキーム
The ~/.vifm/colors
directory contains the color schemes. The format is outlined in the file and follows vi/vim syntax highlight format. It is basically:
highlight group cterm=attribute ctermfg=color ctermbg=color
An example colorscheme looks like:
highlight Win cterm=none ctermfg=white ctermbg=black highlight Directory cterm=bold ctermfg=cyan ctermbg=none highlight Link cterm=bold ctermfg=yellow ctermbg=none highlight BrokenLink cterm=bold ctermfg=red ctermbg=none highlight Socket cterm=bold ctermfg=magenta ctermbg=none highlight Device cterm=bold ctermfg=red ctermbg=none highlight Fifo cterm=bold ctermfg=cyan ctermbg=none highlight Executable cterm=bold ctermfg=green ctermbg=none highlight Selected cterm=bold ctermfg=magenta ctermbg=none highlight CurrLine cterm=bold ctermfg=none ctermbg=blue highlight TopLine cterm=none ctermfg=black ctermbg=white highlight TopLineSel cterm=bold ctermfg=black ctermbg=none highlight StatusLine cterm=bold ctermfg=black ctermbg=white highlight WildMenu cterm=underline,reverse ctermfg=white ctermbg=black highlight CmdLine cterm=none ctermfg=white ctermbg=black highlight ErrorMsg cterm=none ctermfg=red ctermbg=black highlight Border cterm=none ctermfg=black ctermbg=white
キーマッピング
As of 0.6.2 you can customize key bindings in Vifm. These can be set from the command mode using the map command, like so:
:map ] :s
However, these mappings will not be saved between sessions. To map a key permanently, place them in ~/vifm/vifmrc. More sample mappings can be seen at the end of that file.
vifm で開くファイルタイプ
You can assign applications to filetypes in vifmrc, eg.
filetype *.jpg,*.jpeg,*.png,*.gif feh %f 2>/dev/null & filetype *.md5 md5sum -c %f
Several defaults can be found in vifmrc. These can be edited or added to following the same format.
Feh でカレントディレクトリの画像を表示
filextype *.jpg,*.jpeg,*.png,*.gif \ {View in feh} \ feh -FZ %d --start-at %d/%c 2>/dev/null
It will display your selected image in feh, but it will enable you to browse all other images in the directory as well, in their default order.
ユーザーコマンド
You can also create custom commands in vifmrc, eg.
command df df -h %m 2> /dev/null command diff vim -d %f %F
シンボリックリンクの作成
command link ln -s %d/%f %D
When you call
:link
a link of the selected file is made in the other directory (if you are in split view). It even works with multiple files selected with visual (v) or tag (t).
Torrent の作成
make a .torrent of the current file in the other tab's dir
command mkt mktorrent -p -a [your announce url here] -o %D/%f.torrent %d/%f
マーク
Marks can be set same as in vi. To set a mark for current file:
m[a-z][A-Z][0-9]
Go to a file set for mark:
'[a-z][A-Z][0-9]
Vifm will remember the marks between the sessions.
Tips and tricks
便利なキーマッピング
Single stroke to access command line
nmap ; :
vim を使っていない場合
vifm
assumes that you are using vim
and will throw errors if it doesn't find it. If you are using {vi
, you need to edit your ~/.vifm/vifmrc
file. Comment out the line set vicmd=vim
and replace it with set vicmd=vi
. Note that, just like .exrc
, comment lines are introduced by double quotes.