vim image placement

后端 未结 1 1643
别跟我提以往
别跟我提以往 2021-01-05 09:20

For the last few days I\'ve been forcing myself to switch from Textmate to Vim. for the most part, my efficiency is pretty much the same after some heavy Vim configuration.

1条回答
  •  攒了一身酷
    2021-01-05 09:47

    I've been thinking about that automatic building since switching.

    Vim has a built-in solution for one part of the problem: the omni-completion engine allows you to complete the path of a file you want to include.

    If you begin to type a "path-like" string — say

    This 0 is a bit of a problem though. The system is obviously not perfect but once I'll get rid of this nagging 0 it's going to fit rather nicely within the rest of my snipMate-based process.

    By the way here is a second modified version of the script I use.

    END ANOTHER EDIT

    EXTENDED 12" RE-EDIT VERSION

    With:

    • ImageMagick's identify
    • HTML_insert.vim in ~/.vim/plugins/
    • insert_image.vim in ~/.vim/nerdtree_plugin

    you can:

    • open NERDTree, select an image and hit b to have an almost complete tag pasted at the cursor's position in the previous window
    • or, if your Vim flavour allows it, type :IMG to open a native file selection dialog, chose an image and have an almost complete tag pasted at the cursor's position in the current window
    • or, if you are in a terminal, type :IMG path/to/file.jpg to have an almost complete tag pasted at the cursor's position in the current window

    The snipMate solution is not really baked right now.

    Thanks to Petr Mach and @Matteo Riva for actually doing most of the work.

    And yes, I'm obviously not a Vim expert.

    END EXTENDED 12" RE-EDIT VERSION

    0 讨论(0)
提交回复
热议问题