2024-02-14 07:54:31 +01:00
|
|
|
" ###########################################
|
|
|
|
" # CORE BEHAVIOR
|
|
|
|
" ###########################################
|
2023-08-19 11:12:22 +02:00
|
|
|
set nocompatible
|
2024-01-18 21:23:17 +01:00
|
|
|
set mouse=
|
|
|
|
set backspace=indent,eol,start
|
2023-08-19 11:12:22 +02:00
|
|
|
|
2024-02-14 07:54:31 +01:00
|
|
|
" ###########################################
|
|
|
|
" # TEMPORARY FILES
|
|
|
|
" ###########################################
|
|
|
|
set undofile
|
|
|
|
set undodir=~/.local/vim/undo//
|
|
|
|
set backup
|
|
|
|
set backupcopy=yes
|
|
|
|
set backupdir=~/.local/vim/backup//
|
|
|
|
set directory=~/.local/vim/swapfiles//
|
|
|
|
silent execute '!mkdir -p ~/.local/vim/backup ~/.local/vim/undo ~/.local/vim/swapfiles'
|
2024-01-21 21:52:18 +01:00
|
|
|
|
2024-02-14 07:54:31 +01:00
|
|
|
" ###########################################
|
|
|
|
" # VISUAL CHANGES
|
|
|
|
" ###########################################
|
|
|
|
set shm+=I
|
|
|
|
set noshowcmd
|
|
|
|
set noshowmode
|
2024-01-21 21:52:18 +01:00
|
|
|
|
2024-01-18 21:23:17 +01:00
|
|
|
syntax on
|
|
|
|
filetype plugin on
|
2023-08-19 11:12:22 +02:00
|
|
|
|
2024-02-14 07:54:31 +01:00
|
|
|
set t_Co=256
|
2024-01-21 21:52:18 +01:00
|
|
|
set background=dark
|
|
|
|
colorscheme candle-grey-transparent
|
2024-02-14 07:54:31 +01:00
|
|
|
|
2024-01-21 21:52:18 +01:00
|
|
|
hi CursorLineNr ctermbg=NONE ctermfg=30 cterm=NONE
|
|
|
|
hi CursorLine ctermbg=NONE ctermfg=NONE cterm=NONE
|
2024-02-14 07:54:31 +01:00
|
|
|
hi SpellBad ctermbg=NONE ctermfg=124
|
|
|
|
|
|
|
|
match ErrorMsg '\(TODO:\|FIXME\|XXX\|workaround\|WTF\|: error:.*\|\s\+$\| \+\ze\t\)'
|
|
|
|
|
|
|
|
" ###########################################
|
|
|
|
" # VIMDIFF
|
|
|
|
" ###########################################
|
|
|
|
set formatoptions=crolj
|
|
|
|
hi DiffAdd ctermbg=22 ctermfg=NONE cterm=NONE
|
|
|
|
hi DiffDelete ctermbg=234 ctermfg=NONE cterm=NONE
|
|
|
|
hi DiffChange ctermbg=236 ctermfg=NONE cterm=NONE
|
|
|
|
hi DiffText ctermbg=red ctermfg=NONE cterm=NONE
|
|
|
|
hi VertSplit ctermbg=NONE ctermfg=246 cterm=NONE
|
|
|
|
hi FoldColumn ctermbg=NONE ctermfg=251 cterm=NONE
|
|
|
|
hi Folded ctermbg=233 ctermfg=251 cterm=NONE
|
|
|
|
|
|
|
|
" ###########################################
|
|
|
|
" # TOGGLES / SETTINGS
|
|
|
|
" ###########################################
|
|
|
|
|
|
|
|
let g:is_posix=1
|
|
|
|
let g:mapleader = ","
|
|
|
|
|
|
|
|
set scrolloff=3
|
|
|
|
set spelllang=de,en
|
2024-01-21 21:52:18 +01:00
|
|
|
|
2023-08-19 11:12:22 +02:00
|
|
|
set hlsearch
|
|
|
|
set ignorecase
|
|
|
|
set smartcase
|
|
|
|
|
|
|
|
set tabstop=8
|
|
|
|
set shiftwidth=4
|
|
|
|
let &softtabstop=&shiftwidth
|
|
|
|
|
|
|
|
set expandtab
|
|
|
|
set smarttab
|
|
|
|
|
|
|
|
set textwidth=72
|
2023-12-08 18:02:01 +01:00
|
|
|
set formatprg=par\ -w72q
|
2023-08-19 11:12:22 +02:00
|
|
|
|
2024-02-14 07:54:31 +01:00
|
|
|
"set list
|
|
|
|
"set number
|
|
|
|
"set listchars=tab:\ ,trail:
|
|
|
|
"set fillchars=vert:\|,eob:\
|
2024-02-01 07:56:35 +01:00
|
|
|
|
2024-02-14 07:54:31 +01:00
|
|
|
" ###########################################
|
|
|
|
" # STATUS BAR
|
|
|
|
" ###########################################
|
2024-01-31 14:10:49 +01:00
|
|
|
|
2024-02-14 07:54:31 +01:00
|
|
|
function BufInfo()
|
|
|
|
endfunction
|
2024-01-31 14:10:49 +01:00
|
|
|
|
2024-02-14 07:54:31 +01:00
|
|
|
set laststatus=2
|
2024-02-01 07:56:35 +01:00
|
|
|
set statusline=%#Comment#
|
2024-02-14 07:54:31 +01:00
|
|
|
set statusline+=[%{toupper(mode())}]
|
|
|
|
set statusline+=\ <%n/%{g:bufno}>
|
2024-01-31 14:10:49 +01:00
|
|
|
set statusline+=%=
|
2024-02-14 07:54:31 +01:00
|
|
|
set statusline+=\ %f:%l:%c
|
|
|
|
set statusline+=\ %{&fileencoding?&fileencoding:&encoding}\ %{&fileformat}
|
|
|
|
set statusline+=\ 0x%B
|
|
|
|
set statusline+=\ %p%%
|
|
|
|
|
|
|
|
" ###########################################
|
|
|
|
" # OMNI COMPLETE
|
|
|
|
" ###########################################
|
|
|
|
set omnifunc=syntaxcomplete#Complete
|
|
|
|
set wildmenu
|
|
|
|
set wildmode=longest:full,full
|
|
|
|
function! CleverTab()
|
|
|
|
if strpart( getline('.'), 0, col('.')-1 ) =~ '^\s*$'
|
|
|
|
return "\<Tab>"
|
|
|
|
else
|
|
|
|
return "\<C-N>"
|
|
|
|
endif
|
2024-01-18 21:23:17 +01:00
|
|
|
endfunction
|
2024-02-14 07:54:31 +01:00
|
|
|
inoremap <tab> <C-R>=CleverTab()<CR>
|
2024-01-18 21:23:17 +01:00
|
|
|
|
2024-02-14 07:54:31 +01:00
|
|
|
" ###########################################
|
|
|
|
" # TERMINAL DEBUGGER
|
|
|
|
" ###########################################
|
|
|
|
packadd termdebug
|
|
|
|
let g:termdebugger = "egdb"
|
2024-01-19 22:17:16 +01:00
|
|
|
|
2024-02-14 07:54:31 +01:00
|
|
|
" ###########################################
|
|
|
|
" # VIM FZF
|
|
|
|
" ###########################################
|
|
|
|
let g:fzf_layout = { 'down': '60%' }
|
|
|
|
let g:fzf_action = { 'ctrl-t': 'tab split', 'ctrl-x': 'vsplit' }
|
2024-01-19 22:17:16 +01:00
|
|
|
|
2024-02-14 07:54:31 +01:00
|
|
|
noreabbrev <expr> ts getcmdtype() == ":" && getcmdline() == 'ts' ? 'FZFTselect' : 'ts'
|
|
|
|
nmap gt <Plug>(fzf_tags)
|
2024-01-21 21:52:18 +01:00
|
|
|
|
2024-02-14 07:54:31 +01:00
|
|
|
nnoremap <leader>g :RG <C-R>=expand("<cword>")<CR><CR>
|
2024-01-19 22:17:16 +01:00
|
|
|
nnoremap <leader>f :Files<CR>
|
2024-01-21 21:52:18 +01:00
|
|
|
nnoremap <leader>b :Buffers<CR>
|
2024-01-19 22:17:16 +01:00
|
|
|
nnoremap <leader>t :Tags<CR>
|
2024-01-21 21:52:18 +01:00
|
|
|
nnoremap <leader>h :History<CR>
|
2024-01-19 22:17:16 +01:00
|
|
|
|
2024-02-14 07:54:31 +01:00
|
|
|
" ###########################################
|
|
|
|
" # TAGBAR
|
|
|
|
" ###########################################
|
2024-01-19 22:17:16 +01:00
|
|
|
let g:tagbar_ctags_bin = "ectags"
|
2024-02-14 07:54:31 +01:00
|
|
|
noremap <F12> :TagbarToggle<CR>
|
2024-01-19 22:17:16 +01:00
|
|
|
|
2024-02-14 07:54:31 +01:00
|
|
|
" ###########################################
|
|
|
|
" # TAGS FILE
|
|
|
|
" ###########################################
|
2024-01-19 23:46:43 +01:00
|
|
|
set tags=./tags;/
|
2024-01-24 08:07:09 +01:00
|
|
|
nnoremap gb <c-o>
|
2024-01-24 08:27:45 +01:00
|
|
|
nnoremap gs :call Cscope('0', expand('<cword>'), 0)<CR>
|
|
|
|
nnoremap gc :call Cscope('3', expand('<cword>'), 0)<CR>
|
|
|
|
nnoremap ge :call Cscope('6', expand('<cword>'), 0)<CR>
|
|
|
|
|
2024-02-14 07:54:31 +01:00
|
|
|
" ###########################################
|
|
|
|
" # CSCOPE
|
|
|
|
" ###########################################
|
2024-01-24 08:27:45 +01:00
|
|
|
function! LoadCscope()
|
|
|
|
let db = findfile("cscope.out", ".;")
|
|
|
|
if (!empty(db))
|
|
|
|
let path = strpart(db, 0, match(db, "/cscope.out$"))
|
|
|
|
set nocscopeverbose " suppress 'duplicate connection' error
|
|
|
|
exe "cs add " . db . " " . path
|
|
|
|
set cscopeverbose
|
|
|
|
" else add the database pointed to by environment variable
|
|
|
|
elseif $CSCOPE_DB != ""
|
|
|
|
cs add $CSCOPE_DB
|
|
|
|
endif
|
|
|
|
endfunction
|
|
|
|
|
2024-02-14 07:54:31 +01:00
|
|
|
|
|
|
|
|
|
|
|
" ###########################################
|
|
|
|
" # EASY ALIGN
|
|
|
|
" ###########################################
|
|
|
|
xmap ga <Plug>(EasyAlign)
|
|
|
|
nmap ga <Plug>(EasyAlign)
|
|
|
|
|
|
|
|
" ###########################################
|
|
|
|
" # AUTORUN
|
|
|
|
" ###########################################
|
2023-08-19 11:12:22 +02:00
|
|
|
augroup mystuff
|
|
|
|
au!
|
2024-02-14 07:54:31 +01:00
|
|
|
au VimResized * wincmd =
|
|
|
|
au BufEnter * let g:bufno=len(getbufinfo({'buflisted':1}))
|
2024-01-24 08:30:44 +01:00
|
|
|
au BufEnter * call LoadCscope()
|
2023-10-30 20:13:00 +01:00
|
|
|
au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
|
2023-08-19 11:12:22 +02:00
|
|
|
au BufRead,BufNewFile *.h,*.c set filetype=c.doxygen
|
|
|
|
au BufRead,BufNewFile Makefile,/usr/src/*.c,/usr/src/*.h,*.gmk setl sw=8 sts=8 noet
|
|
|
|
au BufWritePost vimrc so ~/.vim/vimrc
|
|
|
|
augroup end
|
2024-01-18 21:23:17 +01:00
|
|
|
|