mirror of
https://github.com/jdhao/nvim-config.git
synced 2025-06-08 14:14:33 +02:00
Refactor the auto-quit logic
Also quit quickfix window if it is the only window left.
This commit is contained in:
parent
2672a92e77
commit
7085965e05
@ -83,4 +83,18 @@ augroup cursor_color
|
|||||||
autocmd ColorScheme * highlight Cursor cterm=bold gui=bold guibg=#00c918 guifg=black
|
autocmd ColorScheme * highlight Cursor cterm=bold gui=bold guibg=#00c918 guifg=black
|
||||||
autocmd ColorScheme * highlight Cursor2 guifg=red guibg=red
|
autocmd ColorScheme * highlight Cursor2 guifg=red guibg=red
|
||||||
augroup END
|
augroup END
|
||||||
|
|
||||||
|
augroup auto_close_win
|
||||||
|
autocmd!
|
||||||
|
autocmd BufEnter * call s:quit_current_win()
|
||||||
|
augroup END
|
||||||
|
|
||||||
|
" Quit Neovim if we have only one window, and its filetype match our pattern.
|
||||||
|
function! s:quit_current_win() abort
|
||||||
|
let quit_filetypes = ['qf', 'vista']
|
||||||
|
let buftype = getbufvar(bufnr(), '&filetype')
|
||||||
|
if winnr('$') == 1 && index(quit_filetypes, buftype) != -1
|
||||||
|
quit
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
"}
|
"}
|
||||||
|
|||||||
@ -588,22 +588,14 @@ let g:vista_echo_cursor = 0
|
|||||||
" Stay in current window when vista window is opened
|
" Stay in current window when vista window is opened
|
||||||
let g:vista_stay_on_open = 0
|
let g:vista_stay_on_open = 0
|
||||||
|
|
||||||
augroup matchup_conf
|
augroup vista_conf
|
||||||
autocmd!
|
autocmd!
|
||||||
" Double mouse click to go to a tag
|
" Double mouse click to go to a tag
|
||||||
autocmd FileType vista* nnoremap <buffer> <silent>
|
autocmd FileType vista* nnoremap <buffer> <silent>
|
||||||
\ <2-LeftMouse> :<C-U>call vista#cursor#FoldOrJump()<CR>
|
\ <2-LeftMouse> :<C-U>call vista#cursor#FoldOrJump()<CR>
|
||||||
" Quit Neovim if vista window is the only window
|
|
||||||
autocmd BufEnter * call s:close_vista_win()
|
|
||||||
augroup END
|
augroup END
|
||||||
|
|
||||||
nnoremap <silent> <Space>t :<C-U>Vista!!<CR>
|
nnoremap <silent> <Space>t :<C-U>Vista!!<CR>
|
||||||
|
|
||||||
function! s:close_vista_win() abort
|
|
||||||
if winnr('$') == 1 && getbufvar(bufnr(), '&filetype') ==# 'vista'
|
|
||||||
quit
|
|
||||||
endif
|
|
||||||
endfunction
|
|
||||||
"}}
|
"}}
|
||||||
|
|
||||||
"{{ File editting
|
"{{ File editting
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user