当前位置:网站首页>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
边栏推荐
- MPLS notes Part 1
- 【第26天】给定 n 个元素的升序数组nums,求实现一个函数在nums中寻找target的下标 | 初识二分查找
- O (log (min (m, n))
- 【FPGA】串口以命令控制温度采集
- Google browser console F12 how to set the Chinese / English switching method, we must see the last!!!
- Build and train your own dataset for pig face recognition
- 当他们在私域里,掌握了分寸感
- jwt
- Hashcat 的使用
- 折叠屏将成国产手机分食苹果市场的重要武器
猜你喜欢

Talking about the advantages of flying book in development work | community essay solicitation

创新药二级市场审饼疲劳:三期临床成功、产品获批也不管用了

罗德与施瓦茨与中关村泛联院合作开展6G技术研究与早期验证

Integration of metersphere open source continuous testing platform and Alibaba cloud cloud cloud efficient Devops

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

做软件安全测试的作用,如何寻找软件安全测试公司出具报告?

【Proteus仿真】Arduino UNO+数码管显示4x4键盘矩阵按键
![Longest continuous sequence [diffusion method + space for time]](/img/db/7b0d1b0db7015e887340723505153a.png)
Longest continuous sequence [diffusion method + space for time]

Numerical scheme simulation of forward stochastic differential equations with Markov Switching

Fake wireless speakers in stores? Sony responded: the product has reserved a wired connection interface, which can be used in complex scenarios
随机推荐
【移动端】手机界面的设计尺寸
当一个接口出现异常时候,你是如何分析异常的?
探索C语言程序奥秘——C语言程序编译与预处理
Experience of epidemic prevention and control, home office and online teaching | community essay solicitation
Sumati gamefi ecological overview, element design in the magical world
元宇宙的生态圈
leetcode:2104. Subarray range and
Integration of metersphere open source continuous testing platform and Alibaba cloud cloud cloud efficient Devops
Do you know your ABC
你知道你的ABC吗(春季每日一题 1)
3年测试经验,连简历上真正需要什么都没搞明白,张口就要20k?
华为、阿里等大厂程序员真的好找对象吗?
How can Huatai Securities open an account to achieve one in ten thousand? Are securities accounts safe and reliable
What are the reasons for the abnormal playback of the online channel of the channel accessed by easycvr national standard protocol?
Rod and Schwartz cooperated with ZhongGuanCun pan Lianyuan Institute to carry out 6G technology research and early verification
MeterSphere開源持續測試平臺與阿裏雲雲效DevOps的集成
DDD概念复杂难懂,实际落地如何设计代码实现模型?
Viewing MySQL password on Linux_ MySQL forgets password "suggestions collection" under Linux
How to get the picture outside the chain - Netease photo album [easy to understand]
折叠屏将成国产手机分食苹果市场的重要武器