Browse Source

vim config

master
Ivan Polyakov 4 months ago
parent
commit
24366728b4
  1. 2
      .config/vim/.gitignore
  2. 2863
      .config/vim/autoload/plug.vim
  3. 2859
      .config/vim/autoload/plug.vim.old
  4. 32
      .config/vim/general.vim
  5. 4
      .config/vim/init.vim
  6. 46
      .config/vim/lsp.vim
  7. 35
      .config/vim/paths.vim
  8. 11
      .config/vim/plugins.vim
  9. 33
      .vim/init/general.vim
  10. 18
      .vim/init/vimtex.vim
  11. 1
      .vimrc
  12. 1
      README.md

2
.config/vim/.gitignore vendored

@ -0,0 +1,2 @@ @@ -0,0 +1,2 @@
.netrwhist
plugged/

2863
.config/vim/autoload/plug.vim

File diff suppressed because it is too large Load Diff

2859
.config/vim/autoload/plug.vim.old

File diff suppressed because it is too large Load Diff

32
.config/vim/general.vim

@ -0,0 +1,32 @@ @@ -0,0 +1,32 @@
set nocompatible
syntax on
" Editing settings
set expandtab " use spaces
set tabstop=4
set shiftwidth=4
set scrolloff=2
" Editor UI
set number relativenumber
set ruler
set cc=80
colorscheme zaibatsu
" netrw
let g:netrw_altv=1 " split window to the right
let g:netrw_liststyle=3 " tree style listing
let g:netrw_list_hide=netrw_gitignore#Hide()
" File search
set path+=** " Provides tab-completion for all file-related tasks
set wildmenu
" Tags
" The contents of the .ctagsignore file will be ignored by ctags,
" similar to the contents of the Git .gitignore file.
command! Mktags !ctags -R
\ --exclude=.git
\ --exclude=.svn
\ $(test -r .ctagsignore && echo "--exclude=@.ctagsignore")
\ .

4
.config/vim/init.vim

@ -0,0 +1,4 @@ @@ -0,0 +1,4 @@
source ~/.config/vim/general.vim
source ~/.config/vim/paths.vim
source ~/.config/vim/plugins.vim
source ~/.config/vim/lsp.vim

46
.config/vim/lsp.vim

@ -0,0 +1,46 @@ @@ -0,0 +1,46 @@
" Register LSP servers
"" Register clangd C and C++ lanuage server.
if executable('clangd')
augroup lsp_clangd
autocmd!
autocmd User lsp_setup call lsp#register_server({
\ 'name': 'clangd',
\ 'cmd': {server_info->['clangd']},
\ 'whitelist': ['c', 'cpp', 'cxx', 'objc', 'objcpp'],
\ })
autocmd FileType c setlocal omnifunc=lsp#complete
autocmd FileType cpp setlocal omnifunc=lsp#complete
autocmd FileType objc setlocal omnifunc=lsp#complete
autocmd FileType objcpp setlocal omnifunc=lsp#complete
augroup end
endif
function! s:on_lsp_buffer_enabled() abort
setlocal omnifunc=lsp#complete
setlocal signcolumn=yes
if exists('+tagfunc') | setlocal tagfunc=lsp#tagfunc | endif
nmap <buffer> gd <plug>(lsp-definition)
nmap <buffer> gs <plug>(lsp-document-symbol-search)
nmap <buffer> gS <plug>(lsp-workspace-symbol-search)
nmap <buffer> gr <plug>(lsp-references)
nmap <buffer> gi <plug>(lsp-implementation)
nmap <buffer> gt <plug>(lsp-type-definition)
nmap <buffer> <leader>rn <plug>(lsp-rename)
nmap <buffer> [g <plug>(lsp-previous-diagnostic)
nmap <buffer> ]g <plug>(lsp-next-diagnostic)
nmap <buffer> K <plug>(lsp-hover)
nnoremap <buffer> <expr><c-f> lsp#scroll(+4)
nnoremap <buffer> <expr><c-d> lsp#scroll(-4)
let g:lsp_format_sync_timeout = 1000
autocmd! BufWritePre *.rs,*.go call execute('LspDocumentFormatSync')
" refer to doc to add more commands
endfunction
augroup lsp_install
au!
" call s:on_lsp_buffer_enabled only for languages that has the server registered.
autocmd User lsp_buffer_enabled call s:on_lsp_buffer_enabled()
augroup END

