在Vim中,我希望仅当文件类型为markdown,text或none(即NULL)时才设置某个映射集.指定"无"是困难的部分.
如果:set filetype?
返回filetype=markdown
或,则以下命令有效filetype=text
.但是如果:set filetype?
返回filetype=
(显示none
在我的状态行中)它不起作用.
autocmd FileType markdown,text,none nnoremap <leader>f :%! cat<CR>
Run Code Online (Sandbox Code Playgroud)
没有设置指定文件类型的正确方法是什么?换句话说,只有在未设置文件类型(或文本或降价)时才应定义此映射.在任何其他文件类型上,映射应该是未定义的.
注意:映射是设计的,因为它不是问题的有趣部分.
我正在创建一个涂抹/干净的git过滤器.过滤器需要知道要过滤的文件的名称,以便它可以执行一些外部操作,其结果将由过滤器输出.
由于过滤器是从stdin读取并写入stdout,有没有办法让文件名被过滤?
例如,我想:
git blame $0 | cut -d " " -f 4-6 | sort | uniq | sort | tail -1
Run Code Online (Sandbox Code Playgroud)
找出此文件中最后一次更改的日期或:
git grep -I --name-only -e "" -- $0
Run Code Online (Sandbox Code Playgroud)
测试文件是否为二进制文件.
但是,我需要知道我应该使用什么作为" $0
"从过滤器内部进行此操作?
对于多个依赖项,Gemfile的正确语法是什么?
尝试使用Capistrano时,出现错误消息:
cap aborted!
NotImplementedError: unsupported key type `ssh-ed25519'
net-ssh requires the following gems for ed25519 support:
* rbnacl (>= 3.2, < 5.0)
* rbnacl-libsodium, if your system doesn't have libsodium installed.
* bcrypt_pbkdf (>= 1.0, < 2.0)
See https://github.com/net-ssh/net-ssh/issues/478 for more information
Gem::LoadError : "can't activate rbnacl (< 5.0, >= 3.2.0), already activated rbnacl-5.0.0. Make sure all dependencies are added to Gemfile."
Run Code Online (Sandbox Code Playgroud)
我将以下内容放入我的Gemfile中:
gem 'rbnacl', '>= 3.2, < 5.0', :require => false
gem 'rbnacl-libsodium', :require => false
gem 'bcrypt_pbkdf', …
Run Code Online (Sandbox Code Playgroud)