2022-04-03 13:09:17 +03:00
|
|
|
|
" Basic settings {{{
|
|
|
|
|
let g:mapleader = ','
|
|
|
|
|
let g:maplocalleader = '-'
|
|
|
|
|
|
|
|
|
|
syntax enable
|
|
|
|
|
filetype plugin indent on
|
|
|
|
|
set encoding=utf-8
|
|
|
|
|
set autoindent
|
|
|
|
|
set smartindent
|
|
|
|
|
set tabstop=2
|
|
|
|
|
set shiftwidth=2
|
|
|
|
|
set expandtab
|
|
|
|
|
set number
|
2022-04-14 23:02:49 +03:00
|
|
|
|
set signcolumn=yes
|
2022-04-03 13:09:17 +03:00
|
|
|
|
" TODO: use difference color column by filetypes
|
|
|
|
|
set colorcolumn=80,100,120
|
|
|
|
|
set hidden
|
|
|
|
|
set nobackup
|
|
|
|
|
set nowritebackup
|
|
|
|
|
set updatetime=300
|
|
|
|
|
set shortmess+=c
|
|
|
|
|
set nopaste
|
2022-04-14 23:00:44 +03:00
|
|
|
|
set foldcolumn=0
|
2022-04-03 13:09:17 +03:00
|
|
|
|
" }}}
|
|
|
|
|
|
|
|
|
|
" Mappings {{{
|
|
|
|
|
nnoremap <leader>ev :split $MYVIMRC<cr>
|
|
|
|
|
nnoremap <leader>sv :source $MYVIMRC<cr>
|
|
|
|
|
" }}}
|
|
|
|
|
|
2022-04-07 17:01:01 +03:00
|
|
|
|
cabbrev bsp belowright split
|
|
|
|
|
cabbrev rvsp belowright vsplit
|
|
|
|
|
|
2022-04-03 13:09:17 +03:00
|
|
|
|
" Markdown file settings {{{
|
2022-04-03 22:26:15 +03:00
|
|
|
|
aug filetype_md
|
|
|
|
|
au!
|
|
|
|
|
au FileType markdown iabbrev @@ dmitriy@ideascup.me
|
|
|
|
|
aug END
|
2022-04-03 13:09:17 +03:00
|
|
|
|
" }}}
|
|
|
|
|
|
|
|
|
|
" Plugins {{{
|
|
|
|
|
call plug#begin()
|
|
|
|
|
Plug 'junegunn/seoul256.vim' " theme
|
|
|
|
|
Plug 'Yggdroot/indentLine' " tab and space indentation
|
2022-04-04 23:53:36 +03:00
|
|
|
|
Plug 'mg979/vim-visual-multi', {'branch': 'master'} " multi cursors
|
|
|
|
|
Plug 'preservim/nerdtree' " file tree
|
2022-04-03 13:09:17 +03:00
|
|
|
|
Plug 'Xuyuanp/nerdtree-git-plugin'
|
2022-04-14 23:02:49 +03:00
|
|
|
|
Plug 'airblade/vim-gitgutter' " git gutter
|
2022-04-03 13:09:17 +03:00
|
|
|
|
|
|
|
|
|
Plug 'prabirshrestha/vim-lsp' " lsp for many langs
|
|
|
|
|
Plug 'prabirshrestha/asyncomplete.vim' " autocomplete
|
|
|
|
|
Plug 'prabirshrestha/asyncomplete-lsp.vim'
|
|
|
|
|
Plug 'mattn/vim-lsp-settings' " settings for lsp plugin
|
|
|
|
|
|
2022-04-04 23:53:36 +03:00
|
|
|
|
Plug 'sbdchd/neoformat' " format langs via official tools
|
2022-04-03 13:09:17 +03:00
|
|
|
|
Plug 'easymotion/vim-easymotion' " fast navigation
|
|
|
|
|
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } } " fuzzy find files
|
|
|
|
|
Plug 'junegunn/fzf.vim' " fzf integration
|
|
|
|
|
Plug 'dyng/ctrlsf.vim' " async searching
|
2022-04-04 23:53:36 +03:00
|
|
|
|
Plug 'christoomey/vim-tmux-navigator' " navigation inside tmux
|
|
|
|
|
Plug 'editorconfig/editorconfig-vim' " editorconfig
|
2022-04-03 13:09:17 +03:00
|
|
|
|
Plug 'cespare/vim-toml', { 'branch': 'main' } " toml lang
|
2022-04-04 23:53:36 +03:00
|
|
|
|
Plug 'rust-lang/rust.vim' " rust lang
|
2022-04-03 13:09:17 +03:00
|
|
|
|
Plug 'jparise/vim-graphql' " graphql lang with gql tag
|
|
|
|
|
Plug 'lifepillar/pgsql.vim' " postgresql lang support
|
2022-04-04 23:53:36 +03:00
|
|
|
|
Plug 'LnL7/vim-nix' " nix lang
|
2022-04-03 13:09:17 +03:00
|
|
|
|
call plug#end()
|
|
|
|
|
" }}}
|
|
|
|
|
|
2022-04-14 23:02:49 +03:00
|
|
|
|
" Plugin: GitGutter {{{
|
|
|
|
|
let g:gitgutter_set_sign_backgrounds = 1
|
2022-04-15 11:10:47 +03:00
|
|
|
|
let g:gitgutter_highlight_linenrs = 1
|
|
|
|
|
let g:gitgutter_highlight_lines = 1
|
|
|
|
|
|
|
|
|
|
nnoremap <leader>ghl :GitGutterLineHighlightsToggle<CR>
|
2022-04-14 23:02:49 +03:00
|
|
|
|
" }}}
|
|
|
|
|
|
2022-04-03 13:09:17 +03:00
|
|
|
|
let g:sql_type_default = 'pgsql'
|
|
|
|
|
|
|
|
|
|
" Plugin: NeoFormat {{{
|
|
|
|
|
let g:neoformat_try_node_exe = 1
|
2022-04-03 22:26:15 +03:00
|
|
|
|
aug fmt
|
|
|
|
|
au!
|
2022-04-07 17:01:01 +03:00
|
|
|
|
au FileType javascript,javascriptreact,typescript,typescriptreact,rust,haskell
|
2022-04-04 23:53:36 +03:00
|
|
|
|
\ au BufWritePre <buffer> undojoin | Neoformat
|
2022-04-03 22:26:15 +03:00
|
|
|
|
aug END
|
2022-04-03 13:09:17 +03:00
|
|
|
|
" }}}
|
|
|
|
|
|
|
|
|
|
" Plugin: NerdTree {{{
|
|
|
|
|
let g:NERDTreeDirArrowExpandable = '▸'
|
|
|
|
|
let g:NERDTreeDirArrowCollapsible = '▾'
|
|
|
|
|
let g:NERDTreeMinimalUI = 1
|
|
|
|
|
let g:NERDTreeDirArrows = 1
|
|
|
|
|
nnoremap <leader>n :NERDTreeFocus<CR>
|
|
|
|
|
nnoremap <C-t> :NERDTreeToggle<CR>
|
2022-04-14 23:21:45 +03:00
|
|
|
|
nnoremap <C-g> :NERDTreeFind<CR>
|
2022-04-03 13:09:17 +03:00
|
|
|
|
" }}}
|
|
|
|
|
|
|
|
|
|
" Plugin: NerdTreeGit {{{
|
|
|
|
|
let g:NERDTreeGitStatusShowIgnored = 1
|
|
|
|
|
let g:NERDTreeGitStatusIndicatorMapCustom = {
|
2022-04-04 23:53:36 +03:00
|
|
|
|
\ "Modified" : "ᵐ",
|
|
|
|
|
\ "Staged" : "ˢ",
|
|
|
|
|
\ "Untracked" : "ᵘ",
|
|
|
|
|
\ "Renamed" : "ʳ",
|
|
|
|
|
\ "Unmerged" : "ᶴ",
|
|
|
|
|
\ "Deleted" : "ˣ",
|
|
|
|
|
\ "Dirty" : "˜",
|
|
|
|
|
\ "Clean" : "ᵅ",
|
|
|
|
|
\ "Unknown" : "?"
|
|
|
|
|
\ }
|
2022-04-03 13:09:17 +03:00
|
|
|
|
" }}}
|
|
|
|
|
|
|
|
|
|
" Plugin: LSP {{{
|
|
|
|
|
let g:lsp_preview_max_width = 60
|
|
|
|
|
let g:lsp_diagnostics_float_cursor = 1
|
|
|
|
|
|
2022-04-12 16:08:50 +03:00
|
|
|
|
" if (executable('haskell-language-server-wrapper'))
|
|
|
|
|
" echom "Haskell lsp installed"
|
|
|
|
|
" au User lsp_setup call lsp#register_server({
|
|
|
|
|
" \ 'name': 'haskell-language-server-wrapper',
|
|
|
|
|
" \ 'cmd': {server_info->['haskell-language-server-wrapper', 'lsp']},
|
|
|
|
|
" \ 'whitelist': ['haskell'],
|
|
|
|
|
" \ })
|
|
|
|
|
" endif
|
|
|
|
|
|
2022-04-03 13:09:17 +03:00
|
|
|
|
function! s:on_lsp_buffer_enabled() abort
|
2022-04-04 23:53:36 +03:00
|
|
|
|
setlocal omnifunc=lsp#complete
|
|
|
|
|
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)
|
|
|
|
|
" refer to doc to add more commands
|
2022-04-03 13:09:17 +03:00
|
|
|
|
endfunction
|
|
|
|
|
|
2022-04-03 22:26:15 +03:00
|
|
|
|
aug lsp_install
|
2022-04-04 23:53:36 +03:00
|
|
|
|
au!
|
|
|
|
|
" call s:on_lsp_buffer_enabled only for languages that has the server registered.
|
|
|
|
|
au User lsp_buffer_enabled call s:on_lsp_buffer_enabled()
|
2022-04-03 22:26:15 +03:00
|
|
|
|
aug END
|
2022-04-03 13:09:17 +03:00
|
|
|
|
" }}}
|
|
|
|
|
|
|
|
|
|
" Theme {{{
|
|
|
|
|
set background=light
|
|
|
|
|
colo seoul256-light
|
|
|
|
|
highlight ColorColumn ctermbg=254
|
|
|
|
|
" uses for fzf preview
|
|
|
|
|
let $BAT_THEME = 'Monokai Extended Light'
|
|
|
|
|
" }}}
|