コンテンツにスキップ

「Vifm」の版間の差分

提供: ArchWiki
削除された内容 追加された内容
文字列「Tips and tricks」を「ヒントとテクニック」に置換
同期
10行目: 10行目:
== インストール ==
== インストール ==


[[公式リポジトリ]]から {{Pkg|vifm}} を[[インストール]]してください。
{{Pkg|vifm}} パッケージを[[インストール]]してください。


== ヘルプファイル ==
== ヘルプファイル ==
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 はセッションを再起動してもマークを記憶しています。


=== プレビュー ===
=== プレビュー ===
{{Pkg|poppler}} をインストールして、{{ic|vifmrc}} に以下を記述することで pdftotext による PDF プレビューが有効になります:
Provided {{Pkg|poppler}} is installed,
putting
fileviewer *.pdf
fileviewer *.pdf
\ pdftotext %c -
\ pdftotext %c -

into vifmrc enables pdf-previewing using pdftotext.
{{ic|%c}} はカーソルのファイルをあらわす vifm マクロです。
The %c is a vifm macro for the current file under the cursor.

The preview is activated with
プレビューは以下のコマンドで有効にできます:
:view
:view

Neat image previewing can be achieved using img2txt from {{Pkg|libcaca}}
{{Pkg|libcaca}} に含まれている img2txt を使うことで画像のプレビューが可能になります:
fileviewer *.png,*.jpeg,*.jpg
fileviewer *.png,*.jpeg,*.jpg
\ img2txt %c
\ img2txt %c

Previewing the contents of tar-archives:
tar アーカイブの中身をプレビュー:
fileviewer *.tar,*.tar.gz
fileviewer *.tar,*.tar.gz
\ tar -tvf %c
\ tar -tvf %c

For previewing html documents suitable programs are
text based browsers including {{Pkg|lynx}}, {{Pkg|links}} or {{Pkg|w3m}}
HTML ドキュメントをプレビューしたい場合は {{Pkg|lynx}}, {{Pkg|links}}, {{Pkg|w3m}} などのテキストベースのブラウザを使うと良いでしょう:
fileviewer *.html
fileviewer *.html
\ w3m %c
\ w3m %c
140行目: 147行目:
=== 便利なキーマッピング ===
=== 便利なキーマッピング ===


コマンドラインにアクセス:
Single stroke to access command line
nmap ; :
nmap ; :



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  "