committia.vim, 在提交消息时,使用Vim插件进行更愉快的编辑

分享于 

5分钟阅读

GitHub

  繁體 雙語
A Vim plugin for more pleasant editing on commit messages
  • 源代码名称:committia.vim
  • 源代码网址:http://www.github.com/rhysd/committia.vim
  • committia.vim源代码文档
  • committia.vim源代码下载
  • Git URL:
    git://www.github.com/rhysd/committia.vim.git
    Git Clone代码到本地:
    git clone http://www.github.com/rhysd/committia.vim
    Subversion代码到本地:
    $ svn co --depth empty http://www.github.com/rhysd/committia.vim
    Checked out revision 1.
    $ cd repo
    $ svn up trunk
    
    提交消息时更愉快地编辑

    键入 git commit 时,Vim启动并打开提交缓冲区。 这个插件改进了提交缓冲区。

    committia.vim 将缓冲区拆分为 3 Windows ;编辑窗口,状态窗口和差异窗口。 你不再需要重复滚动并回到以前的位置,以便看到长期提交差异。 如果Vim窗口宽度太窄,( 默认 160个字符) 会返回到单个列模式,它有个 Windows ;编辑窗口和diff窗口。

    对于宽窗口:

    double column mode

    对于窄窗口:

    single column mode

    钩子

    你可以把 Windows 打开。

    可用钩子包括:

    • edit_open
    • diff_open
    • status_open

    下面是一个示例示例。

    " You can get the information about the windows with first argument as a dictionary."" KEY VALUE AVAILABILITY"-----------------------------------------------------------------------------------" vcs : vcs type (e.g. 'git') -> all hooks" edit_winnr : winnr of edit window -> ditto" edit_bufnr : bufnr of edit window -> ditto" diff_winnr : winnr of diff window -> ditto" diff_bufnr : bufnr of diff window -> ditto" status_winnr : winnr of status window -> all hooks except for 'diff_open' hook" status_bufnr : bufnr of status window -> dittoletg:committia_hooks= {}function!g:committia_hooks.edit_open(info)" Additional settingssetlocalspell" If no commit message, start with insert modeifa:info.vcs ==#'git'&&getline(1) ==#''startinsertend" Scroll the diff window from insert mode" Map <C-n> and <C-p>imap<buffer><C-n><Plug>(committia-scroll-diff-down-half)
     imap<buffer><C-p><Plug>(committia-scroll-diff-up-half)endfunction

    映射

    可以使用插入模式的滚动映射。

    • <Plug>(committia-scroll-diff-down-half)

    将差异窗口向下滚动一半。

    • <Plug>(committia-scroll-diff-up-half)

    将差异窗口向上滚动一半。

    • <Plug>(committia-scroll-diff-down-page)

    通过屏幕向下滚动diff窗口。

    • <Plug>(committia-scroll-diff-up-page)

    通过屏幕向上滚动diff窗口。

    变量

    一些变量可以用于控制 committia.vim.的行为

    • g:committia_open_only_vim_starting

    如果值为 0,则在打开 COMMIT_EDITMSG 缓冲区时,committia.vim 总是尝试打开committia的缓冲区。 如果你使用 ,我建议将这里值设置为。 默认值为 1

    • g:committia_use_singlecolumn

    如果该值为 'always',committia.vim 始终使用单个列模式。

    • g:committia_min_window_width

    如果窗口的宽度小于该值,则 committia.vim 使用单个列模式。 默认值为 160

    的未来

    捐赠

    许可证

    
    Copyright (c) 2014 rhysd
    
    
    
    Permission is hereby granted, free of charge, to any person obtaining a copy
    
    
    of this software and associated documentation files (the"Software"), to deal
    
    
    in the Software without restriction, including without limitation the rights
    
    
    to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
    
    
    of the Software, and to permit persons to whom the Software is furnished to do so,
    
    
    subject to the following conditions:
    
    
    
    The 上面 copyright notice and this permission notice shall be included in all
    
    
    copies or substantial portions of the Software.
    
    
    
    THE SOFTWARE IS PROVIDED"AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
    
    
    INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
    
    
    PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
    
    
    LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
    
    
    TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
    
    
    THE USE OR OTHER DEALINGS IN THE SOFTWARE.
    
    
    
    

    COM  plugin  COMM  EDI  VIM  Message  
    相关文章