Comments (5)
你好,由于解析的时候我将会空格分割的参数看成一个整体来解析,没法在一个字符串中替换包含的部分,否则有歧义,比如:
%:p 可能是 %:p 单独,也可能是%和:p,这样就没法解析了。
你可以写成个函数,来解决这个问题:
function! GeneratePdf()
exec ":AsyncRun pandoc --output " . fnameescape(expand('%<')) . ".pdf %:p"
endfunc
noremap <silent> <leader>ppd :call GeneratePdf()<cr>
如此即可,或者你也可以写成个批处理文件,里面用 $VIM_FILENAME 等宏来实现转换,然后用
AsyncRun 来调用。
from asyncrun.vim.
更新了一个版本,现在参数同样接受下面这些变量:
$VIM_FILEPATH - File name of current buffer with full path
$VIM_FILENAME - File name of current buffer without path
$VIM_FILEDIR - Full path of current buffer without the file name
$VIM_FILEEXT - File extension of current buffer
$VIM_FILENOEXT - File name of current buffer without path and extension
$VIM_CWD - Current directory
$VIM_RELDIR - File path relativize to current directory
$VIM_RELNAME - File name relativize to current directory
$VIM_CWORD - Current word under cursor
$VIM_CFILE - Current filename under cursor
$VIM_GUI - Is running under gui ?
$VIM_VERSION - Value of v:version
$VIM_COLUMNS - How many columns in vim's screen
$VIM_LINES - How many lines in vim's screen
只是使用的时候,要用 $(...) 把他们包裹起来,这样就不会出现歧义了,那么使用最新版,针对你的问题,直接把 %<
换成 $(VIM_FILENOEXT)
即可:
nnoremap <silent> <Leader>ppd :AsyncRun pandoc --output $(VIM_FILENOEXT).pdf %:p <CR>
from asyncrun.vim.
感谢!已经可以使用啦!
from asyncrun.vim.
嗯,觉得好用请帮投个票:
http://www.vim.org/scripts/script.php?script_id=5431
from asyncrun.vim.
必须的!已经投啦!“Life-Changing“!
from asyncrun.vim.
Related Issues (20)
- -post function calling fails if function has character # in name HOT 5
- E117: Unknown function: asyncrun#run from .vimrc, but call asyncrun#run works fine after vim starts HOT 6
- Feature request: add an autocmd when project rooted. HOT 1
- Any way to auto-scroll when using term with no focus? HOT 6
- Job queues HOT 2
- AsyncStop does not work when I use it to kill a endless loop HOT 2
- unknown bug (duplicate output maybe) HOT 1
- floaterm: allow to set "autoclose"?
- Can this plugin run code in docker container and get the result in quickfix list? HOT 2
- no way to stop the job when running with -pos=hide
- How to run python scripts with other python interpreter? HOT 1
- 用quickui显示 结束关闭后buffer也不会消除, 新开也不会重用该buffer HOT 5
- Document option -append
- runner为floaterm时出现错误:不允许在弹出窗口中使用 HOT 7
- [nvim] Changing shell options on windows breaks AsyncRun HOT 3
- AsyncRun with -pos=tmux fails to execute and pastes into buffer instead
- -close 不work。。。 HOT 7
- E377: Invalid %- in format string when updating errorformat in init.lua HOT 1
- quickfix not syntax highlighted and cannot jump HOT 1
- E518: Unknown option: \ %{exists('w:quickfix_title')? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from asyncrun.vim.