当前位置:网站首页>vim的Dirvish中文文档
vim的Dirvish中文文档
2022-06-24 22:40:00 【fqbqrr】
简介
使用它,可避免微软的文件管理器,因为它会崩溃!Dirvish是极简目录查看器.转储路径列表到Vim缓冲区中并提供一些快捷键.
因为每个Dirvish缓冲区名都是字面目录路径,所以可:cd到目录,
:cd %
创建新文件,
:edit %/foo.txt
expand()目录路径,
:let &titlestring=expand('%',1)
并使用如(unimpaired.vim)中]f/[f的补全插件命令.
可用普通的yank,:read,gf等Vim命令.它永远不会修改文件系统.
如果编辑缓冲区,Dirvish会自动禁用隐藏,以便可看到全文.
映射
命令 | 意思 |
|---|---|
<Plug>(dirvish_up)或- | 打开当前文件目录或第[count]个父目录 |
局部,缓冲区本地(文件类型=dirvish)映射:
映射 | 意思 |
|---|---|
G?,显示帮助. | |
[count]R | 重新加载当前目录.(:edit也可以),如果给定,设置g:dirvish_mode为[count].助记:更高[count]=>更多文件. |
<Plug>(dirvish_quit)或gq | 退出并返回到原文件. |
<Plug>(dirvish_up)或- | 打开第[count]个父目录. |
<Plug>(dirvish_split_up) | 在新窗口中打开第[count]个父级. |
<Plug>(dirvish_vsplit_up) | 在新垂直窗口中打开第[count]个父级. |
<2-LeftMouse>或i或<CR> | 打开光标处文件. |
{Visual}I或{Visual}<CR> | 打开选定文件. |
o | 在新窗口中打开文件. |
{Visual}O | 在新窗口中打开每个选定文件. |
a | 在新垂直窗口中打开文件. |
{Visual}A | 在新垂直窗口中打开每个选定文件. |
K | 显示文件信息.[count]显示目录大小. |
{Visual}K | 显示选定文件信息.[count]显示目录大小. |
p | 预览光标处的文件. |
CTRL-N | 预览下一个文件. |
CTRL-P | 预览前一个文件. |
<Plug>(dirvish_arg)或x | 在本地arglist中添加/删除文件. |
{Visual}x | 添加选定文件到本地arglist. |
dax | 启动新空本地arglist. |
. | 在命令行中插入:!{path}. |
{Visual}. | 在命令行中插入:Shdo {}. |
[count]. | 在命令行中插入:Shdo!{}. |
~ | 打开家目录. |
cd | 设置本地当前目录.:lcd |
[count]cd | 设置全局当前目录.:cd |
命令
| 命令 | 意思 |
|---|---|
:Dirvish | 打开当前目录,:Dirvish %也可以 |
:Dirvish{path} | 打开位于{path}的目录,如果{path}是文件,则打开其父目录 |
函数
函数 | 意思 |
|---|---|
dirvish#open() | 同下 |
[range]dirvish#open({cmd}, {bg}) | 在[range]区间中,执行{cmd} ("edit", "vsplit", "split", "tabedit")命令.{bg}为`0(当前窗口) |
dirvish#add_icon_fn(fn) | 注意路径图标 |
dirvish#remove_icon_fn() | 注册图标 |
选项
g:dirvish_mode,控制如何列举与展示.1为'suffixes'和'wildignore'决定排序和可见.2按glob()序.:{cmd}为列举后执行命令.
助记符:更高的数字=>更多文件,在第一次打开目录时,触发BufNew,未加载.加载后,触发FileType.可通过它覆盖映射,选项和内容.
augroup dirvish_config
autocmd!
"映射`t`来在新tab中打开
autocmd FileType dirvish
\ nnoremap <silent><buffer> t :call dirvish#open('tabedit', 0)<CR>
\ |xnoremap <silent><buffer> t :call dirvish#open('tabedit', 0)<CR>
"映射`gr`来重载
autocmd FileType dirvish nnoremap <silent><buffer>
\ gr :<C-U>Dirvish %<CR>
" 映射`gh`来隐藏点前缀文件.按`R`来切换
autocmd FileType dirvish nnoremap <silent><buffer>
\ gh :silent keeppatterns [email protected]\v/\.[^\/]+/[email protected] _<cr>:setl cole=3<cr>
augroup END
常见问题解答
用'splitbelow'和'splitright'控制拆分窗口位置.
如何分组或排序目录?
:sort ,^.*[\/],
:sort ,^.*[^\/],
//上面为顶部,下面为底部排序.
let g:dirvish_mode = ':sort ,^.*[\/],'
//来自动排序.
用了g:dirvish_relative_paths,则用
let g:dirvish_mode = ':sort ,^\v(.*[\/])|\ze,'
如何过滤?
:g/foo/d
let g:dirvish_mode = ':silent keeppatterns g/foo/d _'
//自动过滤
:[email protected]\v/\.[^\/]+/[email protected]
//删除显示隐藏文件.
自动化的话:
let g:dirvish_mode = ':silent keeppatterns [email protected]\v/\.[^\/]+/[email protected] _'
autocmd FileType dirvish silent keeppatterns [email protected]\v/\.[^\/]+/[email protected] _
要显示,则用撤销,要再次隐藏,用重载.
禁用映射
augroup dirvish_config
autocmd!
autocmd FileType dirvish silent! unmap <buffer> <C-p>
//禁用<C-p>
augroup END
禁用所有本缓冲:
:mapclear <buffer>
用:noswapfile避免交换文件.:Shdo可批量删/重命名/其他动作文件.因为:'<,'>call delete(getline('.'))太长了.
覆盖netrw的:Explore,:Sexplore,:Vexplore命令?
把如下放入vimrc中:
let g:loaded_netrwPlugin = 1
command! -nargs=? -complete=dir Explore Dirvish <args>
command! -nargs=? -complete=dir Sexplore belowright split | silent Dirvish <args>
command! -nargs=? -complete=dir Vexplore leftabove vsplit | silent Dirvish <args>
如何内联(如树样式视图)扩展目录?
augroup dirvish_config
autocmd!
autocmd FileType dirvish
\ nnoremap <silent><buffer> t ddO<Esc>:let @"=substitute(@", '\n', '', 'g')<CR>:r ! find "<C-R>"" -maxdepth 1 -print0 \| xargs -0 ls -Fd<CR>:silent! keeppatterns %s/\/\//\//g<CR>:silent! keeppatterns %s/[^a-zA-Z0-9\/]$//g<CR>:silent! keeppatterns g/^$/d<CR>:noh<CR>
"有点麻烦.会使用"寄存器
augroup END
边栏推荐
- LINQ 查询(3)
- Four characteristics of actual attack and defense drill
- Longest continuous sequence [diffusion method + space for time]
- Use of hashcat
- 文件系统 -- 磁盘基础知识和FAT32文件系统详细介绍
- Do you know your ABC
- 当人们用互联网式的思维和视角来看待产业互联网的时候,其实已陷入到了死胡同
- Listen to the markdown file and hot update next JS page
- 創新藥二級市場審餅疲勞:三期臨床成功、產品獲批也不管用了
- Chinese address and English address
猜你喜欢

