Skip to content

Commit 40e5354

Browse files
committed
Merge branch 'update-git-status-in-vim'
2 parents 5f842de + faf2f35 commit 40e5354

File tree

4 files changed

+61
-3
lines changed

4 files changed

+61
-3
lines changed

README.md

+13
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ This also requires `curl`, [git](https://git-scm.com), `ruby` support.
1515
I manage plugins with [vim-plug](https://github.com/junegunn/vim-plug), which is pretty easy to install.
1616
All plugins settings are defined in the `plug_plugins` folder.
1717

18+
- [Fugitive](https://github.com/tpope/vim-fugitive) Requires Git to be installed.
19+
- [vimwiki](https://github.com/vimwiki/vimwiki) Convert vimwiki to html requires `pandoc` to be installed.
20+
1821
## Configuration
1922

2023
You can overwrite default configuration and key bindings by using one of
@@ -126,6 +129,14 @@ For more keys, see `:h vimwiki-mappings` or [vimwiki-readme](http://github.com/v
126129
- `:Vimwiki2HTML`: Convert current wiki link to HTML.
127130
- `:VimwikiAll2HTML`: Convert all wiki links to HTML.
128131

132+
#### Fugitive
133+
134+
- `:Git`: Bring up a summary window vaguely akin to git-status.
135+
- `:Gwrite`: Write to the current file's path and stage the results.
136+
- `:Gdiffsplit!`: Diff against any and all direct ancestors, retaining focus on the current window.
137+
138+
For more information, see `:help fugitive`.
139+
129140
## Plugin List
130141

131142
<!-- prettier-ignore-start -->
@@ -134,7 +145,9 @@ For more keys, see `:h vimwiki-mappings` or [vimwiki-readme](http://github.com/v
134145
| ------ | ----------- |
135146
| [lightline.vim](https://github.com/itchyny/lightline.vim) [:gear:](./plug_plugins/lightline.vim) | A light and configurable statusline/tabline plugin for Vim |
136147
| [molokai](https://github.com/tomasr/molokai) [:gear:](./plug_plugins/molokai.vim) | Molokai color scheme for Vim |
148+
| [vim-fugitive](https://github.com/tpope/vim-fugitive) [:gear:](./plug_plugins/vim-fugitive.vim) | fugitive.vim: A Git wrapper so awesome, it should be illegal |
137149
| [vim-polyglot](https://github.com/sheerun/vim-polyglot) [:gear:](./plug_plugins/vim-polyglot.vim) | A solid language pack for Vim. |
150+
| [vim-signify](https://github.com/mhinz/vim-signify) [:gear:](./plug_plugins/vim-signify.vim) | :heavy_plus_sign: Show a diff using Vim its sign column. |
138151
| [vimwiki](https://github.com/vimwiki/vimwiki) [:gear:](./plug_plugins/vimwiki.vim) | Personal Wiki for Vim |
139152
<!-- PLUGIN_LIST_END -->
140153
<!-- prettier-ignore-end -->

plug_plugins/lightline.vim

+19-3
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ endif
1010
let g:lightline = {
1111
\ 'active': {
1212
\ 'left': [ ['mode', 'paste'],
13-
\ ['readonly', 'filename', 'modified'] ],
13+
\ ['fugitive', 'readonly', 'filename', 'modified'] ],
1414
\ 'right': [ ['lineinfo'],
1515
\ ['percent'],
1616
\ ['fileformat', 'fileencoding', 'filetype'] ]
@@ -24,12 +24,28 @@ let g:lightline = {
2424
\ 'right': [['close']]
2525
\ },
2626
\ 'component': {
27+
\ 'fugitive': '%{exists("*fugitive#head")?fugitive#head():""}',
2728
\ 'lineinfo': '%3l:%-2v',
2829
\ },
29-
\ 'component_function': {},
30-
\ 'component_function_visible_condition': {},
30+
\ 'component_function': {
31+
\ 'fugitive': 'LightlineFugitive',
32+
\ },
33+
\ 'component_function_visible_condition': {
34+
\ 'fugitive': '(exists("*fugitive#head") && ""!=fugitive#head())'
35+
\ },
3136
\ 'component_expand': {},
3237
\ 'colorscheme': 'seoul256'
3338
\ }
3439

40+
function! LightlineFugitive() abort
41+
try
42+
if expand('%:t') !~? 'Tagbar\|Gundo\|NERD' && &ft !~? 'vimfiler' && exists('*fugitive#head')
43+
let l:branch = fugitive#head()
44+
return strlen(l:branch) ? l:branch : ''
45+
endif
46+
catch
47+
endtry
48+
return ''
49+
endfunction
50+
3551
" vim: set sw=2 ts=2 et tw=78 :

plug_plugins/vim-fugitive.vim

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
" Copyright (c) 2019-present Kaiming Guo. All rights reserved.
2+
" Use of this source code is governed by a BSD-style license that can be
3+
" found in the LICENSE file.
4+
5+
if exists('g:plug_installing_plugins')
6+
Plug 'tpope/vim-fugitive'
7+
finish
8+
endif
9+
10+
" vim: set sw=2 ts=2 et tw=78 :

plug_plugins/vim-signify.vim

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
" Copyright (c) 2019-present Kaiming Guo. All rights reserved.
2+
" Use of this source code is governed by a BSD-style license that can be
3+
" found in the LICENSE file.
4+
5+
if exists('g:plug_installing_plugins')
6+
if has('nvim') || has('patch-8.0.902')
7+
Plug 'mhinz/vim-signify'
8+
else
9+
Plug 'mhinz/vim-signify', { 'branch': 'legacy' }
10+
endif
11+
finish
12+
endif
13+
14+
" makes switching buffers in large repos have no delay
15+
let g:signify_update_on_bufenter = 0
16+
let g:signify_sign_overwrite = 0
17+
let g:signify_vcs_list = ['git']
18+
19+
" vim: set sw=2 ts=2 et tw=78 :

0 commit comments

Comments
 (0)