nvim: add config changes

* set diff, scroll, sidescroll, matching, ruler, folding and viminfo
  opts
* set up some fileformats
* properly check colour support
This commit is contained in:
surtur 2023-10-03 12:18:32 +02:00
parent fd620f8036
commit e44254b980
Signed by: wanderer
SSH Key Fingerprint: SHA256:MdCZyJ2sHLltrLBp0xQO0O1qTW9BT/xl5nXkDvhlMCI

View File

@ -164,6 +164,33 @@ else
set previewheight=5
endif
" filler lines to keep text position; start diff with vertical splits; don't
" ignore case and whitespace changes
set diffopt=filler,vertical
" set scrolloff=3 " scroll offset, min lines above/below cursor
set scrolloff=5 " scroll offset, min lines above/below cursor
"set scrolljump=5 " jump 5 lines when running out of the screen - NO
set sidescroll=10 " minimum columns to scroll horizontally
" Make <,> match pairs, too.
" https://github.com/EHartC/dot-vimrc/blob/master/vim%20config/styling.vim
set matchpairs+=<:>
set matchtime=2 " how many tenths of a second to blink when matching brackets
set noshowmode " show editing mode in status (-- INSERT --)
set ruler " show cursor position
" Tell vim to remember certain things when we exit
" '10 : marks will be remembered for up to 10 previously edited files
" "100 : will save up to 100 lines for each register
" :20 : up to 20 lines of command-line history will be remembered
" % : saves and restores the buffer list
set viminfo='100,"100,:20,% " '=marks for x files, "=registers for x files
" set nofoldenable
set foldmethod=manual " manual folding
set fileencoding=utf-8 " set encoding for newly saved files
set cmdheight=2 " lines under {status,air}line
" colo dracula
colo photon
@ -194,10 +221,26 @@ set wildmode=longest:longest,full
set colorcolumn=80
filetype plugin indent on
set hlsearch incsearch
augroup filetypes
autocmd!
au BufRead,BufNewFile *.tmpl setlocal filetype=gohtmltmpl
au FileType gohtmltmpl setlocal ff=unix ts=2 shiftwidth=2 sts=2 noexpandtab
au FileType nix setl
\ fileformat=unix autoindent omnifunc=lsp#complete
au BufNewFile,BufRead,BufEnter *.js
\ setlocal shiftwidth=2 tabstop=2 softtabstop=2 backspace=2 expandtab autoindent
\ fileformat=unix filetype=javascript
au BufNewFile,BufRead,BufEnter *.md
\ setlocal textwidth=79 foldmethod=manual filetype=markdown
\ fileformat=unix expandtab
au FileType swayconfig setl textwidth=99
\ tabstop=4 shiftwidth=4 softtabstop=4 noexpandtab autoindent ft=swayconfig
au FileType rust setl
\ tabstop=8 shiftwidth=8 softtabstop=8 noexpandtab autoindent ff=unix
augroup END
@ -431,8 +474,11 @@ set noscrollbind
set noerrorbells
set laststatus=2 " show status bar
set report=1 " Always report number of lines changed by ex commands
set termguicolors
set t_Co=256
if (has('termguicolors'))
set termguicolors
else
set t_Co=256
endif
set guifont=Fira\ Code\ weight=450\ 12
let g:netrw_beval = 1
@ -472,6 +518,7 @@ for s in ['Comment', 'markdownItalic', 'Boolean']
endfor
hi CursorLineNR cterm=bold
lua <<EOF
require('nvim-highlight-colors').setup {enable_tailwind = true}
@ -506,6 +553,7 @@ lspconfig.zls.setup {}
lspconfig.golangci_lint.setup {}
lspconfig.golangci_lint_ls.setup {}
-- https://go.googlesource.com/tools/+/refs/heads/master/gopls/doc/vim.md
lspconfig.gopls.setup{
cmd = {"gopls", "-remote=unix;/tmp/.gopls-daemon.sock"},
filetypes = {"go", "gomod", "gowork", "gotmpl", "gohtmltmpl"},