3年测试经验,连简历上真正需要什么都没搞明白,张口就要20k?

入职一家新公司,如何快速熟悉代码?

File system - basic knowledge of disk and detailed introduction to FAT32 file system
![Longest continuous sequence [diffusion method + space for time]](/img/db/7b0d1b0db7015e887340723505153a.png)
Longest continuous sequence [diffusion method + space for time]

Fake wireless speakers in stores? Sony responded: the product has reserved a wired connection interface, which can be used in complex scenarios

Use of hashcat

常用的软件测试工具清单,请查收。

元宇宙的生态圈

Chinese address and English address

Please run IDA with elevated permissons for local debugging.
随机推荐
tmux 如何自定义背景颜色 | How does the tmux color palette work?
創新藥二級市場審餅疲勞:三期臨床成功、產品獲批也不管用了
Build and train your own dataset for pig face recognition
How to get the picture outside the chain - Netease photo album [easy to understand]
Test / development programmers, 30, do you feel confused? And where to go
【第26天】给定 n 个元素的升序数组nums,求实现一个函数在nums中寻找target的下标 | 初识二分查找
中文地址与英文地址
Award winning interface control development kit devaxpress v22.1 officially announced
当一个接口出现异常时候,你是如何分析异常的?
DDD概念复杂难懂,实际落地如何设计代码实现模型?
Status quo analysis: how "one cloud and multi-core" can promote the rapid deployment of information innovation projects
How to monitor the log through the easycvr interface to observe the platform streaming?
【FPGA】串口以命令控制温度采集
进入阿里做测试员遥不可及?这里或许有你想要的答案
[mobile terminal] design size of mobile phone interface
困牛排序(寒假每日一题 40)
Half of the year has passed. How many flags have been achieved at the end of the year?
【Proteus仿真】Arduino UNO+数码管显示4x4键盘矩阵按键
业务与技术双向结合构建银行数据安全管理体系
Is GF futures safe? What do I need to open an account?