dotfiles/vim/.vimrc

125 lines
3.0 KiB
VimL
Raw Normal View History

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
"set noswapfile
" Numbering of lines
" set relativenumber
2021-05-06 00:25:15 +02:00
set number
2022-12-18 14:54:56 +01:00
" Runtimepath variables
" call -> set rtp? show the runtime path
let $RTP=split(&runtimepath, ',')[0]
let $RC="$HOME/.vimrc"
" Move Swap,Backup and undo files into .vim directory
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
" Split to the right and below
set splitbelow
set splitright
" Folding
set foldenable foldlevelstart=20 foldmethod=indent
2021-05-06 00:25:15 +02:00
2022-12-18 14:54:56 +01:00
" Rebind shortcut to switch splits
nmap <C-h> <C-w>h
nmap <C-j> <C-w>j
nmap <C-k> <C-w>k
nmap <C-l> <C-w>l
" Finding files
set path+=**
set wildmenu
" Tags
command! MakeTags !ctags -R .
set autochdir
set tags=tags;
2023-05-26 09:06:10 +02:00
" Press F9 to run Python script
autocmd FileType python map <buffer> <F9> :w<CR>:exec '!python3' shellescape(@%, 1)<CR>
autocmd FileType python imap <buffer> <F9> <esc>:w<CR>:exec '!python3' shellescape(@%, 1)<CR>
2022-12-18 14:54:56 +01:00
" File browsing
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> :NERDTreeToggle<CR>
map <C-n> :Lex <bar> vertical resize 30 <CR>
2021-05-06 00:25:15 +02:00
2022-12-18 14:54:56 +01:00
" Cursorline
2021-05-06 00:25:15 +02:00
set cursorline
hi CursorLine cterm=NONE ctermbg=darkgrey ctermfg=white
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
function! UpdateGitBranch()
2022-12-18 14:54:56 +01:00
let l:branchname = system("git rev-parse --abbrev-ref head 2>/dev/null | tr -d '\n'")
let b:branchstatus = strlen(l:branchname) > 0? ' '.l:branchname.' ':''
2021-05-06 00:25:15 +02:00
endfunction
augroup UPDATE_GITBRANCH
2022-12-18 14:54:56 +01:00
" clear previous commands
autocmd!
2022-12-18 14:54:56 +01:00
" Update git branch
autocmd BufWritePre * :call UpdateGitBranch()
autocmd BufReadPost * :call UpdateGitBranch()
2022-12-18 14:54:56 +01:00
autocmd BufEnter * :call UpdateGitBranch()
augroup end
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-05-26 09:06:10 +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
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-05-26 09:06:10 +02:00
"packadd! indentLine
2022-12-18 14:54:56 +01:00
"let g: indentLine_char = '⦙'
2021-05-06 00:25:15 +02:00
2022-12-18 14:54:56 +01:00
" let g:vimspector_enable_mappings = 'HUMAN'
" packadd! vimspector
2021-05-06 00:25:15 +02:00
2022-12-18 14:54:56 +01:00
packadd! gruvbox
2021-05-06 00:25:15 +02:00
colorscheme gruvbox
set bg=dark
2022-12-18 14:54:56 +01:00
packadd! vim-log-highlighting
2023-05-26 09:06:10 +02:00
" tagbar, press F8
nmap <F8> :TagbarToggle<CR>
" packadd! ale
2022-12-18 14:54:56 +01:00
packloadall
" Load all of the helptags now, after plugins have been loaded.
" All messages and errors will be ignored.
silent! helptags ALL