35
.config/vim/paths.vim

@ -0,0 +1,35 @@ @@ -0,0 +1,35 @@
vim9script
# Create config directory
if !isdirectory('~/.config/vim')
:silent !mkdir -p ~/.config/vim > /dev/null 2>&1
endif
# Create cache directory
if !isdirectory('~/.cache/vim')
:silent !mkdir -p ~/.cache/vim > /dev/null 2>&1
endif
# Setup paths
set viminfo+=n~/.cache/vim/info
# set runtimepath+=n~/.config/vim/autoload
set runtimepath=~/.config/vim,$VIM/vimfiles,$VIMRUNTIME,$VIM/vimfiles/after,~/.config/vim/after
## Backups
if !isdirectory('~./.cache/vim/backup')
:silent !mkdir -p ~/.cache/vim/backup > /dev/null 2>&1
endif
set backupdir=~/.cache/vim/backup//,.
set backup # enable backups
## Swap
if !isdirectory('~./.cache/vim/swap')
:silent !mkdir -p ~/.cache/vim/swap > /dev/null 2>&1
endif
set directory=~/.cache/vim/swap//,.
## Undo files
if !isdirectory('~/.cache/vim/undo')
:silent !mkdir -p ~/.cache/vim/undo > /dev/null 2>&1
endif
set undodir=~/.cache/vim/undo//,.
set undofile

11
.config/vim/plugins.vim

@ -0,0 +1,11 @@ @@ -0,0 +1,11 @@
vim9script
plug#begin()
Plug 'SirVer/ultisnips'
Plug 'honza/vim-snippets'
Plug 'editorconfig/editorconfig-vim'
Plug 'prabirshrestha/vim-lsp'
Plug 'rhysd/vim-clang-format'
plug#end()

33
.vim/init/general.vim

@ -1,33 +0,0 @@ @@ -1,33 +0,0 @@
""" General
syntax enable
set nocompatible | filetype indent plugin on | syn on
set backspace=indent,eol,start
set ruler " show current line and column
set nu rnu " show line numbers
set cc=75 " show column ruler
set ts=4
set shiftwidth=4
set expandtab
set scrolloff=2
set completeopt=menu,menuone,noselect
syntax on
""" Finding files
set path+=** " Provides tab-completion for all file-related tasks
set wildmenu " Display all mathing files when we tab complete
""" Tags
command! Mktags !ctags -R .
""" file browsing
let g:netrw_banner=0 " disable annoying banner
let g:netrw_browse_split=4 " open in prior window
let g:netrw_altv=1 " open splits to the right
let g:netrw_liststyle=3 " tree view
let g:netrw_list_hide=netrw_gitignore#Hide()
"" typo
setlocal spell
set spelllang=en
inoremap <C-l> <c-g>u<Esc>[s1z=`]a<c-g>u

18
.vim/init/vimtex.vim

@ -1,18 +0,0 @@ @@ -1,18 +0,0 @@
let g:tex_flavor='latex'
let g:vimtex_view_method='zathura'
let g:vimtex_quickfix_mode=0
let g:vimtex_syntax_conceal = {
\ 'accents': 1,
\ 'cites': 1,
\ 'fancy': 1,
\ 'greek': 1,
\ 'math_bounds': 1,
\ 'math_delimiters': 1,
\ 'math_fracs': 1,
\ 'math_super_sub': 1,
\ 'math_symbols': 1,
\ 'sections': 1,
\ 'styles': 1,
\}
set conceallevel=2
let g:tex_conceal='abdmg'

1
.vimrc

@ -0,0 +1 @@ @@ -0,0 +1 @@
source ~/.config/vim/init.vim

1
README.md

@ -5,6 +5,7 @@ My dotfiles. @@ -5,6 +5,7 @@ My dotfiles.
It contains
------------
Configs for:
* vim
* [zathura](https://git.pwmt.org/pwmt/zathura)
* [rofi](https://github.com/davatorium/rofi)

Loading…
Cancel
Save