「Vifm」の版間の差分

提供: ArchWiki
ナビゲーションに移動 検索に移動
(ページの作成:「Category:ファイルマネージャ ar:Vifm en:Vifm {{Related articles start}} {{Related|ranger}} {{Related articles end}} [http://vifm.info/ Vifm] のホー...」)
 
(同期)
(2人の利用者による、間の2版が非表示)
6行目: 6行目:
 
{{Related articles end}}
 
{{Related articles end}}
 
[http://vifm.info/ Vifm] のホームページより:
 
[http://vifm.info/ Vifm] のホームページより:
:'' Vifm は ncurses ベースのファイルマネージャで、vi のようなキーバインディング/モード/オプション/コマンド/設定を備えています。また、mutt からもアイデアを頂戴しています。vi を使っているのであれば、Vifm では新しいコマンドセットを覚えなくても完全にファイルをキーボードで制御できるでしょう。''
+
:'' Vifm は ncurses ベースのファイルマネージャで、vi のようなキーバインディング/モード/オプション/コマンド/設定を備えています。また、[[mutt]] からもアイデアを頂戴しています。[[vi]] を使っているのであれば、Vifm では新しいコマンドセットを覚えなくても完全にファイルをキーボードで制御できるでしょう。''
   
 
== インストール ==
 
== インストール ==
   
[[公式リポジトリ]]から {{Pkg|vifm}} を[[インストール]]してください。
+
{{Pkg|vifm}} パッケージを[[インストール]]してください。
 
任意で、ファイルのプレビューを使いたい場合は以下もインストールしてください:
 
* {{Pkg|tree}} ディレクトリのプレビュー
 
* {{Pkg|mp3info}} mp3 ファイルの情報を表示
 
* {{Pkg|poppler}} pdf プレビュー
 
   
 
== ヘルプファイル ==
 
== ヘルプファイル ==
27行目: 22行目:
 
== Vifm のカスタマイズ ==
 
== Vifm のカスタマイズ ==
   
  +
Vifm はホームディレクトリに .vifm フォルダを作成し、以下のファイルが保存されます:
Vifm creates and populates a .vifm folder in your home directory containing the following:
 
  +
* vifmrc - 作業スタイルにあわせて編集できるコメント豊富な設定ファイル。
* vifmrc - a well commented configuration file that can be edited to suit your working style.
 
* vifm-help.txt - the help text
+
* vifm-help.txt - ヘルプテキスト。
  +
* vifminfo - ブックマークおよびゴミ箱の中身。手動で編集することは推奨されていません。
* vifminfo - bookmarks and trash contents - it is not recommended to edit this file by hand
 
* Trash/ directory - self explanatory
+
* Trash/ ディレクトリ - ゴミ箱。
* colors/ directory - color schemes
+
* colors/ ディレクトリ - カラースキーム。
  +
** Default - コメントが豊富についているデフォルトのカラースキーム。コピーして自分でカラースキームを作成できます。
** Default - well commented default color scheme - can be copied to create user-created color schemes
 
   
  +
最初に以下のドキュメントを読んでください:
To get started, read the information avaliable in:
 
 
* {{ic|/usr/share/vifm/vifm.txt}}
 
* {{ic|/usr/share/vifm/vifm.txt}}
 
* {{ic|/usr/share/vifm/vifm-help.txt}}
 
* {{ic|/usr/share/vifm/vifm-help.txt}}
41行目: 36行目:
 
=== カラースキーム ===
 
=== カラースキーム ===
   
  +
{{ic|~/.vifm/colors}} ディレクトリにはカラースキームを保存します。フォーマットはフ vi/vim のシンタックスハイライトのフォーマットに従っています:
The {{ic|~/.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''
 
highlight ''group'' cterm=''attribute'' ctermfg=''color'' ctermbg=''color''
   
  +
例えばカラースキームは以下のようになります:
An example colorscheme looks like:
 
 
highlight Win cterm=none ctermfg=white ctermbg=black
 
highlight Win cterm=none ctermfg=white ctermbg=black
 
highlight Directory cterm=bold ctermfg=cyan ctermbg=none
 
highlight Directory cterm=bold ctermfg=cyan ctermbg=none
62行目: 57行目:
 
highlight ErrorMsg cterm=none ctermfg=red ctermbg=black
 
highlight ErrorMsg cterm=none ctermfg=red ctermbg=black
 
highlight Border cterm=none ctermfg=black ctermbg=white
 
highlight Border cterm=none ctermfg=black ctermbg=white
  +
  +
正規表現を使ってファイルタイプをハイライトすることもできます:
  +
highlight /^.*\.(mp3|ogg|oga|flac|m4a)$/ ctermfg=magenta
  +
highlight /^.*\.(jpg|jpeg|png|gif|tiff|webp|bmp|svg|svgz)$/ ctermfg=yellow
  +
highlight /^.*\.(zip|gz|bz2|xz|tar|tgz|tbz2|7z|rar|iso|rpm|deb)$/ ctermfg=red
   
 
=== キーマッピング ===
 
=== キーマッピング ===
   
  +
0.6.2 現在、Vifm ではキーバインドをカスタマイズできます。以下のように map コマンドを使ってコマンドモードから設定できます:
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
+
:map ] :s
   
  +
ただし、マッピングはセッションを再起動すると消えてしまいます。キーを永続的にマッピングするには {{ic|~/vifm/vifmrc}} にマッピングを記述してください。ファイルの末尾にサンプルマッピングが書かれています。
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 で開くファイルタイプ ===
 
=== vifm で開くファイルタイプ ===
   
  +
vifmrc を使って以下のようにファイルタイプに対してアプリケーションを指定できます:
You can assign applications to filetypes in vifmrc, eg.
 
 
filetype *.jpg,*.jpeg,*.png,*.gif feh %f 2>/dev/null &
 
filetype *.jpg,*.jpeg,*.png,*.gif feh %f 2>/dev/null &
 
filetype *.md5 md5sum -c %f
 
filetype *.md5 md5sum -c %f
  +
vifmrc には複数のデフォルト設定が存在します。同じフォーマットに従って編集・追加できます。
Several defaults can be found in vifmrc. These can be edited or added to following the same format.
 
   
 
==== Feh でカレントディレクトリの画像を表示 ====
 
==== Feh でカレントディレクトリの画像を表示 ====
82行目: 82行目:
 
\ {View in feh}
 
\ {View in feh}
 
\ feh -FZ %d --start-at %d/%c 2>/dev/null
 
\ feh -FZ %d --start-at %d/%c 2>/dev/null
  +
選択した画像が feh で表示されます。
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.
 
   
 
=== ユーザーコマンド ===
 
=== ユーザーコマンド ===
   
  +
{{ic|vifmrc}} で以下のようにカスタムコマンドを作成できます:
You can also create custom commands in vifmrc, eg.
 
 
command df df -h %m 2> /dev/null
 
command df df -h %m 2> /dev/null
 
command diff vim -d %f %F
 
command diff vim -d %f %F
93行目: 93行目:
   
 
command link ln -s %d/%f %D
 
command link ln -s %d/%f %D
  +
When you call
 
  +
(分割ビューで) 以下のコマンドを実行すると選択されたファイルのリンクが他のディレクトリに作成されます:
 
:link
 
: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).
 
  +
ビジュアル (v) またはタグ (t) で複数のファイルを選択した場合でも機能します。
   
 
==== Torrent の作成 ====
 
==== Torrent の作成 ====
   
  +
カレントファイルの .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
 
command mkt mktorrent -p -a [your announce url here] -o %D/%f.torrent %d/%f
   
 
=== マーク ===
 
=== マーク ===
   
  +
マークは vi と同じように設定することができます。
Marks can be set same as in vi.
 
  +
To set a mark for current file:
 
  +
カレントファイルにマークを設定するには:
 
m[a-z][A-Z][0-9]
 
m[a-z][A-Z][0-9]
  +
Go to a file set for mark:
 
  +
マークしたファイルに移動するには:
 
'[a-z][A-Z][0-9]
 
'[a-z][A-Z][0-9]
Vifm will remember the marks between the sessions.
 
   
  +
Vifm はセッションを再起動してもマークを記憶しています。
== Tips and tricks ==
 
  +
  +
=== プレビュー ===
  +
{{Pkg|poppler}} をインストールして、{{ic|vifmrc}} に以下を記述することで pdftotext による PDF プレビューが有効になります:
  +
fileviewer *.pdf
  +
\ pdftotext %c -
  +
  +
{{ic|%c}} はカーソルのファイルをあらわす vifm マクロです。
  +
  +
プレビューは以下のコマンドで有効にできます:
  +
:view
  +
  +
{{Pkg|libcaca}} に含まれている img2txt を使うことで画像のプレビューが可能になります:
  +
fileviewer *.png,*.jpeg,*.jpg
  +
\ img2txt %c
  +
  +
tar アーカイブの中身をプレビュー:
  +
fileviewer *.tar,*.tar.gz
  +
\ tar -tvf %c
  +
  +
HTML ドキュメントをプレビューしたい場合は {{Pkg|lynx}}, {{Pkg|links}}, {{Pkg|w3m}} などのテキストベースのブラウザを使うと良いでしょう:
  +
fileviewer *.html
  +
\ w3m %c
  +
  +
プレビューに役立つプログラム:
  +
* {{Pkg|tree}} - ディレクトリのプレビュー
  +
* {{Pkg|mp3info}} - mp3 ファイルの情報を表示
  +
* {{Pkg|libmediainfo}} - メディア (音声・動画) の情報を表示
  +
  +
== ヒントとテクニック ==
   
 
=== 便利なキーマッピング ===
 
=== 便利なキーマッピング ===
   
  +
コマンドラインにアクセス:
Single stroke to access command line
 
nmap ; :
+
nmap ; :
   
 
=== vim を使っていない場合 ===
 
=== vim を使っていない場合 ===
{{ic|vifm}} assumes that you are using {{ic|vim}} and will throw errors if it doesn't find it. If you are using {{{ic|vi}}, you need to edit your {{ic|~/.vifm/vifmrc}} file. Comment out the line {{ic|<nowiki>set vicmd=vim</nowiki>}} and replace it with {{ic|<nowiki>set vicmd=vi</nowiki>}}. Note that, just like {{ic|.exrc}}, comment lines are introduced by double quotes.
+
{{ic|vifm}} {{ic|vim}} が見つからないとエラーを表示します。{{ic|vi}} または {{ic|nvim}} ([[Neovim]]) を使用する場合、{{ic|~/.vifm/vifmrc}} ファイルを編集してください。{{ic|<nowiki>set vicmd=vim</nowiki>}} という行をコメントアウトして {{ic|<nowiki>set vicmd=vi</nowiki>}} あるいは {{ic|<nowiki>set vicmd=nvim</nowiki>}} に置き換えてください。{{ic|.exrc}} と同じようにコメント行はダブルクォートを行頭にします。
  +
  +
=== 選択したファイルの合計容量 ===
  +
  +
選択したファイルの合計サイズを表示するには {{ic|~/.vifm/vifmrc}} の %s を以下のように %E に変更してください:
  +
set statusline=" %t%= %A %10u:%-7g %15E %20d "

2018年2月3日 (土) 17:33時点における版

関連記事

Vifm のホームページより:

Vifm は ncurses ベースのファイルマネージャで、vi のようなキーバインディング/モード/オプション/コマンド/設定を備えています。また、mutt からもアイデアを頂戴しています。vi を使っているのであれば、Vifm では新しいコマンドセットを覚えなくても完全にファイルをキーボードで制御できるでしょう。

インストール

vifm パッケージをインストールしてください。

ヘルプファイル

vifm の基本的な情報はヘルプファイルに書かれています。vifm を開いて次を入力することでヘルプファイルを見ることができます:

:h

他の情報は man ページを見てください。

Vifm のカスタマイズ

Vifm はホームディレクトリに .vifm フォルダを作成し、以下のファイルが保存されます:

  • vifmrc - 作業スタイルにあわせて編集できるコメント豊富な設定ファイル。
  • vifm-help.txt - ヘルプテキスト。
  • vifminfo - ブックマークおよびゴミ箱の中身。手動で編集することは推奨されていません。
  • Trash/ ディレクトリ - ゴミ箱。
  • colors/ ディレクトリ - カラースキーム。
    • Default - コメントが豊富についているデフォルトのカラースキーム。コピーして自分でカラースキームを作成できます。

最初に以下のドキュメントを読んでください:

  • /usr/share/vifm/vifm.txt
  • /usr/share/vifm/vifm-help.txt

カラースキーム

~/.vifm/colors ディレクトリにはカラースキームを保存します。フォーマットはフ vi/vim のシンタックスハイライトのフォーマットに従っています:

highlight group cterm=attribute ctermfg=color ctermbg=color

例えばカラースキームは以下のようになります:

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

正規表現を使ってファイルタイプをハイライトすることもできます:

highlight /^.*\.(mp3|ogg|oga|flac|m4a)$/ ctermfg=magenta
highlight /^.*\.(jpg|jpeg|png|gif|tiff|webp|bmp|svg|svgz)$/ ctermfg=yellow
highlight /^.*\.(zip|gz|bz2|xz|tar|tgz|tbz2|7z|rar|iso|rpm|deb)$/ ctermfg=red

キーマッピング

0.6.2 現在、Vifm ではキーバインドをカスタマイズできます。以下のように map コマンドを使ってコマンドモードから設定できます:

:map ] :s

ただし、マッピングはセッションを再起動すると消えてしまいます。キーを永続的にマッピングするには ~/vifm/vifmrc にマッピングを記述してください。ファイルの末尾にサンプルマッピングが書かれています。

vifm で開くファイルタイプ

vifmrc を使って以下のようにファイルタイプに対してアプリケーションを指定できます:

filetype *.jpg,*.jpeg,*.png,*.gif feh %f 2>/dev/null &
filetype *.md5 md5sum -c %f

vifmrc には複数のデフォルト設定が存在します。同じフォーマットに従って編集・追加できます。

Feh でカレントディレクトリの画像を表示

filextype *.jpg,*.jpeg,*.png,*.gif
       \ {View in feh}
       \ feh -FZ %d --start-at %d/%c 2>/dev/null

選択した画像が feh で表示されます。

ユーザーコマンド

vifmrc で以下のようにカスタムコマンドを作成できます:

command df df -h %m 2> /dev/null
command diff vim -d %f %F

シンボリックリンクの作成

command link ln -s %d/%f %D

(分割ビューで) 以下のコマンドを実行すると選択されたファイルのリンクが他のディレクトリに作成されます:

:link

ビジュアル (v) またはタグ (t) で複数のファイルを選択した場合でも機能します。

Torrent の作成

カレントファイルの .torrent を他のタブのディレクトリに作成:

command mkt mktorrent -p -a [your announce url here] -o %D/%f.torrent %d/%f

マーク

マークは vi と同じように設定することができます。

カレントファイルにマークを設定するには:

m[a-z][A-Z][0-9]

マークしたファイルに移動するには:

'[a-z][A-Z][0-9]

Vifm はセッションを再起動してもマークを記憶しています。

プレビュー

poppler をインストールして、vifmrc に以下を記述することで pdftotext による PDF プレビューが有効になります:

fileviewer *.pdf
  \ pdftotext %c -

%c はカーソルのファイルをあらわす vifm マクロです。

プレビューは以下のコマンドで有効にできます:

:view

libcaca に含まれている img2txt を使うことで画像のプレビューが可能になります:

fileviewer *.png,*.jpeg,*.jpg
 \ img2txt %c 

tar アーカイブの中身をプレビュー:

fileviewer *.tar,*.tar.gz
 \ tar -tvf %c

HTML ドキュメントをプレビューしたい場合は lynx, links, w3m などのテキストベースのブラウザを使うと良いでしょう:

fileviewer *.html
 \ w3m %c

プレビューに役立つプログラム:

  • tree - ディレクトリのプレビュー
  • mp3info - mp3 ファイルの情報を表示
  • libmediainfo - メディア (音声・動画) の情報を表示

ヒントとテクニック

便利なキーマッピング

コマンドラインにアクセス:

nmap ; :

vim を使っていない場合

vifmvim が見つからないとエラーを表示します。vi または nvim (Neovim) を使用する場合、~/.vifm/vifmrc ファイルを編集してください。set vicmd=vim という行をコメントアウトして set vicmd=vi あるいは set vicmd=nvim に置き換えてください。.exrc と同じようにコメント行はダブルクォートを行頭にします。

選択したファイルの合計容量

選択したファイルの合計サイズを表示するには ~/.vifm/vifmrc の %s を以下のように %E に変更してください:

set statusline="  %t%= %A %10u:%-7g %15E %20d  "