├── .github └── workflows │ └── reviewdog.yml ├── LICENSE ├── README.md ├── autoload ├── fern_git_status.vim └── fern_git_status │ ├── investigator.vim │ └── process.vim ├── doc ├── .gitignore └── fern-git-status.txt └── plugin └── fern_git_status.vim /.github/workflows/reviewdog.yml: -------------------------------------------------------------------------------- 1 | name: reviewdog 2 | 3 | on: 4 | push: 5 | branches: 6 | - master 7 | pull_request: 8 | branches: 9 | - master 10 | 11 | jobs: 12 | vimlint: 13 | name: runner / vint 14 | runs-on: ubuntu-latest 15 | steps: 16 | - uses: actions/checkout@v2 17 | - name: vint 18 | uses: reviewdog/action-vint@v1 19 | with: 20 | github_token: ${{ secrets.github_token }} 21 | level: error 22 | reporter: github-pr-review 23 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2020 Alisue, hashnote.net 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all 11 | copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | SOFTWARE. 20 | 21 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # fern-git-status.vim 2 | 3 | [![fern renderer](https://img.shields.io/badge/🌿%20fern-plugin-yellowgreen)](https://github.com/lambdalisue/fern.vim) 4 | ![Support Vim 8.1 or above](https://img.shields.io/badge/support-Vim%208.1%20or%20above-yellowgreen.svg) 5 | ![Support Neovim 0.4 or above](https://img.shields.io/badge/support-Neovim%200.4%20or%20above-yellowgreen.svg) 6 | ![Support Git 2.25 or above](https://img.shields.io/badge/support-Git%202.25%20or%20above-green.svg) 7 | [![MIT License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE) 8 | [![Doc](https://img.shields.io/badge/doc-%3Ah%20fern--git--status-orange.svg)](doc/fern-git-status.txt) 9 | 10 | [![reviewdog](https://github.com/lambdalisue/fern-git-status.vim/workflows/reviewdog/badge.svg)](https://github.com/lambdalisue/fern-git-status.vim/actions?query=workflow%3Areviewdog) 11 | 12 | fern-git-status is a [fern.vim][] plugin to add git status on node's badge asynchronously like: 13 | 14 | ![fern-git-status](https://user-images.githubusercontent.com/546312/89777703-2483cd80-db47-11ea-84dc-7690d2996d89.png) 15 | 16 | [fern.vim]: https://github.com/lambdalisue/fern.vim 17 | 18 | ## Usage 19 | 20 | Just install the plugin and visit a git repository which has some dirty status. 21 | 22 | ## Status 23 | 24 | The plugin shows status of nodes as [short format of git status](https://git-scm.com/docs/git-status#_short_format) like: 25 | 26 | ``` 27 | X Y Meaning 28 | ------------------------------------------------- 29 | [AMD] not updated 30 | M [ MD] updated in index 31 | A [ MD] added to index 32 | D deleted from index 33 | R [ MD] renamed in index 34 | C [ MD] copied in index 35 | [MARC] index and work tree matches 36 | [ MARC] M work tree changed since index 37 | [ MARC] D deleted in work tree 38 | [ D] R renamed in work tree 39 | [ D] C copied in work tree 40 | ------------------------------------------------- 41 | D D unmerged, both deleted 42 | A U unmerged, added by us 43 | U D unmerged, deleted by them 44 | U A unmerged, added by them 45 | D U unmerged, deleted by us 46 | A A unmerged, both added 47 | U U unmerged, both modified 48 | ------------------------------------------------- 49 | ? ? untracked 50 | ! ! ignored 51 | ------------------------------------------------- 52 | ``` 53 | 54 | The status of directory indicates that the directory contains index (left) or work tree (right) changes. 55 | For example, single `-` on right side means that the directory contains some work tree changes but index changes. 56 | 57 | ## Colors 58 | 59 | See `:help fern-git-status-highlight` to customize the colors. 60 | 61 | ## Performance 62 | 63 | Disable the following options one by one if you encounter performance issues. 64 | 65 | ```vim 66 | " Disable listing ignored files/directories 67 | let g:fern_git_status#disable_ignored = 1 68 | 69 | " Disable listing untracked files 70 | let g:fern_git_status#disable_untracked = 1 71 | 72 | " Disable listing status of submodules 73 | let g:fern_git_status#disable_submodules = 1 74 | 75 | " Disable listing status of directories 76 | let g:fern_git_status#disable_directories = 1 77 | ``` 78 | 79 | :rocket: For large repositories it is also recommended to enable the Git (2.24+) 80 | [manyFiles 81 | feature](https://git-scm.com/docs/git-config#Documentation/git-config.txt-featuremanyFiles) 82 | in the working directory as follows: 83 | 84 | ```sh 85 | git config feature.manyFiles true 86 | ``` 87 | 88 | ## See also 89 | 90 | - [fern-mapping-git.vim](https://github.com/lambdalisue/fern-mapping-git.vim) - Add git related mappings 91 | -------------------------------------------------------------------------------- /autoload/fern_git_status.vim: -------------------------------------------------------------------------------- 1 | let s:CancellationToken = vital#fern#import('Async.CancellationToken') 2 | let s:PROCESSING_VARNAME = 'fern_git_status_processing' 3 | 4 | function! fern_git_status#init() abort 5 | if exists('s:ready') 6 | return 7 | endif 8 | let s:ready = 1 9 | call fern#hook#add('viewer:highlight', function('s:on_highlight')) 10 | call fern#hook#add('viewer:syntax', function('s:on_syntax')) 11 | call fern#hook#add('viewer:redraw', function('s:on_redraw')) 12 | endfunction 13 | 14 | function! s:on_highlight(...) abort 15 | highlight default link FernGitStatusBracket Comment 16 | highlight default link FernGitStatusIndex Special 17 | highlight default link FernGitStatusWorktree WarningMsg 18 | highlight default link FernGitStatusUnmerged ErrorMsg 19 | highlight default link FernGitStatusUntracked Comment 20 | highlight default link FernGitStatusIgnored Comment 21 | endfunction 22 | 23 | function! s:on_syntax(...) abort 24 | syntax match FernGitStatusBracket /.*/ contained containedin=FernBadge 25 | syntax match FernGitStatus /\[\zs..\ze\]/ contained containedin=FernGitStatusBracket 26 | syntax match FernGitStatusIndex /./ contained containedin=FernGitStatus nextgroup=FernGitStatusWorktree 27 | syntax match FernGitStatusWorktree /./ contained 28 | 29 | syntax match FernGitStatusUnmerged /DD\|AU\|UD\|UA\|DU\|AA\|UU/ contained containedin=FernGitStatus 30 | 31 | syntax match FernGitStatusUntracked /??/ contained containedin=FernGitStatus 32 | syntax match FernGitStatusIgnored /!!/ contained containedin=FernGitStatus 33 | endfunction 34 | 35 | function! s:on_redraw(helper) abort 36 | let bufnr = a:helper.bufnr 37 | let processing = getbufvar(bufnr, s:PROCESSING_VARNAME, 0) 38 | if a:helper.fern.scheme !=# 'file' || processing 39 | return 40 | endif 41 | let options = { 42 | \ 'include_ignored': !g:fern_git_status#disable_ignored, 43 | \ 'include_untracked': !g:fern_git_status#disable_untracked, 44 | \ 'include_submodules': !g:fern_git_status#disable_submodules, 45 | \ 'include_directories': !g:fern_git_status#disable_directories, 46 | \ 'indexed_character': g:fern_git_status#indexed_character, 47 | \ 'stained_character': g:fern_git_status#stained_character, 48 | \ 'indexed_patterns': g:fern_git_status#indexed_patterns, 49 | \ 'stained_patterns': g:fern_git_status#stained_patterns, 50 | \} 51 | call fern_git_status#investigator#investigate(a:helper, options) 52 | \.then({ m -> fern#logger#tap(m) }) 53 | \.then({ m -> map(a:helper.fern.visible_nodes, { -> s:update_node(m, v:val) }) }) 54 | \.then({ -> s:redraw(a:helper) }) 55 | \.catch({ e -> s:handle_error(e) }) 56 | endfunction 57 | 58 | function! s:update_node(status_map, node) abort 59 | let path = fern#internal#filepath#to_slash(a:node._path) 60 | let status = get(a:status_map, path, '') 61 | let a:node.badge = status ==# '' ? '' : printf(' [%s]', status) 62 | return a:node 63 | endfunction 64 | 65 | function! s:redraw(helper) abort 66 | let bufnr = a:helper.bufnr 67 | call setbufvar(bufnr, s:PROCESSING_VARNAME, 1) 68 | return a:helper.async.redraw() 69 | \.then({ -> setbufvar(bufnr, s:PROCESSING_VARNAME, 0)}) 70 | endfunction 71 | 72 | function! s:handle_error(err) abort 73 | if type(a:err) is# v:t_string 74 | if a:err ==# s:CancellationToken.CancelledError 75 | return 76 | elseif a:err =~# '^fatal: not a git repository' 77 | return 78 | endif 79 | endif 80 | call fern#logger#error(a:err) 81 | endfunction 82 | 83 | let g:fern_git_status#disable_ignored = get(g:, 'fern_git_status#disable_ignored', 0) 84 | let g:fern_git_status#disable_untracked = get(g:, 'fern_git_status#disable_untracked', 0) 85 | let g:fern_git_status#disable_submodules = get(g:, 'fern_git_status#disable_submodules', 0) 86 | let g:fern_git_status#disable_directories = get(g:, 'fern_git_status#disable_directories', 0) 87 | let g:fern_git_status#indexed_character = get(g:, 'fern_git_status#indexed_character', '-') 88 | let g:fern_git_status#stained_character = get(g:, 'fern_git_status#stained_character', '-') 89 | let g:fern_git_status#indexed_patterns = get(g:, 'fern_git_status#indexed_patterns', [ 90 | \ '[MARC][ MD]', 91 | \ 'D[ RC]', 92 | \]) 93 | let g:fern_git_status#stained_patterns = get(g:, 'fern_git_status#stained_patterns', [ 94 | \ '[ MARC][MD]', 95 | \ '[ D][RC]', 96 | \ 'DD\|AU\|UD\|UA\|DU\|AA\|UU', 97 | \ '??', 98 | \]) 99 | -------------------------------------------------------------------------------- /autoload/fern_git_status/investigator.vim: -------------------------------------------------------------------------------- 1 | let s:Promise = vital#fern#import('Async.Promise') 2 | let s:Lambda = vital#fern#import('Lambda') 3 | let s:AsyncLambda = vital#fern#import('Async.Lambda') 4 | let s:CancellationToken = vital#fern#import('Async.CancellationToken') 5 | let s:CancellationTokenSource = vital#fern#import('Async.CancellationTokenSource') 6 | 7 | let s:GET_TOPLEVEL_CACHE_VARNAME = 'fern_git_status_get_toplevel_cache' 8 | let s:GET_STATUS_SOURCE_VARNAME = 'fern_git_status_get_status_source' 9 | 10 | function! fern_git_status#investigator#investigate(helper, options) abort 11 | let options = extend({ 12 | \ 'include_directories': 0, 13 | \}, a:options, 14 | \) 15 | let toplevel = s:get_toplevel(a:helper) 16 | let status = s:get_status(a:helper, options) 17 | if options.include_directories 18 | let status = status.then(funcref('s:complete_directories', [options])) 19 | endif 20 | return s:Promise.all([toplevel, status]) 21 | \.then({ v -> call('s:prepend_toplevel', v) }) 22 | \.then({ v -> s:dict_from_entries(v) }) 23 | endfunction 24 | 25 | function! s:get_toplevel(helper) abort 26 | " Prefer cache while fern buffer is unique for the root directory 27 | let bufnr = a:helper.bufnr 28 | let cache = getbufvar(bufnr, s:GET_TOPLEVEL_CACHE_VARNAME, v:null) 29 | if cache isnot# v:null 30 | return cache 31 | endif 32 | " No cache exist, create a promise to resolve git toplevel 33 | let root = a:helper.fern.root._path 34 | let token = s:CancellationToken.none 35 | let p = fern_git_status#process#show_toplevel(root, token) 36 | call setbufvar(bufnr, s:GET_TOPLEVEL_CACHE_VARNAME, p) 37 | return p 38 | endfunction 39 | 40 | function! s:get_status(helper, options) abort 41 | let options = extend({ 42 | \ 'include_ignored': 0, 43 | \ 'include_untracked': 0, 44 | \ 'include_submodules': 0, 45 | \}, a:options, 46 | \) 47 | " Cancel previous processs and save token source 48 | let bufnr = a:helper.bufnr 49 | let source = getbufvar(bufnr, s:GET_STATUS_SOURCE_VARNAME, { 'cancel': { -> 0 } }) 50 | call source.cancel() 51 | let source = s:CancellationTokenSource.new() 52 | call setbufvar(bufnr, s:GET_STATUS_SOURCE_VARNAME, source) 53 | " Return a process to get git status 54 | let root = a:helper.fern.root._path 55 | let paths = map(copy(a:helper.fern.visible_nodes), { -> v:val._path }) 56 | let token = source.token 57 | return fern_git_status#process#status(root, token, { 58 | \ 'paths': paths, 59 | \ 'include_ignored': options.include_ignored, 60 | \ 'include_untracked': options.include_untracked, 61 | \ 'include_submodules': options.include_submodules, 62 | \}) 63 | endfunction 64 | 65 | function! s:prepend_toplevel(toplevel, statuses) abort 66 | " return map(a:statuses, { _, v -> [a:toplevel . '/' . v[0], v[1]] }) 67 | let Profile = fern#profile#start('fern_git_status#investigator#s:prepend_toplevel') 68 | return s:AsyncLambda.map(a:statuses, { v -> [a:toplevel . '/' . v[0], v[1]] }) 69 | \.finally({ -> Profile() }) 70 | endfunction 71 | 72 | function! s:dict_from_entries(entries) abort 73 | let m = {} 74 | " call map(a:entries, { _, v -> s:Lambda.let(m, v[0], v[1]) }) 75 | " return m 76 | let Profile = fern#profile#start('fern_git_status#investigator#s:dict_from_entries') 77 | return s:AsyncLambda.map(a:entries, { v -> s:Lambda.pass(v, s:Lambda.let(m, v[0], v[1])) }) 78 | \.then({ -> m }) 79 | \.finally({ -> Profile() }) 80 | endfunction 81 | 82 | function! s:complete_directories(options, statuses) abort 83 | let options = extend({ 84 | \ 'indexed_character': '-', 85 | \ 'stained_character': '-', 86 | \ 'indexed_patterns': [], 87 | \ 'stained_patterns': [], 88 | \}, a:options, 89 | \) 90 | let imap = {} 91 | let smap = {} 92 | let indexed_character = options.indexed_character 93 | let stained_character = options.stained_character 94 | let indexed_pattern = printf('^\%%(%s\)$', join(a:options.indexed_patterns, '\|')) 95 | let stained_pattern = printf('^\%%(%s\)$', join(a:options.stained_patterns, '\|')) 96 | let Profile = fern#profile#start('fern_git_status#investigator#s:complete_directories') 97 | try 98 | for [relpath, status] in a:statuses 99 | let dirpath = fern#internal#path#dirname(relpath) 100 | if status =~# indexed_pattern 101 | let path = dirpath 102 | while path !=# '' && !has_key(imap, path) 103 | let imap[path] = indexed_character 104 | let path = fern#internal#path#dirname(path) 105 | endwhile 106 | endif 107 | if status =~# stained_pattern 108 | let path = dirpath 109 | while path !=# '' && !has_key(smap, path) 110 | let smap[path] = stained_character 111 | let path = fern#internal#path#dirname(path) 112 | endwhile 113 | endif 114 | endfor 115 | let directory_statuses = map( 116 | \ uniq(sort(keys(imap) + keys(smap))), 117 | \ { _, v -> [v, printf('%s%s', get(imap, v, ' '), get(smap, v, ' '))] }, 118 | \) 119 | return extend(a:statuses, directory_statuses) 120 | finally 121 | call Profile() 122 | endtry 123 | endfunction 124 | -------------------------------------------------------------------------------- /autoload/fern_git_status/process.vim: -------------------------------------------------------------------------------- 1 | let s:Promise = vital#fern#import('Async.Promise') 2 | let s:Process = vital#fern#import('Async.Promise.Process') 3 | let s:AsyncLambda = vital#fern#import('Async.Lambda') 4 | 5 | 6 | function! fern_git_status#process#show_toplevel(root, token) abort 7 | let args = ['git', '-C', a:root, 'rev-parse', '--show-toplevel'] 8 | let Profile = fern#profile#start('fern_git_status#process#show_toplevel') 9 | return s:Process.start(args, { 10 | \ 'token': a:token, 11 | \ 'reject_on_failure': v:true, 12 | \}) 13 | \.catch({e -> s:Promise.reject(s:normalize_error(e)) }) 14 | \.then({v -> join(v.stdout, '') }) 15 | \.then({v -> s:normalize_path(v, a:token) }) 16 | \.finally({ -> Profile() }) 17 | endfunction 18 | 19 | function! fern_git_status#process#status(root, token, options) abort 20 | let options = extend({ 21 | \ 'paths': [], 22 | \ 'include_ignored': 0, 23 | \ 'include_untracked': 0, 24 | \ 'include_submodules': 0, 25 | \}, a:options, 26 | \) 27 | let args = [ 28 | \ 'git', '-C', a:root, 'status', '--porcelain', 29 | \ options.include_ignored 30 | \ ? options.include_untracked 31 | \ ? '--ignored=matching' 32 | \ : '--ignored=traditional' 33 | \ : '--ignored=no', 34 | \ options.include_untracked ? '-uall' : '-uno', 35 | \ options.include_submodules 36 | \ ? '--ignore-submodules=none' 37 | \ : '--ignore-submodules=all', 38 | \] 39 | let args = args + ['--'] + options.paths 40 | let args = filter(args, '!empty(v:val)') 41 | 42 | let Profile = fern#profile#start('fern_git_status#process#status') 43 | return s:Process.start(args, { 44 | \ 'toekn': a:token, 45 | \ 'reject_on_failure': v:true, 46 | \}) 47 | \.catch({e -> s:Promise.reject(s:normalize_error(e)) }) 48 | \.then({ v -> v.stdout }) 49 | \.then(s:AsyncLambda.filter_f({ v -> v !=# '' })) 50 | \.then(s:AsyncLambda.map_f({ v -> s:parse_status(v, a:token) })) 51 | \.then({ v -> s:Promise.all(v) }) 52 | \.finally({ -> Profile() }) 53 | endfunction 54 | 55 | function! s:normalize_error(error) abort 56 | if type(a:error) is# v:t_dict && has_key(a:error, 'stderr') 57 | return join(a:error.stderr, "\n") 58 | endif 59 | return a:error 60 | endfunction 61 | 62 | function! s:parse_status(record, token) abort 63 | let status = a:record[:1] 64 | let relpath = split(a:record[3:], ' -> ')[-1] 65 | let relpath = relpath[-1:] ==# '/' ? relpath[:-2] : relpath 66 | return s:normalize_path(relpath, a:token) 67 | \.then({ v -> [v, status] }) 68 | endfunction 69 | 70 | " NOTE: 71 | " Git for Windows return slash separated path but the path is 72 | " not compatible with fern's slash separated path so normalization 73 | " is required 74 | if has('win32') 75 | function! s:normalize_path(path, token) abort 76 | if a:path[:0] ==# '/' && executable('cygpath') 77 | " msys2 78 | return s:Process.start(['cygpath', '-w', a:path], { 79 | \ 'token': a:token, 80 | \ 'reject_on_failure': v:true, 81 | \}) 82 | \.then({v -> join(v.stdout, '') }) 83 | \.catch({e -> s:Promise.reject(s:normalize_error(e)) }) 84 | else 85 | " Git for Windows 86 | let filepath = fern#internal#filepath#from_slash(a:path) 87 | let path = fern#internal#filepath#to_slash(filepath) 88 | return s:Promise.resolve(path) 89 | endif 90 | endfunction 91 | else 92 | function! s:normalize_path(path, token) abort 93 | return s:Promise.resolve(a:path) 94 | endfunction 95 | endif 96 | -------------------------------------------------------------------------------- /doc/.gitignore: -------------------------------------------------------------------------------- 1 | tags 2 | -------------------------------------------------------------------------------- /doc/fern-git-status.txt: -------------------------------------------------------------------------------- 1 | *fern-git-status.txt* Add Git status badge on fern.vim 2 | 3 | ============================================================================= 4 | CONTENTS *fern-git-status-contents* 5 | 6 | INTRODUCTION |fern-git-status-introduction| 7 | USAGE |fern-git-status-usage| 8 | STATUS |fern-git-status-status| 9 | INTERFACE |fern-git-status-interface| 10 | VARIABLE |fern-git-status-variable| 11 | HIGHLIGHT |fern-git-status-highlight| 12 | 13 | 14 | ============================================================================= 15 | INTRODUCTION *fern-git-status-introduction* 16 | 17 | *fern-git-status.vim* is a |fern.vim| plugin which add Git status badge. 18 | 19 | Note that the status check will be performed asynchronously every after user 20 | changes the tree status (e.g. expand a branch node). 21 | 22 | 23 | ============================================================================= 24 | USAGE *fern-git-status-usage* 25 | 26 | The plugin automatically starts thus move on to a git repository which has 27 | some dirty status then you will see badges on each nodes like: 28 | > 29 | fern-git-status.vim 30 | |+ .git 31 | |+ .github 32 | |- autoload [--] 33 | |- fern_git_status [--] 34 | | .DS_Store [!!] 35 | | investigator.vim [A ] 36 | | process.vim [??] 37 | | .DS_Store [!!] 38 | | fern_git_status.vim [MM] 39 | |+ doc 40 | |- plugin [- ] 41 | | fern_git_status.vim [M ] 42 | |+ test 43 | | .DS_Store [!!] 44 | | LICENSE 45 | | README.md 46 | < 47 | See fern-mapping-git.vim[1] if you need some mappings to manage git status or 48 | see gina.vim[2] if you need a full featured git integration plugin. 49 | 50 | [1] https://github.com/lambdalisue/fern-mapping-git.vim 51 | [2] https://github.com/lambdalisue/gina.vim 52 | 53 | 54 | ============================================================================= 55 | STATUS *fern-git-status-status* 56 | 57 | The plugin shows status of nodes as short format of git status[3] like: 58 | > 59 | X Y Meaning 60 | ------------------------------------------------- 61 | [AMD] not updated 62 | M [ MD] updated in index 63 | A [ MD] added to index 64 | D deleted from index 65 | R [ MD] renamed in index 66 | C [ MD] copied in index 67 | [MARC] index and work tree matches 68 | [ MARC] M work tree changed since index 69 | [ MARC] D deleted in work tree 70 | [ D] R renamed in work tree 71 | [ D] C copied in work tree 72 | ------------------------------------------------- 73 | D D unmerged, both deleted 74 | A U unmerged, added by us 75 | U D unmerged, deleted by them 76 | U A unmerged, added by them 77 | D U unmerged, deleted by us 78 | A A unmerged, both added 79 | U U unmerged, both modified 80 | ------------------------------------------------- 81 | ? ? untracked 82 | ! ! ignored 83 | ------------------------------------------------- 84 | < 85 | [3] https://git-scm.com/docs/git-status#_short_format 86 | 87 | The status of directory indicates that the directory contains index (left) or 88 | work tree (right) changes. For example, single - on right side means that the 89 | directory contains some work tree changes but index changes. 90 | 91 | 92 | ============================================================================= 93 | INTERFACE *fern-git-status-interface* 94 | 95 | ----------------------------------------------------------------------------- 96 | FUNCTION *fern-git-status-function* 97 | 98 | *fern_git_status#init()* 99 | fern_git_status#init() 100 | Register hooks to enable this plugin. Users do not need to call it 101 | manually unless |g:fern_git_status_disable_startup| has used. 102 | 103 | ----------------------------------------------------------------------------- 104 | VARIABLE *fern-git-status-variable* 105 | 106 | *g:fern_git_status_disable_startup* 107 | Set 1 to disable startup initialization. User MUST call 108 | |fern_git_status#init()| function manually in that case. 109 | 110 | *g:fern_git_status#disable_ignored* 111 | Set 1 to disable showing ignored file status. It might improve the 112 | performance of rendering. 113 | Default: 0 114 | 115 | *g:fern_git_status#disable_untracked* 116 | Set 1 to disable showing untracked file status. It might improve the 117 | performance of rendering. 118 | Default: 0 119 | 120 | *g:fern_git_status#disable_submodules* 121 | Set 1 to disable showing submodule status. It might improve the 122 | performance of rendering. 123 | Default: 0 124 | 125 | *g:fern_git_status#disable_directories* 126 | Set 1 to disable showing directory status. It might improve the 127 | performance of rendering. 128 | Default: 0 129 | 130 | *g:fern_git_status#indexed_character* 131 | A |String| used to indicate that the directory contains indexed 132 | (staged) changes. 133 | Default: "-" 134 | 135 | *g:fern_git_status#stained_character* 136 | A |String| used to indicate that the directory contains stained 137 | (unstaged) changes. 138 | Default: "-" 139 | 140 | *g:fern_git_status#indexed_patterns* 141 | A |List| of |pattern| to determine if the directory has indexed 142 | changes. Do NOT change it unless you understand the internal 143 | mechanisms to determine the status. 144 | 145 | *g:fern_git_status#stained_patterns* 146 | A |List| of |pattern| to determine if the directory has stained 147 | changes. Do NOT change it unless you understand the internal 148 | mechanisms to determine the status. 149 | 150 | ----------------------------------------------------------------------------- 151 | HIGHLIGHT *fern-git-status-highlight* 152 | 153 | FernGitStatusBracket *hl-FernGitStatusBracket* 154 | Color for brackets ([]) 155 | 156 | FernGitStatusIndex *hl-FernGitStatusIndex* 157 | Color for index (left) status. 158 | 159 | FernGitStatusWorktree *hl-FernGitStatusWorktree* 160 | Color for worktree (right) status. 161 | 162 | FernGitStatusUnmerged *hl-FernGitStatusUnmerged* 163 | Color for unmerged (DD/AU/UD/UA/DU/AA/UU) status. 164 | 165 | FernGitStatusUntracked *hl-FernGitStatusUntracked* 166 | Color for untracked (??) status. 167 | 168 | FernGitStatusIgnored *hl-FernGitStatusIgnored* 169 | Color for ignored (!!) status. 170 | 171 | 172 | ============================================================================= 173 | vim:tw=78:fo=tcq2mM:ts=8:ft=help:norl 174 | -------------------------------------------------------------------------------- /plugin/fern_git_status.vim: -------------------------------------------------------------------------------- 1 | if exists('g:loaded_fern_git_status') 2 | finish 3 | endif 4 | let g:loaded_fern_git_status = 1 5 | 6 | if !get(g:, 'fern_git_status_disable_startup') 7 | augroup fern-git-status-internal 8 | autocmd! 9 | autocmd VimEnter * ++once call fern_git_status#init() 10 | augroup END 11 | endif 12 | --------------------------------------------------------------------------------