2021-05-06 00:25:15 +02:00
|
|
|
set nocompatible
|
2022-12-18 14:54:56 +01:00
|
|
|
set backspace=start,eol,indent
|
|
|
|
set hidden
|
|
|
|
set hlsearch
|
2021-05-06 00:25:15 +02:00
|
|
|
syntax on
|
|
|
|
filetype plugin on
|
2022-12-18 14:54:56 +01:00
|
|
|
set tabstop=4 shiftwidth=4 autoindent smartindent expandtab
|
2023-07-19 00:30:51 +02:00
|
|
|
set mouse=v
|
2023-11-12 20:18:23 +01:00
|
|
|
set ttymouse=xterm
|
2023-11-16 20:08:26 +01:00
|
|
|
let mapleader=","
|
2022-12-18 14:54:56 +01:00
|
|
|
|
2023-07-26 12:00:10 +02:00
|
|
|
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
|
|
|
"
|
2022-12-18 14:54:56 +01:00
|
|
|
" Numbering of lines
|
2023-07-26 12:00:10 +02:00
|
|
|
"
|
|
|
|
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
2022-12-18 14:54:56 +01:00
|
|
|
" set relativenumber
|
2021-05-06 00:25:15 +02:00
|
|
|
set number
|
|
|
|
|
2023-07-26 12:00:10 +02:00
|
|
|
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
|
|
|
"
|
2022-12-18 14:54:56 +01:00
|
|
|
" Runtimepath variables
|
2023-07-26 12:00:10 +02:00
|
|
|
"
|
|
|
|
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
2022-12-18 14:54:56 +01:00
|
|
|
" call -> set rtp? show the runtime path
|
|
|
|
let $RTP=split(&runtimepath, ',')[0]
|
|
|
|
let $RC="$HOME/.vimrc"
|
|
|
|
|
2023-07-26 12:00:10 +02:00
|
|
|
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
|
|
|
"
|
2022-12-18 14:54:56 +01:00
|
|
|
" Move Swap,Backup and undo files into .vim directory
|
2023-07-26 12:00:10 +02:00
|
|
|
"
|
|
|
|
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
2023-05-26 09:06:10 +02:00
|
|
|
set directory^=$HOME/.vim/.swap//
|
|
|
|
set backupdir^=$HOME/.vim/.backup//
|
|
|
|
set undodir^=$HOME/.vim/.undo//
|
2022-12-18 14:54:56 +01:00
|
|
|
|
2023-07-26 12:00:10 +02:00
|
|
|
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
|
|
|
"
|
2022-12-18 14:54:56 +01:00
|
|
|
" Split to the right and below
|
2023-07-26 12:00:10 +02:00
|
|
|
"
|
|
|
|
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
2022-12-18 14:54:56 +01:00
|
|
|
set splitbelow
|
|
|
|
set splitright
|
|
|
|
|
2023-07-26 12:00:10 +02:00
|
|
|
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
|
|
|
"
|
2022-12-18 14:54:56 +01:00
|
|
|
" Folding
|
2023-07-26 12:00:10 +02:00
|
|
|
"
|
|
|
|
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
2022-05-30 23:21:59 +02:00
|
|
|
set foldenable foldlevelstart=20 foldmethod=indent
|
2021-05-06 00:25:15 +02:00
|
|
|
|
2023-07-26 12:00:10 +02:00
|
|
|
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
|
|
|
"
|
2022-12-18 14:54:56 +01:00
|
|
|
" Rebind shortcut to switch splits
|
2023-07-26 12:00:10 +02:00
|
|
|
"
|
|
|
|
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
2022-12-18 14:54:56 +01:00
|
|
|
nmap <C-h> <C-w>h
|
|
|
|
nmap <C-j> <C-w>j
|
|
|
|
nmap <C-k> <C-w>k
|
|
|
|
nmap <C-l> <C-w>l
|
|
|
|
|
2023-07-26 12:00:10 +02:00
|
|
|
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
|
|
|
"
|
2022-12-18 14:54:56 +01:00
|
|
|
" Finding files
|
2023-07-26 12:00:10 +02:00
|
|
|
"
|
|
|
|
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
2022-12-18 14:54:56 +01:00
|
|
|
set path+=**
|
|
|
|
set wildmenu
|
2023-07-26 16:53:18 +02:00
|
|
|
set wildmode=longest:full,full
|
2022-12-18 14:54:56 +01:00
|
|
|
|
2023-07-26 12:00:10 +02:00
|
|
|
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
|
|
|
"
|
|
|
|
" Create Tags thorugh :MakeTags
|
|
|
|
"
|
|
|
|
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
2022-12-18 14:54:56 +01:00
|
|
|
command! MakeTags !ctags -R .
|
|
|
|
set autochdir
|
|
|
|
set tags=tags;
|
|
|
|
|
2023-07-26 12:00:10 +02:00
|
|
|
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
|
|
|
"
|
|
|
|
" File browsing through a tree on the left side
|
|
|
|
"
|
|
|
|
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
2021-05-06 00:25:15 +02:00
|
|
|
let g:netrw_banner=0
|
|
|
|
let g:netrw_browse_split=4
|
|
|
|
let g:netrw_altv=1
|
|
|
|
let g:netrw_liststyle=3
|
|
|
|
let g:netrw_list_hide=netrw_gitignore#Hide()
|
|
|
|
let g:netrw_list_hide.=',\(\^\|\s\s\)\zs\.\S\+'
|
2022-12-18 14:54:56 +01:00
|
|
|
map <C-n> :Lex <bar> vertical resize 30 <CR>
|
2021-05-06 00:25:15 +02:00
|
|
|
|
2023-07-26 12:00:10 +02:00
|
|
|
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
|
|
|
"
|
|
|
|
" Cursorline on the cursor
|
|
|
|
"
|
|
|
|
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
2021-05-06 00:25:15 +02:00
|
|
|
set cursorline
|
|
|
|
hi CursorLine cterm=NONE ctermbg=darkgrey ctermfg=white
|
|
|
|
|
2023-07-26 12:00:10 +02:00
|
|
|
|
|
|
|
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
|
|
|
"
|
|
|
|
" Status Line on the bottom
|
|
|
|
"
|
|
|
|
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
2022-12-18 14:54:56 +01:00
|
|
|
" Statusline
|
|
|
|
" function! gitbranch()
|
|
|
|
" return system("git rev-parse --abbrev-ref head 2>/dev/null | tr -d '\n'")
|
|
|
|
" endfunction
|
|
|
|
"
|
|
|
|
" function! statuslinegit()
|
|
|
|
" let l:branchname = gitbranch()
|
|
|
|
" return strlen(l:branchname) > 0?' '.l:branchname.' ':''
|
|
|
|
" endfunction
|
2022-05-30 23:21:59 +02:00
|
|
|
function! UpdateGitBranch()
|
2023-07-19 00:30:51 +02:00
|
|
|
let l:branchname = system("git rev-parse --abbrev-ref HEAD 2>/dev/null | tr -d '\n'")
|
2022-12-18 14:54:56 +01:00
|
|
|
let b:branchstatus = strlen(l:branchname) > 0? ' '.l:branchname.' ':''
|
2021-05-06 00:25:15 +02:00
|
|
|
endfunction
|
|
|
|
|
2022-05-30 23:21:59 +02:00
|
|
|
augroup UPDATE_GITBRANCH
|
2022-12-18 14:54:56 +01:00
|
|
|
" clear previous commands
|
2022-05-30 23:21:59 +02:00
|
|
|
autocmd!
|
2022-12-18 14:54:56 +01:00
|
|
|
" Update git branch
|
2022-05-30 23:21:59 +02:00
|
|
|
autocmd BufWritePre * :call UpdateGitBranch()
|
|
|
|
autocmd BufReadPost * :call UpdateGitBranch()
|
2022-12-18 14:54:56 +01:00
|
|
|
autocmd BufEnter * :call UpdateGitBranch()
|
|
|
|
augroup end
|
2023-11-12 20:18:23 +01:00
|
|
|
|
|
|
|
function! LinterStatus() abort
|
|
|
|
let l:counts = ale#statusline#Count(bufnr(''))
|
|
|
|
|
|
|
|
let l:all_errors = l:counts.error + l:counts.style_error
|
|
|
|
let l:all_non_errors = l:counts.total - l:all_errors
|
|
|
|
|
|
|
|
return l:counts.total == 0 ? 'OK' : printf(
|
|
|
|
\ 'Lint: %dW %dE',
|
|
|
|
\ all_non_errors,
|
|
|
|
\ all_errors
|
|
|
|
\)
|
|
|
|
endfunction
|
2021-05-06 00:25:15 +02:00
|
|
|
|
|
|
|
set laststatus=2
|
|
|
|
set statusline=
|
|
|
|
set statusline+=%#PmenuSel#
|
2022-12-18 14:54:56 +01:00
|
|
|
" set statusline+=%{StatuslineGit()}
|
2023-07-19 00:30:51 +02:00
|
|
|
set statusline+=%{b:branchstatus}
|
2021-05-06 00:25:15 +02:00
|
|
|
set statusline+=%#BufTabLineCurrent#
|
|
|
|
set statusline+=\ %M
|
|
|
|
set statusline+=\ %r
|
|
|
|
set statusline+=\ %F
|
|
|
|
set statusline+=%= "Right side settings
|
2023-11-12 20:18:23 +01:00
|
|
|
set statusline+=\ [%{LinterStatus()}\]
|
2021-05-06 00:25:15 +02:00
|
|
|
set statusline+=\ %y
|
|
|
|
set statusline+=%#CursorColumn#
|
|
|
|
set statusline+=\ %{&fileencoding?&fileencoding:&encoding}
|
|
|
|
set statusline+=\[%{&fileformat}\]
|
|
|
|
set statusline+=\ %c:%l/%L
|
|
|
|
set statusline+=\ %p%%
|
|
|
|
set statusline+=\ [%n]
|
|
|
|
|
2023-07-26 12:00:10 +02:00
|
|
|
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
|
|
|
"
|
|
|
|
" Colors
|
|
|
|
"
|
|
|
|
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
2023-07-24 08:07:37 +02:00
|
|
|
set termguicolors
|
|
|
|
" colorscheme gruvbox
|
|
|
|
colorscheme catppuccin_macchiato
|
2021-05-06 00:25:15 +02:00
|
|
|
set bg=dark
|
2022-05-30 23:21:59 +02:00
|
|
|
|
2023-07-26 12:00:10 +02:00
|
|
|
" tmux color correction
|
2022-05-30 23:21:59 +02:00
|
|
|
|
2023-07-26 12:00:10 +02:00
|
|
|
if exists('+termguicolors')
|
|
|
|
let &t_8f = "\<Esc>[38;2;%lu;%lu;%lum"
|
|
|
|
let &t_8b = "\<Esc>[48;2;%lu;%lu;%lum"
|
|
|
|
set termguicolors
|
|
|
|
endif
|
|
|
|
|
|
|
|
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
|
|
|
"
|
2023-05-26 09:06:10 +02:00
|
|
|
" tagbar, press F8
|
2023-07-26 12:00:10 +02:00
|
|
|
"
|
|
|
|
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
2023-05-26 09:06:10 +02:00
|
|
|
nmap <F8> :TagbarToggle<CR>
|
|
|
|
|
2023-07-26 12:00:10 +02:00
|
|
|
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
|
|
|
"
|
|
|
|
" Selection Highlighting
|
|
|
|
"
|
|
|
|
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
2023-07-18 21:59:39 +02:00
|
|
|
" hlsearch colors
|
|
|
|
highlight Search ctermbg=black ctermfg=darkgrey ctermbg=grey
|
|
|
|
" Highlight all instances of word under cursor, when idle.
|
|
|
|
function! AutoHighlightToggle()
|
|
|
|
let @/ = ''
|
|
|
|
augroup auto_highlight
|
|
|
|
au!
|
|
|
|
au CursorHold * let @/ = '\V\<'.escape(expand('<cword>'), '\').'\>'
|
|
|
|
augroup end
|
2023-11-12 20:18:23 +01:00
|
|
|
setl updatetime=1600
|
2023-07-18 21:59:39 +02:00
|
|
|
endfunction
|
|
|
|
call AutoHighlightToggle()
|
|
|
|
|
2023-07-26 12:00:10 +02:00
|
|
|
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
|
|
|
"
|
|
|
|
" Code Completion
|
|
|
|
"
|
|
|
|
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
2023-11-12 20:18:23 +01:00
|
|
|
set lazyredraw
|
2023-11-12 14:08:39 +01:00
|
|
|
set splitright
|
2023-07-18 23:56:32 +02:00
|
|
|
let g:ale_enabled = 1
|
|
|
|
let g:ale_hover_enabled = 1
|
2023-11-12 20:18:23 +01:00
|
|
|
let g:ale_set_balloons = 1
|
|
|
|
let g:ale_sign_error = '✗'
|
2023-11-14 21:03:37 +01:00
|
|
|
" let g:ale_sign_warning = ''
|
2023-11-12 14:08:39 +01:00
|
|
|
let g:ale_completion_enabled = 1
|
|
|
|
let g:ale_completion_autoimport = 1
|
|
|
|
" let g:ale_floating_window_border = ['│', '─', '╭', '╮', '╯', '╰', '│', '─']
|
2023-11-12 20:18:23 +01:00
|
|
|
" let g:ale_floating_window_border = repeat([''], 8)
|
|
|
|
let g:ale_close_preview_on_insert = 1
|
|
|
|
let g:ale_hover_to_preview = 1
|
|
|
|
|
|
|
|
let g:ale_echo_msg_error_str = 'E'
|
|
|
|
let g:ale_echo_msg_warning_str = 'W'
|
|
|
|
let g:ale_echo_msg_format = '[%linter%], [%severity%] %s' " let g:ale_popup_menu_enabled = 1
|
|
|
|
nmap gr :ALEFindReferences<CR>
|
|
|
|
nmap T :ALEHover<CR>
|
|
|
|
" nmap gd :ALEGoToDefinition<CR>
|
2023-07-24 08:07:37 +02:00
|
|
|
|
2023-11-12 14:08:39 +01:00
|
|
|
" set completeopt+=menuone
|
|
|
|
" set completeopt+=noselect
|
|
|
|
" set completeopt+=noinsert
|
2023-07-24 08:07:37 +02:00
|
|
|
set shortmess+=c " Shut off completion messages
|
|
|
|
set belloff+=ctrlg " Add only if Vim beeps during completion
|
|
|
|
let g:mucomplete#enable_auto_at_startup = 1
|
2023-11-12 20:18:23 +01:00
|
|
|
let g:mucomplete#completion_delay = 0
|
2023-07-24 08:07:37 +02:00
|
|
|
|
2023-11-12 14:08:39 +01:00
|
|
|
" set omnifunc=syntaxcomplete#Complete
|
2023-07-24 08:07:37 +02:00
|
|
|
" set omnifunc=ale#completion#Complete
|
2023-11-12 20:18:23 +01:00
|
|
|
" set omnifunc=ale#completion#OmniFunc
|
2023-07-24 08:07:37 +02:00
|
|
|
"let g:ale_completion_enabled=1
|
|
|
|
"function! OpenCompletion()
|
|
|
|
" if !pumvisible() && ((v:char >= 'a' && v:char <= 'z') || (v:char >= 'A' && v:char <= 'Z'))
|
|
|
|
" call feedkeys("\<C-x>\<C-o>", "n")
|
|
|
|
" endif
|
|
|
|
"endfunction
|
|
|
|
"
|
|
|
|
"autocmd InsertCharPre * call OpenCompletion()
|
|
|
|
"
|
2023-11-12 14:08:39 +01:00
|
|
|
set completeopt+=longest,menu,menuone,preview,noselect,noinsert
|
2024-01-16 14:30:44 +01:00
|
|
|
" set splitkeep=screen
|
2023-07-24 08:07:37 +02:00
|
|
|
"" set completeopt+=menuone,noselect,noinsert
|
|
|
|
""
|
2023-11-12 20:18:23 +01:00
|
|
|
" autocmd InsertLeave,CompleteDone * if pumvisible() == 0 | pclose | endif
|
2023-07-18 23:56:32 +02:00
|
|
|
|
2023-11-12 14:08:39 +01:00
|
|
|
"
|
|
|
|
"
|
|
|
|
" --This puts the preview window to the right of the screen
|
|
|
|
"
|
|
|
|
" augroup previewWindowPosition
|
|
|
|
" au!
|
|
|
|
" autocmd BufWinEnter * call PreviewWindowPosition()
|
|
|
|
" augroup END
|
|
|
|
" function! PreviewWindowPosition()
|
|
|
|
" if &previewwindow
|
|
|
|
" wincmd L
|
|
|
|
" endif
|
|
|
|
" endfunction
|
|
|
|
|
2023-07-26 12:00:10 +02:00
|
|
|
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
2024-01-16 14:30:44 +01:00
|
|
|
"
|
|
|
|
" undotree
|
|
|
|
"
|
|
|
|
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
|
|
|
nnoremap <F5> :UndotreeToggle<CR>
|
|
|
|
|
|
|
|
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
2023-07-26 12:00:10 +02:00
|
|
|
"
|
2023-07-24 17:09:50 +02:00
|
|
|
" Remove conceal from Markdown when Insert mode is set
|
2023-07-26 12:00:10 +02:00
|
|
|
"
|
|
|
|
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
2023-07-24 17:09:50 +02:00
|
|
|
autocmd InsertEnter *.{markdown,md} set conceallevel=0
|
|
|
|
autocmd InsertLeave *.{markdown,md} set conceallevel=2
|
2023-07-24 20:53:54 +02:00
|
|
|
|
|
|
|
autocmd InsertEnter *.{json} set conceallevel=0
|
|
|
|
autocmd InsertLeave *.{json} set conceallevel=2
|
|
|
|
|
2023-07-26 12:00:10 +02:00
|
|
|
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
|
|
|
"
|
|
|
|
" Load all packages and activate tags
|
|
|
|
"
|
|
|
|
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
2023-07-28 13:33:15 +02:00
|
|
|
packadd! vim-polyglot
|
2023-07-26 12:00:10 +02:00
|
|
|
packadd! vim-log-highlighting
|
|
|
|
packloadall
|
|
|
|
" Load all of the helptags now, after plugins have been loaded.
|
|
|
|
" All messages and errors will be ignored.
|
|
|
|
silent! helptags ALL
|
|
|
|
silent! helptags ALE
|
|
|
|
silent! helptags vim-gitgutter/doc
|
|
|
|
|
2023-11-15 23:58:56 +01:00
|
|
|
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
|
|
|
"
|
|
|
|
" FZF Integration
|
|
|
|
"
|
|
|
|
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
|
|
|
|
|
|
|
set rtp+=$HOME/.fzf
|
2023-11-16 20:08:26 +01:00
|
|
|
nnoremap <silent> <Leader>b :Buffers<CR>
|
2023-11-16 00:09:54 +01:00
|
|
|
nnoremap <silent> <C-f> :Files<CR>
|
2024-07-05 16:55:18 +02:00
|
|
|
nnoremap <silent> <Leader>r :Files ~<CR>
|
2023-11-16 20:08:26 +01:00
|
|
|
nnoremap <silent> <Leader>f :Rg<CR>
|
|
|
|
nnoremap <silent> <Leader>/ :BLines<CR>
|
|
|
|
nnoremap <silent> <Leader>' :Marks<CR>
|
|
|
|
nnoremap <silent> <Leader>g :Commits<CR>
|
|
|
|
nnoremap <silent> <Leader>H :Helptags<CR>
|
|
|
|
nnoremap <silent> <Leader>hh :History<CR>
|
|
|
|
nnoremap <silent> <Leader>h: :History:<CR>
|
|
|
|
nnoremap <silent> <Leader>h/ :History/<CR>
|
|
|
|
|
|
|
|
" Customize fzf colors to match your color scheme
|
|
|
|
" - fzf#wrap translates this to a set of `--color` options
|
|
|
|
let g:fzf_colors =
|
|
|
|
\ { 'fg': ['fg', 'Normal'],
|
|
|
|
\ 'bg': ['bg', 'Normal'],
|
|
|
|
\ 'hl': ['fg', 'Comment'],
|
|
|
|
\ 'fg+': ['fg', 'CursorLine', 'CursorColumn', 'Normal'],
|
|
|
|
\ 'bg+': ['bg', 'CursorLine', 'CursorColumn'],
|
|
|
|
\ 'hl+': ['fg', 'Statement'],
|
|
|
|
\ 'info': ['fg', 'PreProc'],
|
|
|
|
\ 'border': ['fg', 'Ignore'],
|
|
|
|
\ 'prompt': ['fg', 'Conditional'],
|
|
|
|
\ 'pointer': ['fg', 'Exception'],
|
|
|
|
\ 'marker': ['fg', 'Keyword'],
|
|
|
|
\ 'spinner': ['fg', 'Label'],
|
|
|
|
\ 'header': ['fg', 'Comment'] }
|