Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bashcomplete: can not trigger omnicomplete in some pos #1061

Merged
merged 4 commits into from Dec 3, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion autoload/SpaceVim.vim
Expand Up @@ -195,7 +195,7 @@ let g:spacevim_statusline_inactive_separator = 'arrow'
" \ 'version control info'
" \ ]
" <
let g:spacevim_statusline_left_sections = ['winnr', 'filename', 'major mode', 'syntax checking', 'minor mode lighters', 'version control info']
let g:spacevim_statusline_left_sections = ['winnr', 'filename', 'major mode', 'syntax checking', 'minor mode lighters', 'version control info', 'hunks']
""
" Define the right section of statusline in active windows. By default:
" >
Expand Down
4 changes: 2 additions & 2 deletions autoload/SpaceVim/api/bash/complete.vim
Expand Up @@ -7,7 +7,7 @@ let s:COP = SpaceVim#api#import('vim#compatible')
" this is for vim command completion

function! s:self.complete(ArgLead, CmdLine, CursorPos) abort
if a:CmdLine =~ '^[^ ]*$'
if a:CmdLine =~ '^\s\{0,\}\w\+$'
return s:COP.systemlist('compgen -c ' . a:CmdLine)
endif
let result = s:COP.systemlist([s:completer, a:CmdLine])
Expand All @@ -18,7 +18,7 @@ endfunction
" this is for vim input()

function! s:self.complete_input(ArgLead, CmdLine, CursorPos) abort
if a:CmdLine =~ '^[^ ]*$'
if a:CmdLine =~ '^\s\{0,\}\w\+$'
return s:COP.systemlist('compgen -c ' . a:CmdLine)
endif
let result = s:COP.systemlist([s:completer, a:CmdLine])
Expand Down
22 changes: 22 additions & 0 deletions autoload/SpaceVim/layers/core/statusline.vim
Expand Up @@ -222,6 +222,25 @@ else
endfunction
endif

function! s:hunks() abort
let hunks = [0,0,0]
try
let hunks = GitGutterGetHunkSummary()
catch
endtry
let rst = ''
if hunks[0] > 0
let rst .= hunks[0] . '+ '
endif
if hunks[1] > 0
let rst .= hunks[1] . '~ '
endif
if hunks[2] > 0
let rst .= hunks[2] . '- '
endif
return empty(rst) ? '' : ' ' . rst
endfunction

let s:registed_sections = {
\ 'winnr' : function('s:winnr'),
\ 'syntax checking' : function('s:syntax_checking'),
Expand All @@ -230,6 +249,7 @@ let s:registed_sections = {
\ 'major mode' : function('s:major_mode'),
\ 'minor mode lighters' : function('s:modes'),
\ 'version control info' : function('s:git_branch'),
\ 'hunks' : function('s:hunks'),
\ 'cursorpos' : function('s:cursorpos'),
\ 'percentage' : function('s:percentage'),
\ 'time' : function('s:time'),
Expand Down Expand Up @@ -474,6 +494,8 @@ function! SpaceVim#layers#core#statusline#config() abort
\ 'toggle the cursor position', 1)
call SpaceVim#mapping#space#def('nnoremap', ['t', 'm', 'T'], 'if &laststatus == 2 | let &laststatus = 0 | else | let &laststatus = 2 | endif',
\ 'toggle the statuline itself', 1)
call SpaceVim#mapping#space#def('nnoremap', ['t', 'm', 'h'], 'call SpaceVim#layers#core#statusline#toggle_section("hunks")',
\ 'toggle the hunks summary', 1)
function! TagbarStatusline(...) abort
let name = (strwidth(a:3) > (g:spacevim_sidebar_width - 15)) ? a:3[:g:spacevim_sidebar_width - 20] . '..' : a:3
return s:STATUSLINE.build([s:winnr(),' Tagbar ', ' ' . name . ' '], [], s:lsep, s:rsep, '',
Expand Down
1 change: 1 addition & 0 deletions autoload/SpaceVim/layers/git.vim
Expand Up @@ -42,6 +42,7 @@ function! SpaceVim#layers#git#config() abort
autocmd!
autocmd FileType diff nnoremap <buffer><silent> q :bd!<CR>
autocmd FileType gitcommit setl omnifunc=SpaceVim#plugins#gitcommit#complete
autocmd User GitGutter let &l:statusline = SpaceVim#layers#core#statusline#get(1)
augroup END
call SpaceVim#mapping#space#def('nnoremap', ['g', 'M'], 'call call('
\ . string(function('s:display_last_commit_of_current_line')) . ', [])',
Expand Down
1 change: 1 addition & 0 deletions config/plugins_before/YouCompleteMe.vim
Expand Up @@ -19,4 +19,5 @@ let g:ycm_semantic_triggers = {
\ 'ruby' : ['.', '::'],
\ 'lua' : ['.', ':'],
\ 'erlang' : [':'],
\ 'sh' : ['re!\w{2}', '/', '-'],
\ }