Git Product home page Git Product logo

Comments (5)

skywind3000 avatar skywind3000 commented on May 22, 2024

你好,由于解析的时候我将会空格分割的参数看成一个整体来解析,没法在一个字符串中替换包含的部分,否则有歧义,比如:
%: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.

skywind3000 avatar skywind3000 commented on May 22, 2024

更新了一个版本,现在参数同样接受下面这些变量:

$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.

hongyuanjia avatar hongyuanjia commented on May 22, 2024

感谢!已经可以使用啦!

from asyncrun.vim.

skywind3000 avatar skywind3000 commented on May 22, 2024

嗯,觉得好用请帮投个票:
http://www.vim.org/scripts/script.php?script_id=5431

from asyncrun.vim.

hongyuanjia avatar hongyuanjia commented on May 22, 2024

必须的!已经投啦!“Life-Changing“!

from asyncrun.vim.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.