-
Notifications
You must be signed in to change notification settings - Fork 11
/
vifmrc
247 lines (188 loc) · 6.2 KB
/
vifmrc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
" vim: filetype=vifm:foldmethod=marker:foldlevel=0
" _ __
" _ _ ____ __ _(_)/ _|_ __ ___ _ __ ___
" | | | |_ /___\ \ / / | |_| '_ ` _ \| '__/ __|
" | |_| |/ /_____\ V /| | _| | | | | | | | (__
" \__, /___| \_/ |_|_| |_| |_| |_|_| \___|
" |___/
" General settings -------------------- {{{
set vicmd=$EDITOR
set syscalls
set trash
set trashdir='~/.Trash'
set history=1000
set nofollowlinks
set sortnumbers
set undolevels=1000
set vimhelp
set norunexec
set wildmenu
set wildstyle=popup
set suggestoptions=normal,visual,view,otherpane,keys,marks,registers
set ignorecase
set smartcase
set nohlsearch
set incsearch
set scrolloff=4
set tabstop=2
set slowfs=curlftpfs
set vifminfo=dhistory,savedirs,chistory,state,tui,shistory,phistory,fhistory,dirstack,registers,bookmarks,bmarks
set viewcolumns=*{name}..,6{}.
set timefmt=%m/%d/%Y\ %H:%M
set statusline="%10A %10u:%g %8s[%8E] %18d %{&sort} %= %a free"
set rulerformat="%l/%S%[ +%x%]"
set grepprg='rg --line-number %i %a %s'
colorscheme gruvbox
" Icons
source $HOME/.config/vifm/icons
" }}}
" Marks -------------------- {{{
mark b ~/Library/CloudStorage/Dropbox/
mark c ~/.config/
mark d ~/Documents/
mark D ~/Downloads/
mark h ~/
" }}}
" Commands definition -------------------- {{{
command! run !! ./%f
command! mkcd :mkdir %a | cd %a
" Toggle detailed/brief information about files
command! togglefilesinfo
\ : if &viewcolumns == '*{name}..,6{}.'
\ | set viewcolumns=*{name}.,10{size}.,12{perms},10{uname},-7{gname},18{mtime}
\ | echo 'Files information: detailed'
\ | else
\ | set viewcolumns=*{name}..,6{}.
\ | echo 'Files information: brief'
\ | endif
" Diff for selections in the current pane if it contains more than one file, otherwise
" diff the file in the left (upper) pane with the file in the right (lower) pane
command! diff : if expand('%%c') == expand('%%f')
\ | if paneisat('right') && paneisat('bottom')
\ | execute '!$EDITOR -d %%C %%c'
\ | else
\ | execute '!$EDITOR -d %%c %%C'
\ | endif
\ | else
\ | execute '!$EDITOR -d %%f'
\ | endif
" Reset sort
command! resetsort
\ : if &sort != '+name'
\ | set sort=+name
\ | echo 'Reset sort to +name'
\ | endif
" FZF integration
command! FZFfind :set noquickview | :execute 'goto' fnameescape(term('fd -H | fzf --height 10 2>/dev/tty'))
" }}}
" Mappings -------------------- {{{
" NOTE: <space> performs like the leader key
" Restart vifm
nnoremap R :restart<cr>
" Open sort selection menu
nnoremap S :sort<cr>
" Exit vifm and cd to the dir
nnoremap s :shell<cr>
" Edit vifmrc
nnoremap <space>ev :write | edit $MYVIFMRC | restart<cr>
" Preview in another pane
nnoremap w :view<cr>
vnoremap w :view<cr>gv
" Fast renaming
nnoremap I cw<c-a>
nnoremap cc cw<c-u>
nnoremap A cw
" Copy the path of the dir of the current pane
nnoremap yd :!printf %d | pbcopy<cr>
" Copy the path of the dir/file under the cursor
nnoremap yc :!printf %c:p | pbcopy<cr>
" macOS builtin preview
nnoremap <space><space> :!qlmanage -p %f > /dev/null 2>&1<cr>
" Move focus between panes
noremap <C-k> <C-w>k
noremap <C-j> <C-w>j
noremap <C-h> <C-w>h
noremap <BS> <C-w>h
noremap <C-l> <C-w>l
" Adjust pane size (left for decreasing, right for increasing)
nnoremap <left> <C-w><
nnoremap <right> <C-w>>
" Moving cursor in another pane
nnoremap <silent> J <tab>j<tab>
nnoremap <silent> K <tab>k<tab>
" Toggle wrap in the preview
nnoremap <silent> <space>tw :set wrap!<cr>
" Toggle detailed/brief information about files
nnoremap <silent> <space>ti :togglefilesinfo<cr>
" Reset sort to +name
nnoremap <silent> <space>s :resetsort<cr>
" fzf
nnoremap <C-p> :FZFfind<cr>
" }}}
" Opener and viewer -------------------- {{{
" Pdf
filetype *.pdf open -a PDF\ Expert.app,
fileviewer *.pdf pdftotext -nopgbrk %c -
" PostScript
filetype *.ps,*.eps open -a Preview.app
" Djvu
filetype *.djvu open -a MacDjView.app
" Audio
filetype *.wav,*.mp3,*.flac,*.m4a,*.wma,*.ape,*.ac3,*.og[agx],*.spx,*.opus open -a IINA.app,
fileviewer *.mp3 mp3info
fileviewer *.flac soxi
" Video
filetype *.avi,*.mp4,*.wmv,*.dat,*.3gp,*.ogv,*.mkv,*.mpg,*.mpeg,*.vob,*.fl[icv],*.m2v,*.mov,*.webm,*.ts,*.mts,*.m4v,*.r[am],*.qt,*.divx,*.as[fx] open -a IINA.app,
fileviewer *.avi,*.mp4,*.wmv,*.dat,*.3gp,*.ogv,*.mkv,*.mpg,*.mpeg,*.vob,*.fl[icv],*.m2v,*.mov,*.webm,*.ts,*.mts,*.m4v,*.r[am],*.qt,*.divx,*.as[fx] ffprobe -pretty %c 2>&1
" Web
filetype *.html,*.htm open -a Google\ Chrome.app,
fileviewer *.html,*.htm w3m -dump -T text/html
" Object
filetype *.o nm %f | less
" Man page
filetype *.[1-8] man ./%c
fileviewer *.[1-8] man ./%c | col -b
" Image
filetype *.bmp,*.jpg,*.jpeg,*.png,*.gif,*.xpm open -a Preview.app,
fileviewer *.bmp,*.jpg,*.jpeg,*.png,*.gif,*.xpm
\ kitty +icat --silent --transfer-mode=stream --place %pwx%ph@%pxx%py %c %N
\ %pc
\ kitty icat --clear --silent %pd
" MD5
filetype *.md5 md5sum -c %f %S
" SHA1
filetype *.sha1 sha1sum -c %f %S
" SHA256
filetype *.sha256 sha256sum -c %f %S
" SHA512
filetype *.sha512 sha512sum -c %f %S
" Torrent
filetype *.torrent open -a Transmission.app
" Extract zip files
filetype *.zip unzip %f
fileviewer *.zip,*.jar,*.war,*.ear zip -sf %c
" Extract tar archives
filetype *.tar,*.tar.bz2,*.tbz2,*.tgz,*.tar.gz tar -xf %f
fileviewer *.tar,*.tar.bz2,*.tbz2,*.tgz,*.tar.gz tar -tf %f
" Extract .bz2 archives
filetype *.bz2 bzip2 -d %f
" Extract .gz files
filetype *.gz gunzip %f
" Mount .dmg archives
filetype *.dmg open
" Mount disk .img
filetype *.img open
" Open .pkg binaries
filetype *.pkg open
" Office files
filetype *.odt,*.doc,*.docx open -a Microsoft\ Word.app
filetype *.ods,*.xls,*.xlsx open -a Microsoft\ Excel.app
filetype *.odp,*.pptx,*.ppt open -a Microsoft\ PowerPoint.app
fileviewer *.doc antiword -
fileviewer *.docx docx2txt.pl %f -
"CSV
filetype *.csv open -a Numbers.app
" Source code (with highlighting)
fileviewer *.[ch],*.[ch]pp,*.html,*.css,*.less,*.js,*.java,*.go,*.py,*.coffee,*.dart,*.lua,*.md,*.rb,*.ts,*.php,*.cs,*.vim,*.conf,*.swift,*.json,*.xml highlight -O xterm256 -s dante %c --force
fileviewer Makefile,Makefile.* highlight -O xterm256 -s dante --syntax make %c
" }}}