nvim: Miscellaneous cleanups & improvements
Signed-off-by: Sanchayan Maity <maitysanchayan@gmail.com>
This commit is contained in:
parent
ef32c9c6d9
commit
a3777e9d45
1 changed files with 31 additions and 23 deletions
|
@ -117,7 +117,7 @@ let maplocalleader=","
|
||||||
|
|
||||||
set colorcolumn=80 " Highlight 80th column
|
set colorcolumn=80 " Highlight 80th column
|
||||||
set laststatus=2 " Always show status bar
|
set laststatus=2 " Always show status bar
|
||||||
set updatetime=500 " Let plugins show effects after 500ms
|
set updatetime=300 " Let plugins show effects after 500ms
|
||||||
set mouse-=a " Disable mouse click to go to position
|
set mouse-=a " Disable mouse click to go to position
|
||||||
set encoding=utf-8
|
set encoding=utf-8
|
||||||
set exrc " Allow loading local .nvimrc files
|
set exrc " Allow loading local .nvimrc files
|
||||||
|
@ -147,6 +147,7 @@ set nowritebackup " only in case you don't want a backup file while editin
|
||||||
set noswapfile " no swap files
|
set noswapfile " no swap files
|
||||||
set foldmethod=syntax " Create folds based on files syntax
|
set foldmethod=syntax " Create folds based on files syntax
|
||||||
set nofoldenable " Open folds by default
|
set nofoldenable " Open folds by default
|
||||||
|
set undofile " Enable undo persistence across sessions
|
||||||
|
|
||||||
" Wild menu
|
" Wild menu
|
||||||
set wildmenu
|
set wildmenu
|
||||||
|
@ -466,6 +467,8 @@ augroup END
|
||||||
augroup terminal_job
|
augroup terminal_job
|
||||||
au!
|
au!
|
||||||
au TermOpen * setlocal statusline=%{b:terminal_job_id}
|
au TermOpen * setlocal statusline=%{b:terminal_job_id}
|
||||||
|
au TermOpen * startinsert
|
||||||
|
au TermOpen * setlocal listchars= nonumber norelativenumber
|
||||||
augroup END
|
augroup END
|
||||||
|
|
||||||
augroup indentation_defaults
|
augroup indentation_defaults
|
||||||
|
@ -473,10 +476,10 @@ augroup indentation_defaults
|
||||||
au BufRead,BufNewFile *.c set noexpandtab
|
au BufRead,BufNewFile *.c set noexpandtab
|
||||||
au BufRead,BufNewFile *.h set noexpandtab
|
au BufRead,BufNewFile *.h set noexpandtab
|
||||||
au BufRead,BufNewFile Makefile* set noexpandtab
|
au BufRead,BufNewFile Makefile* set noexpandtab
|
||||||
au BufNewFile,BufRead *.vim setlocal noet ts=4 sw=4 sts=4
|
au BufRead,BufNewFile *.vim setlocal noet ts=4 sw=4 sts=4
|
||||||
au BufNewFile,BufRead *.txt setlocal noet ts=4 sw=4
|
au BufRead,BufNewFile *.txt setlocal noet ts=4 sw=4
|
||||||
au BufNewFile,BufRead *.lua setlocal noet ts=4 sw=4 sts=4
|
au BufRead,BufNewFile *.lua setlocal noet ts=4 sw=4 sts=4
|
||||||
au BufNewFile,BufRead *.py setlocal tabstop=4 softtabstop=4 shiftwidth=4 textwidth=80 smarttab expandtab
|
au BufRead,BufNewFile *.py setlocal tabstop=4 softtabstop=4 shiftwidth=4 textwidth=80 smarttab expandtab
|
||||||
au BufRead,BufNewFile */gst-*/*.[ch] set et sw=2
|
au BufRead,BufNewFile */gst-*/*.[ch] set et sw=2
|
||||||
au BufRead,BufNewFile */gstreamer-*/*.[ch] set et sw=2
|
au BufRead,BufNewFile */gstreamer-*/*.[ch] set et sw=2
|
||||||
au BufRead,BufNewFile */pulseaudio/*.[ch] set et sw=4 tw=128
|
au BufRead,BufNewFile */pulseaudio/*.[ch] set et sw=4 tw=128
|
||||||
|
@ -679,7 +682,7 @@ function! Cscope(option, query)
|
||||||
\ '--multi', '--bind', 'alt-a:select-all,alt-d:deselect-all',
|
\ '--multi', '--bind', 'alt-a:select-all,alt-d:deselect-all',
|
||||||
\ '--color', 'info:144,prompt:161,spinner:135,pointer:135,marker:118',
|
\ '--color', 'info:144,prompt:161,spinner:135,pointer:135,marker:118',
|
||||||
\ '--color', 'fg:252,bg:233,hl:67,fg+:252,bg+:235,hl+:81'],
|
\ '--color', 'fg:252,bg:233,hl:67,fg+:252,bg+:235,hl+:81'],
|
||||||
\ 'window': 'call FloatingFZF()'
|
\ 'window': 'call CreateCentredFloatingWindow()'
|
||||||
\ }
|
\ }
|
||||||
function! opts.sink(lines)
|
function! opts.sink(lines)
|
||||||
let data = split(a:lines)
|
let data = split(a:lines)
|
||||||
|
@ -726,24 +729,29 @@ function! NvimGdbNoTKeymaps()
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
let $FZF_DEFAULT_OPTS='--layout=reverse'
|
let $FZF_DEFAULT_OPTS='--layout=reverse'
|
||||||
let g:fzf_layout = { 'window': 'call FloatingFZF()' }
|
let g:fzf_layout = { 'window': 'call CreateCentredFloatingWindow()' }
|
||||||
function! FloatingFZF()
|
" Stolen from https://github.com/camspiers/dotfiles/blob/master/files/.config/nvim/init.vim
|
||||||
let buf = nvim_create_buf(v:false, v:true)
|
function! CreateCentredFloatingWindow()
|
||||||
let height = float2nr(&lines * 0.4)
|
|
||||||
let width = float2nr(&columns * 0.8)
|
let width = float2nr(&columns * 0.8)
|
||||||
let horizontal = float2nr((&columns - width) / 2)
|
let height = float2nr(&lines * 0.4)
|
||||||
let vertical = float2nr((&columns - width) / 2)
|
let top = ((&lines - height) / 2) - 1
|
||||||
|
let left = (&columns - width) / 2
|
||||||
|
let opts = {'relative': 'editor', 'row': top, 'col': left, 'width': width, 'height': height, 'style': 'minimal'}
|
||||||
|
|
||||||
let opts = {
|
let top = "╭" . repeat("─", width - 2) . "╮"
|
||||||
\ 'relative': 'editor',
|
let mid = "│" . repeat(" ", width - 2) . "│"
|
||||||
\ 'row': vertical,
|
let bot = "╰" . repeat("─", width - 2) . "╯"
|
||||||
\ 'col': horizontal,
|
let lines = [top] + repeat([mid], height - 2) + [bot]
|
||||||
\ 'width': width,
|
let s:buf = nvim_create_buf(v:false, v:true)
|
||||||
\ 'height': height
|
call nvim_buf_set_lines(s:buf, 0, -1, v:true, lines)
|
||||||
\ }
|
call nvim_open_win(s:buf, v:true, opts)
|
||||||
|
set winhl=Normal:Floating
|
||||||
" open the new window, floating, and enter to it
|
let opts.row += 1
|
||||||
call nvim_open_win(buf, v:true, opts)
|
let opts.height -= 2
|
||||||
|
let opts.col += 2
|
||||||
|
let opts.width -= 4
|
||||||
|
call nvim_open_win(nvim_create_buf(v:false, v:true), v:true, opts)
|
||||||
|
au BufWipeout <buffer> exe 'bw '.s:buf
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:incsearch_config(...) abort
|
function! s:incsearch_config(...) abort
|
||||||
|
|
Loading…
Reference in a new issue