All Projects → rhysd → Committia.vim

rhysd / Committia.vim

Licence: mit
A Vim plugin for more pleasant editing on commit messages

Projects that are alternatives of or similar to Committia.vim

Spacevim
Spacemacs for vim
Stars: ✭ 366 (-28.24%)
Mutual labels:  vim-plugin
Vim Pizza
My initial attempt at trying to order pizza from within vim.
Stars: ✭ 414 (-18.82%)
Mutual labels:  vim-plugin
Tmux Complete.vim
Vim plugin for insert mode completion of words in adjacent tmux panes
Stars: ✭ 447 (-12.35%)
Mutual labels:  vim-plugin
Sideways.vim
A Vim plugin to move function arguments (and other delimited-by-something items) left and right.
Stars: ✭ 370 (-27.45%)
Mutual labels:  vim-plugin
Vim Windowswap
Swap your windows without ruining your layout
Stars: ✭ 405 (-20.59%)
Mutual labels:  vim-plugin
Vim Startify
🔗 The fancy start screen for Vim.
Stars: ✭ 4,479 (+778.24%)
Mutual labels:  vim-plugin
Indentline
A vim plugin to display the indention levels with thin vertical lines
Stars: ✭ 3,681 (+621.76%)
Mutual labels:  vim-plugin
Vim Markdown Composer
An asynchronous markdown preview plugin for Vim and Neovim.
Stars: ✭ 501 (-1.76%)
Mutual labels:  vim-plugin
Nnn.vim
File manager for vim/neovim powered by n³
Stars: ✭ 414 (-18.82%)
Mutual labels:  vim-plugin
Nerdcommenter
Vim plugin for intensely nerdy commenting powers
Stars: ✭ 4,454 (+773.33%)
Mutual labels:  vim-plugin
Vim Plugins
Vim plug-ins which offer support for various programming languages.
Stars: ✭ 381 (-25.29%)
Mutual labels:  vim-plugin
Vim Cursorword
Underlines the word under the cursor
Stars: ✭ 401 (-21.37%)
Mutual labels:  vim-plugin
Vim Markdown Toc
A vim 7.4+ plugin to generate table of contents for Markdown files.
Stars: ✭ 427 (-16.27%)
Mutual labels:  vim-plugin
Barbar.nvim
A neovim tabline plugin.
Stars: ✭ 359 (-29.61%)
Mutual labels:  vim-plugin
Palenight.vim
Soothing color scheme for your favorite [best] text editor
Stars: ✭ 492 (-3.53%)
Mutual labels:  vim-plugin
Vim Iced
Clojure Interactive Development Environment for Vim8/Neovim
Stars: ✭ 343 (-32.75%)
Mutual labels:  vim-plugin
Rainbow levels.vim
A different approach to code highlighting.
Stars: ✭ 415 (-18.63%)
Mutual labels:  vim-plugin
Switch.vim
A simple Vim plugin to switch segments of text with predefined replacements
Stars: ✭ 506 (-0.78%)
Mutual labels:  vim-plugin
Vim Colors Pencil
Light (& dark) color scheme inspired by iA Writer
Stars: ✭ 498 (-2.35%)
Mutual labels:  vim-plugin
Vim Godebug
Go debugging for Vim
Stars: ✭ 437 (-14.31%)
Mutual labels:  vim-plugin

More Pleasant Editing on Commit Message

When you type git commit, Vim starts and opens a commit buffer. This plugin improves the commit buffer.

committia.vim splits the buffer into 3 windows; edit window, status window and diff window. You no longer need to repeat moving to another window, scrolling and backing to the former position in order to see a long commit diff.

If the width of Vim window is too narrow (160 characters by default), committia.vim falls back to single column mode, which has 2 windows; edit window and diff window.

For wide window:

double column mode

For narrow window:

single column mode

Hooks

You can hook on opening the windows.

Available hooks are:

  • edit_open: When opening a commit message window, this hook is called from the window.
  • diff_open: When opening a diff window, this hook is called from the window.
  • status_open: When opening a status window, this hook is called from the window. Please note that this hook is not called on single-column mode since it does not have a dedicated window for status.

A vimrc example is below.

" 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  -> ditto

let g:committia_hooks = {}
function! g:committia_hooks.edit_open(info)
    " Additional settings
    setlocal spell

    " If no commit message, start with insert mode
    if a:info.vcs ==# 'git' && getline(1) ==# ''
        startinsert
    endif

    " 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

Mappings

Mappings to scroll diff window for insert mode are available.

Mapping Description
<Plug>(committia-scroll-diff-down-half) Scroll down the diff window by half a screen.
<Plug>(committia-scroll-diff-up-half) Scroll up the diff window by half a screen.
<Plug>(committia-scroll-diff-down-page) Scroll down the diff window by a screen.
<Plug>(committia-scroll-diff-up-page) Scroll up the diff window by a screen.
<Plug>(committia-scroll-diff-down) Scroll down the diff window by one line.
<Plug>(committia-scroll-diff-up) Scroll up the diff window by one line.

Variables

Some variables are available to control the behavior of committia.vim.

g:committia_open_only_vim_starting (default: 1)

If the value is 0, committia.vim always attempts to open committia's buffer when COMMIT_EDITMSG buffer is opened. If you use vim-fugitive, I recommend to set this value to 1.

g:committia_use_singlecolumn (default: 'fallback')

If the value is 'always', committia.vim always employs single column mode.

g:committia_min_window_width (default: 160)

If the width of window is narrower than the value, committia.vim employs single column mode.

g:committia_status_window_opencmd (default: 'belowright split')

Vim command which opens a status window in multi-columns mode.

g:committia_diff_window_opencmd (default: 'botright vsplit')

Vim command which opens a diff window in multi-columns mode.

g:committia_singlecolumn_diff_window_opencmd (default: 'belowright split')

Vim command which opens a diff window in single-column mode.

g:committia_edit_window_width (default: 80)

If committia.vim is in multi-columns mode, specifies the width of the edit window.

Future

  • Cooperate with vim-fugitive.
  • Add more VCS supports
  • Test all features

Contribution

License

Distributed under the MIT license

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].