Repository: iberianpig/tig-explorer.vim Branch: master Commit: c134fa56ad46 Files: 7 Total size: 26.7 KB Directory structure: gitextract_2edlpo2e/ ├── LICENSE ├── README.md ├── autoload/ │ └── tig_explorer.vim ├── doc/ │ ├── tags │ └── tig-explorer.txt ├── plugin/ │ └── tig_explorer.vim └── script/ └── setup_tmp_tigrc.sh ================================================ FILE CONTENTS ================================================ ================================================ FILE: LICENSE ================================================ MIT License Copyright (c) 2017 Kohei Yamada 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 above 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. ================================================ FILE: README.md ================================================ # tig-explorer.vim [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![Vim](https://img.shields.io/badge/Vim-8.0+-green.svg)](https://www.vim.org/) [![Neovim](https://img.shields.io/badge/Neovim-0.3+-green.svg)](https://neovim.io/) Vim plugin to use [Tig](https://github.com/jonas/tig) as a git client. * Seamless switching between Vim and Tig * Adding buffer in the same process, not a child of Tig process. * Open files in tabs or vertically / horizontal split windows on Vim from Tig * Dynamically defining keymaps on Tig * Support Vim8 / NeoVim terminal * Open diff-mode side by side at the selected commit from Tig [![https://gyazo.com/181fef546cced7ca6dc651dff59cd1bf](https://i.gyazo.com/181fef546cced7ca6dc651dff59cd1bf.gif)](https://gyazo.com/181fef546cced7ca6dc651dff59cd1bf) ## Table of Contents - [Requirement](#requirement) - [Installation](#installation) - [Commands](#commands) - [Usage](#usage) - [Keymap on Tig](#keymap-on-tig) - [Customize Keymap on Tig](#customize-keymap-on-tig) - [Keymap on Vim](#keymap-on-vim) - [Configuration](#configuration) - [License](#license) ## Requirement * [tig](https://github.com/jonas/tig) ## Installation ### [lazy.nvim](https://github.com/folke/lazy.nvim) ```lua { 'iberianpig/tig-explorer.vim', dependencies = { 'rbgrouleff/bclose.vim' }, -- required for Neovim } ``` ### [packer.nvim](https://github.com/wbthomason/packer.nvim) ```lua use { 'iberianpig/tig-explorer.vim', requires = { 'rbgrouleff/bclose.vim' }, -- required for Neovim } ``` ### [vim-plug](https://github.com/junegunn/vim-plug) ```vim Plug 'iberianpig/tig-explorer.vim' Plug 'rbgrouleff/bclose.vim' " required for Neovim ``` **NOTE: If you use Neovim, you have to add the dependency to the plugin [bclose.vim](https://github.com/rbgrouleff/bclose.vim).** ## Commands | Command | Description | |---------|-------------| | `:Tig [args]` | Open Tig with optional arguments | | `:TigOpenCurrentFile` | Open Tig with the current file | | `:TigOpenProjectRootDir` | Open Tig at the project root directory | | `:TigGrep [pattern]` | Run Tig grep (prompts for pattern if omitted) | | `:TigGrepResume` | Resume the last Tig grep search | | `:TigBlame` | Open Tig blame for the current file | | `:TigStatus` | Open Tig status view | | `:TigOpenFileWithCommit [commit] [file] [lineno]` | Open a file at the specified commit in read-only mode | | `:TigOpenFileWithCommit! [commit] [file] [lineno]` | Open a file at the specified commit with diffsplit | ## Usage ### Keymap on Tig Following commands are available on Tig launched from tig-explorer. ``` e, : edit on existing tab : edit on new tab : edit with vsplit window : edit with split window o: open with commit on existing tab t: open with commit on new tab v: open with commit with vsplit window s: open with commit with split window ``` Keymaps are available in the main, blame, tree, and refs views. When opened with the commit, it opens in read-only mode. When opening with commit with split or vsplit, it will open with diffsplit. #### Customize Keymap on Tig tig-explorer.vim defines the following keymap by default ```vim let g:tig_explorer_keymap_edit_e = 'e' let g:tig_explorer_keymap_edit = '' let g:tig_explorer_keymap_tabedit = '' let g:tig_explorer_keymap_split = '' let g:tig_explorer_keymap_vsplit = '' let g:tig_explorer_keymap_commit_edit = 'o' let g:tig_explorer_keymap_commit_tabedit = 't' let g:tig_explorer_keymap_commit_split = 's' let g:tig_explorer_keymap_commit_vsplit = 'v' ``` ### Keymap on Vim Add following script to ~/.vimrc ```vim " open tig with current file nnoremap T :TigOpenCurrentFile " open tig with Project root path nnoremap t :TigOpenProjectRootDir " open tig grep nnoremap g :TigGrep " resume from last grep nnoremap r :TigGrepResume " open tig grep with the selected word vnoremap g y:TigGrep" " open tig grep with the word under the cursor nnoremap cg ::TigGrep " open tig blame with current file nnoremap b :TigBlame ``` ## Configuration ### Terminal By default, tig-explorer will use the built-in terminal if available. To force launching tig-explorer as a shell command, you can add the following to ~/.vimrc ```vim " don't use builtin terminal let g:tig_explorer_use_builtin_term=0 ``` On Gvim, only the built-in terminal is available. ### Custom tigrc If you have a custom tigrc file in a non-standard location, you can specify it: ```vim let g:tig_explorer_orig_tigrc='/path/to/your/tigrc' ``` By default, tig-explorer searches for your tigrc in the following order: 1. `$XDG_CONFIG_HOME/tig/config` 2. `~/.config/tig/config` 3. `~/.tigrc` 4. `/etc/tigrc` ## License [MIT](LICENSE) - Copyright (c) 2017 Kohei Yamada ================================================ FILE: autoload/tig_explorer.vim ================================================ "============================================================================= " File: tig_explorer.vim " Author: iberianpig " Created: 2017-04-03 "============================================================================= scriptencoding utf-8 if !exists('g:loaded_tig_explorer') finish endif let g:loaded_tig_explorer = 1 let s:save_cpo = &cpoptions set cpoptions&vim " Public function! tig_explorer#open(str, ...) abort let args = a:0 ? join(a:, ' ') : '' let command = s:strip_commit(a:str) . ' ' . args call s:exec_tig_command(command) endfunction function! tig_explorer#open_current_file() abort let current_path = expand('%:p') :call tig_explorer#open(current_path) endfunction function! tig_explorer#open_project_root_dir() abort try let root_dir = s:project_root_dir() catch echoerr 'tig-explorer.vim: ' . v:exception return endtry :call tig_explorer#open(root_dir) endfunction function! tig_explorer#grep(str) abort if a:str ==# '' let word = s:input('Pattern: ') else let word = a:str endif " if canceled if word ==# '0' return elseif word ==# '-1' return endif let g:tig_explorer_last_grep_keyword = word " NOTE: Escape shellwords if !get(g:, 'tig_explorer_use_builtin_term', has('terminal')) let args = s:shellwords(word) let escaped_word = '' for arg in args let escaped_word = join([escaped_word, shellescape(arg, 1)], ' ') endfor let word = escaped_word endif :call s:exec_tig_command('grep ' . word) endfunction function! tig_explorer#grep_resume() abort let keyword = get(g:, 'tig_explorer_last_grep_keyword', '') :call tig_explorer#grep(keyword) endfunction function! tig_explorer#blame() abort " extract the current commit if a path as the shape commit:file " which happend when using TigOpenWithCommit let parts = split(expand('%'), ':') if len(parts) == 2 let commit = parts[0] let file = parts[1] call s:exec_tig_command('blame ' . commit .' +' . line('.') . ' -- '. fnameescape(file)) else let root_dir = fnamemodify(s:project_root_dir(), ':p') let file = substitute(expand('%:p'), root_dir, "./", "") call s:exec_tig_command('blame +' . line('.') . ' ' . fnameescape(file)) endif endfunction function! tig_explorer#status() abort call s:exec_tig_command('status') endfunction " Open a file for the given commit " Usefull when editing file from tree or blame view function! tig_explorer#open_file_with_commit(diff, mods, commit, file, lineno) let commit = get(a:, 'commit', 'HEAD') let file = get(a:, 'file', '') let lineno = get(a:, 'lineno', 0) let file0 = '' " if no file is provided use the current one if file == '' let file0 = expand('%') let diff = 1 else let file0 = expand(file) endif " split commit file if needed echomsg file0 let parts = split(file0, ':') if len(parts) == 2 let commit = substitute(commit, '%', parts[0],'' ) let file = parts[1] else let file = parts[0] let commit = substitute(commit, '%', 'HEAD','') endif if a:diff == '!' diffthis endif let ref = commit . ":" . file echomsg ref if bufexists(ref) if a:diff == '!' execute a:mods "edit" ref else execute a:mods "split" ref endif else let ftype = &filetype if a:diff == '!' execute a:mods "new" else execute a:mods "enew" endif execute "file" ref let git_output = system('git show ' . ref) call setbufline(bufnr('%'), 1, split(git_output, '\n')) let &filetype = ftype setlocal nomodified setlocal nomodifiable setlocal readonly execute "+" lineno endif if a:diff == '!' diffthis endif endfunction " Private function! s:tig_available() abort if !executable('tig') echoerr 'You need to install tig.' return 0 endif return 1 endfunction function! s:initialize() abort function! s:set_orig_tigrc(path) abort if filereadable(expand(a:path)) let s:orig_tigrc=a:path return 1 "true endif return 0 "fail endfunction if exists('g:tig_explorer_orig_tigrc') let result = s:set_orig_tigrc(g:tig_explorer_orig_tigrc) else let result = s:set_orig_tigrc('$XDG_CONFIG_HOME/tig/config') || \ s:set_orig_tigrc('~/.config/tig/config') || \ s:set_orig_tigrc('~/.tigrc') || \ s:set_orig_tigrc('/etc/tigrc') endif if !result echomsg 'tig-explorer.vim: tigrc is not found' let s:orig_tigrc = tempname() "workaround exec 'silent ! touch ' . s:orig_tigrc endif let s:tmp_tigrc = tempname() let s:path_file = tempname() let s:keymap_edit_e = get(g:, 'tig_explorer_keymap_edit_e', 'e') let s:keymap_edit = get(g:, 'tig_explorer_keymap_edit', '') let s:keymap_tabedit = get(g:, 'tig_explorer_keymap_tabedit', '') let s:keymap_split = get(g:, 'tig_explorer_keymap_split', '') let s:keymap_vsplit = get(g:, 'tig_explorer_keymap_vsplit', '') let s:keymap_commit_edit = get(g:, 'tig_explorer_keymap_commit_edit', 'o') let s:keymap_commit_tabedit = get(g:, 'tig_explorer_keymap_commit_tabedit', 't') let s:keymap_commit_split = get(g:, 'tig_explorer_keymap_commit_split', 's') let s:keymap_commit_vsplit = get(g:, 'tig_explorer_keymap_commit_vsplit', 'v') let s:before_exec_tig = s:plugin_root . '/script/setup_tmp_tigrc.sh' \ . ' ' . s:orig_tigrc \ . ' ' . s:tmp_tigrc \ . ' ' . s:path_file \ . ' "' . s:keymap_edit_e . '"' \ . ' "' . s:keymap_edit . '"' \ . ' "' . s:keymap_tabedit . '"' \ . ' "' . s:keymap_split . '"' \ . ' "' . s:keymap_vsplit . '"' \ . ' "' . s:keymap_commit_edit . '"' \ . ' "' . s:keymap_commit_tabedit . '"' \ . ' "' . s:keymap_commit_split . '"' \ . ' "' . s:keymap_commit_vsplit . '"' let s:tig_prefix = 'TIGRC_USER=' . s:tmp_tigrc . ' ' endfunction function! s:tig_callback(exit_code) abort if a:exit_code == 0 if has('nvim') silent! Bclose! else let current_buf = bufnr('%') silent! buffer # " NOTE: Prevent to quit vim if winnr('$') == 1 && bufnr('%') ==# current_buf enew endif endif endif try call s:open_file() endtry endfunction function! s:exec_tig_command(tig_args) abort if !s:tig_available() return endif let current_dir = getcwd() try let root_dir = s:project_root_dir() catch echoerr 'tig-explorer.vim: ' . v:exception return endtry " NOTE: It MUST execute tig command from project root " TigBlame or Edit are broken if execute from a relative path execute 'lcd ' . fnamemodify(root_dir, ':p') if !filewritable(root_dir . '/.git') echoerr(".git is not writable") return endif let command = s:tig_prefix . 'tig' . ' ' . a:tig_args exec 'silent !' . s:before_exec_tig if has('nvim') enew call termopen(command, { \ 'name': 'tig', \ 'on_exit': {job_id, code, event -> s:tig_callback(code)}, \ }) startinsert elseif has('gui_running') && has('terminal') || get(g:, 'tig_explorer_use_builtin_term', has('terminal')) call term_start('env ' . command, { \ 'term_name': 'tig', \ 'curwin': v:true, \ 'term_rows' : winheight('%'), \ 'term_cols' : winwidth('%'), \ 'term_finish': 'close', \ 'exit_cb': {status, code -> s:tig_callback(code)}, \ }) else exec 'silent !' . command call s:open_file() endif " NOTE: Back to current_dir execute 'lcd ' . fnamemodify(current_dir, ':p') redraw! endfunction function! s:open_file() abort if !filereadable(s:path_file) return endif let current_dir = getcwd() try execute 'lcd ' . fnamemodify(s:project_root_dir(), ':p') for f in readfile(s:path_file) exec f endfor finally call delete(s:path_file) execute 'lcd ' . fnamemodify(current_dir, ':p') endtry endfunction function! s:project_root_dir() abort let l:current_file_dir = expand('%:p:h') let l:git_dir = findfile('.git', l:current_file_dir . ';') if l:git_dir ==# '' let l:git_dir = finddir('.git', l:current_file_dir . ';') if l:git_dir ==# '' throw 'Not a git repository: ' . l:current_file_dir endif " git submodule let l:git_module_dir = finddir('modules', l:current_file_dir . ';') if l:git_module_dir !=# '' let l:git_module_dir_git = finddir('.git', fnamemodify(l:git_module_dir, ':p') . ';') if fnamemodify(l:git_module_dir_git, ':p') ==# fnamemodify(l:git_dir, ':p') let l:git_submodule_index = findfile('index', l:current_file_dir . ';') if l:git_submodule_index !=# '' let l:git_submodule_dir = fnamemodify(l:git_submodule_index, ':p:h') let l:git_submodule_workdir = trim(system('cd ' . shellescape(l:git_submodule_dir) . ' && git config --get core.worktree')) if l:git_submodule_workdir !=# '' let l:git_submodule_workdir = glob(l:git_submodule_dir . '/' . l:git_submodule_workdir) if isdirectory(l:git_submodule_workdir) return l:git_submodule_workdir endif endif endif endif endif endif " git repository if isdirectory(l:git_dir) let l:root_dir = fnamemodify(l:git_dir, ':p:h:h') else let l:root_dir = fnamemodify(l:git_dir, ':p:h') endif if !isdirectory(l:root_dir) return l:current_file_dir endif return l:root_dir endfunction function! s:shellwords(str) abort "make list by splitting the string by whitespace let words = split(a:str, '\%(\([^ \t\''"]\+\)\|''\([^\'']*\)''\|"\(\%([^\"\\]\|\\.\)*\)"\)\zs\s*\ze') let words = map(words, 'substitute(v:val, ''\\\([\\ ]\)'', ''\1'', "g")') let words = map(words, 'matchstr(v:val, ''^\%\("\zs\(.*\)\ze"\|''''\zs\(.*\)\ze''''\|.*\)$'')') return words endfunction " return 0 () or -1 () function! s:input(...) abort new cnoremap __CANCELED__ try let input = call('input', a:000) if input =~ '__CANCELED__' call histdel('input', -1) let input = 0 endif catch /^Vim:Interrupt$/ let input = -1 finally bwipeout! redraw! return input endtry endfunction function! s:strip_commit(path) return substitute(a:path, '^[^:]*:','','') endfunction " Initialize " NOTE: '' must be called top level let s:plugin_root=expand(':p:h:h') call s:initialize() let &cpoptions = s:save_cpo unlet s:save_cpo ================================================ FILE: doc/tags ================================================ :TigBlame tig-explorer.txt /*:TigBlame* :TigGrep tig-explorer.txt /*:TigGrep* :TigGrepResume tig-explorer.txt /*:TigGrepResume* :TigOpenCurrentFile tig-explorer.txt /*:TigOpenCurrentFile* :TigOpenProjectRootDir tig-explorer.txt /*:TigOpenProjectRootDir* tig-explorer-commands tig-explorer.txt /*tig-explorer-commands* tig-explorer-contents tig-explorer.txt /*tig-explorer-contents* tig-explorer-customize tig-explorer.txt /*tig-explorer-customize* tig-explorer-install tig-explorer.txt /*tig-explorer-install* tig-explorer-introduction tig-explorer.txt /*tig-explorer-introduction* tig-explorer-keymaps tig-explorer.txt /*tig-explorer-keymaps* tig-explorer-requirements tig-explorer.txt /*tig-explorer-requirements* tig-explorer-support tig-explorer.txt /*tig-explorer-support* tig-explorer.txt tig-explorer.txt /*tig-explorer.txt* ================================================ FILE: doc/tig-explorer.txt ================================================ *tig-explorer.txt* Plugin to use Tig as a git client. ============================================================================== CONTENTS *tig-explorer-contents* - Introduction |tig-explorer-introduction| - Requirements |tig-explorer-requirements| - Install |tig-explorer-install| - Commands |tig-explorer-commands| - Keymaps |tig-explorer-keymaps| - Customize |tig-explorer-customize| - Support |tig-explorer-support| ============================================================================== INTRODUCTION *tig-explorer-introduction* This plugins supports: - Seamless switching between Vim and Tig - Adding buffer in the same process not a child of Tig process. - Open files in tabs or in vertically/horizontal split windows on Vim from Tig - Dynamically defining keymaps on Tig ============================================================================== REQUIREMENTS *tig-explorer-requirements* - tig (https://github.com/jonas/tig) ============================================================================== INSTALL *tig-explorer-install* By vim-plug: > Plug 'iberianpig/tig-explorer.vim' < By NeoBundle: > NeoBundle 'iberianpig/tig-explorer.vim' < If you use Neovim, you have to add the dependency to the plugin bclose.vim: By vim-plug: > Plug 'rbgrouleff/bclose.vim' < By NeoBundle: > NeoBundle 'rbgrouleff/bclose.vim' < ============================================================================== COMMANDS *tig-explorer-commands* Add following script to ~/.vimrc TigOpenCurrentFile *:TigOpenCurrentFile* Open tig with current file TigOpenProjectRootDir *:TigOpenProjectRootDir* Open tig with Project root path TigGrep *:TigGrep* Open tig grep. And you can pass PATTERN like `:TigGrep (PATTERN)` to grep with the PATTERN. TigGrepResume *:TigGrepResume* Resume from last grep TigBlame *:TigBlame* Open tig blame with current file TigOpenFileWithCommit Open a file at the given commit. `:TigOpenWithCommit COMMIT FILE LINEO` All arguments are optional. If FILE contains `%` and `FILE` is contains so commit information. The `%` in the commit will be replaced with the original commit. For example `:TigOpenWithCommit %~` open the previous version of the current file. This file will be called `HEAD~:file`. Calling `:TigOpenFileWithCommit %~` again will open the previous version of the previous version (`HEAD~~`). TigOpenFileWithCommit! Like TigOpenFileWithCommit but show the diff between the current buffer and the resulting buffer. For example, `:vertical TigOpenFileWithCommit! HEAD` set a side by side diff between the current buffer and its HEAD version. ============================================================================== KEYMAPS *tig-explorer-keymaps* Following commands are available on tig launched from tig-explorer e, : edit on existing tab : edit on new tab : edit with split window : edit with vsplit window o: open with commit on existing tab t: open with commit on new tab v: open with commit with vsplit window s: open with commit with split window When a commit is available (in main, blame, tree, refs view) view, the version of the file corresponding to this commit will be open instead of the version in the working directory. Split versions will open the two buffer in diff mode. ============================================================================== CUSTOMIZE *tig-explorer-customize* Keymaps can be cusotmized by following variables. Following keymap is defined as defaut > let g:tig_explorer_keymap_edit_e = 'e' let g:tig_explorer_keymap_edit = '' let g:tig_explorer_keymap_tabedit = '' let g:tig_explorer_keymap_split = '' let g:tig_explorer_keymap_vsplit = '' < And you can add following script to ~/.vimrc > " open tig with current file nnoremap T :TigOpenCurrentFile " open tig with Project root path nnoremap t :TigOpenProjectRootDir " open tig grep nnoremap g :TigGrep " resume from last grep nnoremap r :TigGrepResume " open tig grep with the selected word vnoremap g :TigGrep" " open tig grep with the word under the cursor nnoremap cg ::TigGrep " open tig blame with current file nnoremap b :TigBlame < By default tig-explorer will use the builtin terminal if available. To force launching tig-explorer as shell command you can add the following to ~/.vimrc > " don't use builtin terminal let g:tig_explorer_use_builtin_term=0 < ============================================================================== SUPPORT *tig-explorer-support* https://www.patreon.com/iberianpig vim:textwidth=78:tabstop=4:shiftwidth=4:expandtab:filetype=help:norl: ================================================ FILE: plugin/tig_explorer.vim ================================================ "============================================================================= " File: tig_explorer.vim " Author: iberianpig " Created: 2017-04-03 "============================================================================= scriptencoding utf-8 if exists('g:loaded_tig_explorer') finish endif let g:loaded_tig_explorer = 1 let s:save_cpo = &cpoptions set cpoptions&vim command! -nargs=? Tig \ call tig_explorer#open() command! TigOpenCurrentFile \ call tig_explorer#open_current_file() command! TigOpenProjectRootDir \ call tig_explorer#open_project_root_dir() command! -nargs=? TigGrep \ call tig_explorer#grep() command! TigBlame \ call tig_explorer#blame() command! TigGrepResume \ call tig_explorer#grep_resume() command! TigStatus \ call tig_explorer#status() command! -bang -nargs=* TigOpenFileWithCommit \ call tig_explorer#open_file_with_commit("",,) let &cpoptions = s:save_cpo unlet s:save_cpo ================================================ FILE: script/setup_tmp_tigrc.sh ================================================ #!/bin/sh if [ $# -ne 12 ]; then echo "require 12 argument" exit 1 fi orig_tigrc=$1 tmp_tigrc=$2 path_file=$3 keymap_edit_e=$4 keymap_edit=$5 keymap_tabedit=$6 keymap_split=$7 keymap_vsplit=$8 keymap_commit_edit=$9 keymap_commit_tabedit=${10} keymap_commit_split=${11} keymap_commit_vsplit=${12} # make temporary tigrc cp "$orig_tigrc" "$tmp_tigrc" # Overwriting temporary tigrc add_custom_cmd() { view=$1 keymap=$2 cmd=$3 echo "bind $view $keymap $path_file\"" >> "$tmp_tigrc" } add_current_with_commit_cmd() { view=$1 keymap=$2 cmd=$3 echo "bind $view $keymap $path_file\"" >> "$tmp_tigrc" } add_selected_with_commit_cmd() { view=$1 keymap=$2 cmd=$3 echo "bind $view $keymap $path_file\"" >> "$tmp_tigrc" } if [ $keymap_edit_e != "" ]; then add_custom_cmd "generic" "$keymap_edit_e" "edit" fi add_custom_cmd "generic" "$keymap_edit" "edit" add_custom_cmd "generic" "$keymap_tabedit" "tabedit" add_custom_cmd "generic" "$keymap_split" "split" add_custom_cmd "generic" "$keymap_vsplit" "vsplit" add_current_with_commit_cmd "refs" "$keymap_commit_edit" "TigOpenFileWithCommit" add_current_with_commit_cmd "refs" "$keymap_commit_tabedit" "tab TigOpenFileWithCommit" add_current_with_commit_cmd "refs" "$keymap_commit_split" "TigOpenFileWithCommit!" add_current_with_commit_cmd "refs" "$keymap_commit_vsplit" "vertical TigOpenFileWithCommit!" add_current_with_commit_cmd "main" "$keymap_commit_edit" "TigOpenFileWithCommit" add_current_with_commit_cmd "main" "$keymap_commit_tabedit" "tab TigOpenFileWithCommit" add_current_with_commit_cmd "main" "$keymap_commit_split" "TigOpenFileWithCommit!" add_current_with_commit_cmd "main" "$keymap_commit_vsplit" "vertical TigOpenFileWithCommit!" add_selected_with_commit_cmd "blame" "$keymap_commit_edit" "TigOpenFileWithCommit" add_selected_with_commit_cmd "blame" "$keymap_commit_tabedit" "tab TigOpenFileWithCommit" add_selected_with_commit_cmd "blame" "$keymap_commit_split" "TigOpenFileWithCommit!" add_selected_with_commit_cmd "blame" "$keymap_commit_vsplit" "vertical TigOpenFileWithCommit!" add_selected_with_commit_cmd "diff" "$keymap_commit_edit" "TigOpenFileWithCommit" add_selected_with_commit_cmd "diff" "$keymap_commit_tabedit" "tab TigOpenFileWithCommit" add_selected_with_commit_cmd "diff" "$keymap_commit_split" "TigOpenFileWithCommit!" add_selected_with_commit_cmd "diff" "$keymap_commit_vsplit" "vertical TigOpenFileWithCommit!" add_selected_with_commit_cmd "tree" "$keymap_commit_edit" "TigOpenFileWithCommit" add_selected_with_commit_cmd "tree" "$keymap_commit_tabedit" "tab TigOpenFileWithCommit" add_selected_with_commit_cmd "tree" "$keymap_commit_split" "TigOpenFileWithCommit!" add_selected_with_commit_cmd "tree" "$keymap_commit_vsplit" "vertical TigOpenFileWithCommit!"