2019-04-21 11:42:15 +00:00
|
|
|
" always show the sign column
|
|
|
|
set signcolumn=yes
|
|
|
|
|
|
|
|
" enable bell everywhere
|
|
|
|
set belloff=
|
|
|
|
|
|
|
|
" title {{{
|
|
|
|
set title
|
2019-06-20 23:28:22 +00:00
|
|
|
let s:username = $USER
|
|
|
|
let s:hostname = substitute(hostname(), '\v^([^.]*).*$', '\1', '') " get hostname up to the first '.'
|
|
|
|
let &titlestring = $USER . '@' . s:hostname . ': %F%{&modified ? g:airline_symbols.modified : ""} (nvim)'
|
2019-04-21 11:42:15 +00:00
|
|
|
" }}}
|
|
|
|
|
|
|
|
" Yes, I occasionally use mouse. Sometimes it is handy for switching windows/buffers
|
|
|
|
set mouse=a
|
|
|
|
" <RightMouse> pops up a context menu
|
|
|
|
" <S-LeftMouse> extends a visual selection
|
|
|
|
set mousemodel=popup
|
|
|
|
|
|
|
|
" Maybe someday I'll use a Neovim GUI
|
|
|
|
if has('guifont')
|
|
|
|
let &guifont = 'Ubuntu Mono derivative Powerline:h14'
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
|
|
" Buffers {{{
|
|
|
|
|
|
|
|
set hidden
|
|
|
|
|
|
|
|
" open diffs in vertical splits by default
|
|
|
|
set diffopt+=vertical
|
|
|
|
|
|
|
|
" buffer navigation {{{
|
2019-05-01 14:40:25 +00:00
|
|
|
noremap <silent> <Tab> <Cmd>bnext<CR>
|
|
|
|
noremap <silent> <S-Tab> <Cmd>bprev<CR>
|
|
|
|
noremap <silent> gb <Cmd>buffer#<CR>
|
2019-04-21 11:42:15 +00:00
|
|
|
" }}}
|
|
|
|
|
|
|
|
" ask for confirmation when closing unsaved buffers
|
|
|
|
set confirm
|
|
|
|
|
|
|
|
" Bbye with confirmation, or fancy buffer closer {{{
|
|
|
|
function s:CloseBuffer(cmd) abort
|
2021-03-29 22:22:56 +00:00
|
|
|
let cmd = a:cmd
|
2019-04-21 11:42:15 +00:00
|
|
|
if &modified
|
2021-03-29 22:22:56 +00:00
|
|
|
let answer = confirm("Save changes?", "&Yes\n&No\n&Cancel")
|
|
|
|
if answer ==# 1 " Yes
|
2019-04-21 11:42:15 +00:00
|
|
|
write
|
2021-03-29 22:22:56 +00:00
|
|
|
elseif answer ==# 2 " No
|
|
|
|
let cmd .= '!'
|
2019-04-22 18:15:29 +00:00
|
|
|
else " Cancel/Other
|
2019-04-21 11:42:15 +00:00
|
|
|
return
|
|
|
|
endif
|
|
|
|
endif
|
2021-03-29 22:22:56 +00:00
|
|
|
execute cmd
|
2019-04-21 11:42:15 +00:00
|
|
|
endfunction
|
|
|
|
" }}}
|
|
|
|
|
|
|
|
" closing buffers {{{
|
2019-05-01 14:40:25 +00:00
|
|
|
nnoremap <silent> <BS> <Cmd>call <SID>CloseBuffer('Bdelete')<CR>
|
2019-05-12 12:25:12 +00:00
|
|
|
nnoremap <silent> <Del> <Cmd>call <SID>CloseBuffer('Bdelete')<bar>quit<CR>
|
2019-04-21 11:42:15 +00:00
|
|
|
" }}}
|
|
|
|
|
|
|
|
" }}}
|
|
|
|
|
|
|
|
|
|
|
|
" Windows {{{
|
|
|
|
|
|
|
|
" window navigation {{{
|
|
|
|
noremap <C-j> <C-w>j
|
|
|
|
noremap <C-k> <C-w>k
|
|
|
|
noremap <C-l> <C-w>l
|
|
|
|
noremap <C-h> <C-w>h
|
|
|
|
" }}}
|
|
|
|
|
|
|
|
" switch to previous window
|
|
|
|
noremap <C-\> <C-w>p
|
|
|
|
|
|
|
|
" don't automatically make all windows the same size
|
|
|
|
set noequalalways
|
|
|
|
|
|
|
|
" closing windows {{{
|
2019-05-01 14:40:25 +00:00
|
|
|
nnoremap <silent> <A-BS> <Cmd>quit<CR>
|
2019-04-21 11:42:15 +00:00
|
|
|
" }}}
|
|
|
|
|
|
|
|
" }}}
|
|
|
|
|
|
|
|
|
|
|
|
" Airline (statusline) {{{
|
2019-09-05 22:03:52 +00:00
|
|
|
let g:airline_theme = 'dotfiles'
|
2019-04-21 11:42:15 +00:00
|
|
|
let g:airline_symbols = {
|
|
|
|
\ 'readonly': 'RO',
|
2021-05-16 12:18:43 +00:00
|
|
|
\ 'whitespace': '',
|
2021-05-15 16:35:44 +00:00
|
|
|
\ 'colnr': '',
|
2019-04-21 11:42:15 +00:00
|
|
|
\ 'linenr': '',
|
|
|
|
\ 'maxlinenr': ' ',
|
|
|
|
\ 'branch': '',
|
2021-05-16 12:18:43 +00:00
|
|
|
\ 'notexists': ' [?]',
|
2019-04-21 11:42:15 +00:00
|
|
|
\ }
|
2021-05-16 12:18:43 +00:00
|
|
|
let g:airline_extensions = [
|
|
|
|
\ 'quickfix',
|
|
|
|
\ 'fzf',
|
|
|
|
\ 'term',
|
|
|
|
\ 'hunks',
|
|
|
|
\ 'branch',
|
|
|
|
\ 'fugitiveline',
|
|
|
|
\ 'coc',
|
|
|
|
\ 'whitespace',
|
|
|
|
\ 'wordcount',
|
|
|
|
\ 'tabline',
|
|
|
|
\ 'obsession',
|
|
|
|
\ 'dotfiles_tweaks',
|
|
|
|
\ 'dotfiles_filesize',
|
|
|
|
\ ]
|
|
|
|
let g:airline_detect_iminsert = 1
|
2019-11-17 11:51:11 +00:00
|
|
|
let g:airline#extensions#tabline#left_sep = ' '
|
|
|
|
let g:airline#extensions#tabline#left_alt_sep = ''
|
2021-05-16 12:18:43 +00:00
|
|
|
let g:airline#extensions#dotfiles_filesize#update_delay = 2
|
2019-04-21 11:42:15 +00:00
|
|
|
" }}}
|
|
|
|
|
|
|
|
|
|
|
|
" FZF {{{
|
2019-07-11 06:36:31 +00:00
|
|
|
nnoremap <silent> <F1> <Cmd>Helptags<CR>
|
2019-05-01 14:40:25 +00:00
|
|
|
nnoremap <silent> <leader>f <Cmd>Files<CR>
|
|
|
|
nnoremap <silent> <leader>b <Cmd>Buffers<CR>
|
2020-11-04 00:09:45 +00:00
|
|
|
let g:fzf_layout = { 'down': '~40%' }
|
2021-01-28 23:37:49 +00:00
|
|
|
let g:fzf_preview_window = ['right:noborder', 'ctrl-/']
|
2019-04-21 11:42:15 +00:00
|
|
|
" }}}
|
|
|
|
|
|
|
|
|
|
|
|
" quickfix/location list {{{
|
|
|
|
nmap [q <Plug>(qf_qf_previous)
|
|
|
|
nmap ]q <Plug>(qf_qf_next)
|
|
|
|
nmap [l <Plug>(qf_loc_previous)
|
|
|
|
nmap ]l <Plug>(qf_loc_next)
|
|
|
|
let g:qf_mapping_ack_style = 1
|
|
|
|
" }}}
|
2019-11-30 11:00:37 +00:00
|
|
|
|
|
|
|
|
|
|
|
" Terminal {{{
|
|
|
|
augroup vimrc-terminal
|
|
|
|
autocmd!
|
|
|
|
autocmd TermOpen * IndentLinesDisable
|
|
|
|
augroup END
|
|
|
|
" }}}
|
2019-12-19 16:56:29 +00:00
|
|
|
|
|
|
|
|
|
|
|
nnoremap <silent> <F9> <Cmd>make<CR>
|