2022-12-04 23:41:31 +01:00
|
|
|
execute pathogen#infect()
|
2022-12-08 10:05:54 +01:00
|
|
|
" Helptags
|
2022-12-04 23:41:31 +01:00
|
|
|
|
|
|
|
" VIM CORE
|
|
|
|
set nocompatible
|
|
|
|
set autochdir
|
|
|
|
set notitle
|
|
|
|
set shm+=I
|
|
|
|
set path+=.,**
|
|
|
|
set mouse=v
|
|
|
|
set laststatus=2
|
|
|
|
set keywordprg="man"
|
|
|
|
set backspace=indent,eol,start
|
|
|
|
set ttimeout
|
|
|
|
set ttimeoutlen=50
|
|
|
|
set number
|
|
|
|
set cursorline
|
|
|
|
set scrolloff=3
|
|
|
|
set spelllang=de,en
|
|
|
|
syntax on
|
|
|
|
filetype plugin indent on
|
|
|
|
set mmp=5000
|
|
|
|
set spelllang=de,en
|
|
|
|
set re=1
|
|
|
|
let mapleader = ","
|
2022-12-11 19:21:58 +01:00
|
|
|
|
|
|
|
" * and # are only highlighting
|
|
|
|
" n searches in the direction of * or #
|
2022-12-04 23:41:31 +01:00
|
|
|
nnoremap * *``
|
2022-12-11 19:21:58 +01:00
|
|
|
nnoremap # #``
|
|
|
|
nnoremap n <S-n>
|
2022-12-04 23:41:31 +01:00
|
|
|
|
|
|
|
" INDENTATION
|
|
|
|
set noautoindent
|
|
|
|
set nosmartindent
|
|
|
|
set nocindent
|
|
|
|
|
|
|
|
" DIFF
|
|
|
|
set formatoptions=crolj
|
|
|
|
|
|
|
|
" SEARCH
|
|
|
|
set hlsearch
|
|
|
|
set ignorecase
|
|
|
|
set smartcase
|
|
|
|
|
|
|
|
" SPACES (TABS)
|
|
|
|
set tabstop=8
|
|
|
|
set shiftwidth=4
|
|
|
|
let &softtabstop=&shiftwidth
|
|
|
|
set expandtab
|
|
|
|
set smarttab
|
|
|
|
set textwidth=72
|
|
|
|
|
|
|
|
set list
|
|
|
|
set listchars=tab:»·,trail:•
|
|
|
|
set fillchars=vert:\|,eob:\
|
|
|
|
|
|
|
|
set showcmd
|
|
|
|
set clipboard=unnamedplus
|
|
|
|
|
|
|
|
" C specific highlighting
|
|
|
|
let c_space_errors=1
|
|
|
|
let c_gnu=1
|
|
|
|
let c_comment_strings=1
|
|
|
|
let c_curly_error=1
|
2022-12-11 11:55:10 +01:00
|
|
|
"set makeprg=cc\ -o\ %:r\ %
|
2022-12-04 23:41:31 +01:00
|
|
|
set autowrite
|
|
|
|
|
|
|
|
" TEMPORARY FILES
|
|
|
|
set undofile
|
|
|
|
set undodir=~/.local/vim/undo//
|
|
|
|
set backup
|
|
|
|
set backupcopy=yes
|
|
|
|
set backupdir=~/.local/vim/backup//
|
|
|
|
set directory=~/.local/vim/swapfiles//
|
|
|
|
set updatetime=2000
|
|
|
|
set updatecount=100
|
|
|
|
|
2022-12-11 19:21:58 +01:00
|
|
|
" TAB LINE
|
|
|
|
set tabline=%!Tabline()
|
|
|
|
function! Tabline() abort
|
|
|
|
let l:line = ''
|
|
|
|
for l:i in range(1, tabpagenr('$'))
|
|
|
|
if l:i == tabpagenr()
|
|
|
|
let l:line .= '%#TabLineSel#'
|
|
|
|
else
|
|
|
|
let l:line .= '%#TabLine#'
|
|
|
|
endif
|
|
|
|
let l:label = fnamemodify(
|
|
|
|
\ bufname(tabpagebuflist(l:i)[tabpagewinnr(l:i) - 1]), ':t' )
|
|
|
|
let l:line .= ' ' . l:label . ' '
|
|
|
|
endfor
|
|
|
|
let l:line .= '%#TabLineFill#'
|
|
|
|
return l:line
|
|
|
|
endfunction
|
|
|
|
|
2022-12-04 23:41:31 +01:00
|
|
|
" CREATE DIRECTORIES
|
|
|
|
silent execute '!mkdir -p ~/.local/vim/backup ~/.local/vim/undo ~/.local/vim/swapfiles'
|
|
|
|
silent execute 'cs add ~/.dev/cscope.out'
|
|
|
|
set csprg=cscope\ -C
|
|
|
|
set cst
|
|
|
|
set cspc=9
|
|
|
|
|
|
|
|
" LOOK N FEEL
|
|
|
|
set t_Co=256
|
|
|
|
set t_ut=
|
|
|
|
set background=dark
|
|
|
|
let g:is_posix=1
|
|
|
|
|
|
|
|
" HIGHLIGHT SPECIAL WORDS
|
|
|
|
match ErrorMsg '\(TODO:\|FIXME\|XXX\|workaround\|WTF\|: error:.*\|\s\+$\| \+\ze\t\)'
|
|
|
|
|
|
|
|
" MY THEME
|
2022-12-11 19:21:58 +01:00
|
|
|
hi TabLine ctermbg=234 ctermfg=240 cterm=NONE
|
|
|
|
hi TabLineFill ctermbg=234 ctermfg=240 cterm=NONE
|
|
|
|
hi TabLineSel ctermbg=234 ctermfg=249 cterm=NONE
|
2022-12-04 23:41:31 +01:00
|
|
|
hi Comment ctermbg=NONE ctermfg=249 cterm=italic
|
|
|
|
hi Constant ctermbg=NONE ctermfg=251 cterm=italic
|
|
|
|
hi CursorLine ctermbg=NONE ctermfg=NONE cterm=NONE
|
|
|
|
hi CursorLineNr ctermbg=NONE ctermfg=NONE cterm=NONE
|
|
|
|
hi Directory ctermbg=NONE ctermfg=NONE cterm=NONE
|
|
|
|
hi Error ctermbg=NONE ctermfg=NONE cterm=NONE
|
|
|
|
hi ErrorMsg ctermbg=NONE ctermfg=196 cterm=NONE
|
|
|
|
hi Folded ctermbg=NONE ctermfg=246 cterm=inverse
|
|
|
|
hi Identifier ctermbg=NONE ctermfg=NONE cterm=NONE
|
|
|
|
hi Identifier ctermbg=NONE ctermfg=NONE cterm=NONE
|
|
|
|
hi Ignore ctermbg=NONE ctermfg=NONE cterm=NONE
|
|
|
|
hi IncSearch ctermbg=NONE ctermfg=251 cterm=inverse
|
|
|
|
hi LineNr ctermbg=NONE ctermfg=240 cterm=NONE
|
|
|
|
hi MatchParen ctermbg=NONE ctermfg=251 cterm=bold
|
|
|
|
hi NonText ctermbg=NONE ctermfg=NONE cterm=NONE
|
|
|
|
hi Normal ctermbg=NONE ctermfg=NONE cterm=NONE
|
|
|
|
hi Pmenu ctermbg=NONE ctermfg=251 cterm=inverse
|
|
|
|
hi PmenuSel ctermbg=NONE ctermfg=251 cterm=bold
|
|
|
|
hi PreProc ctermbg=NONE ctermfg=251 cterm=NONE
|
|
|
|
hi Search ctermbg=NONE ctermfg=251 cterm=inverse
|
|
|
|
hi SignColumn ctermbg=NONE ctermfg=NONE cterm=NONE
|
|
|
|
hi Special ctermbg=NONE ctermfg=NONE cterm=NONE
|
|
|
|
hi SpecialComment ctermbg=NONE ctermfg=NONE cterm=NONE
|
|
|
|
hi SpecialKey ctermbg=NONE ctermfg=239 cterm=NONE
|
|
|
|
hi Statement ctermbg=NONE ctermfg=NONE cterm=NONE
|
|
|
|
hi Statement ctermbg=NONE ctermfg=251 cterm=NONE
|
|
|
|
hi String ctermbg=NONE ctermfg=251 cterm=NONE
|
|
|
|
hi TODO ctermbg=NONE ctermfg=246 cterm=italic
|
|
|
|
hi Title ctermbg=NONE ctermfg=246 cterm=bold
|
|
|
|
hi Type ctermbg=NONE ctermfg=NONE cterm=NONE
|
|
|
|
hi Underlined ctermbg=NONE ctermfg=251 cterm=underline
|
|
|
|
hi VisualNOS ctermbg=NONE ctermfg=246 cterm=NONE
|
|
|
|
hi WarningMsg ctermbg=NONE ctermfg=NONE cterm=NONE
|
|
|
|
hi Wildmenu ctermbg=NONE ctermfg=NONE cterm=NONE
|
|
|
|
|
|
|
|
|
|
|
|
" VIMDIFF COLORS
|
|
|
|
hi DiffAdd ctermbg=22 ctermfg=NONE cterm=NONE
|
|
|
|
hi DiffDelete ctermbg=234 ctermfg=NONE cterm=NONE
|
|
|
|
hi DiffChange ctermbg=234 ctermfg=NONE cterm=NONE
|
|
|
|
hi DiffText ctermbg=NONE ctermfg=NONE cterm=NONE
|
|
|
|
|
|
|
|
" SPLIT AND FOLD COLORS
|
|
|
|
hi VertSplit ctermbg=NONE ctermfg=246 cterm=NONE
|
|
|
|
hi FoldColumn ctermbg=NONE ctermfg=251 cterm=NONE
|
|
|
|
hi Folded ctermbg=233 ctermfg=251 cterm=NONE
|
|
|
|
|
|
|
|
" SPELL COLOR
|
|
|
|
hi SpellBad ctermbg=NONE ctermfg=124
|
|
|
|
|
|
|
|
" C+PgUp/PgDown
|
|
|
|
nnoremap gn :next<CR>
|
|
|
|
nnoremap gp :prev<CR>
|
|
|
|
|
|
|
|
" NAVIGATE ON VISUAL LINES (SOFT WRAP)
|
|
|
|
imap <silent> <Down> <C-o> gj
|
|
|
|
imap <silent> <Up> <C-o> gk
|
|
|
|
nmap <silent> <Down> gj
|
|
|
|
nmap <silent> <Up> gk
|
|
|
|
|
|
|
|
" USE ARROW / VIM KEYS INSIDE OMNIBOX
|
|
|
|
inoremap <expr> j pumvisible() ? '<C-n>' : 'j'
|
|
|
|
inoremap <expr> k pumvisible() ? '<C-p>' : 'k'
|
|
|
|
inoremap <expr> <Down> pumvisible() ? '<C-n>' : '<Down>'
|
|
|
|
inoremap <expr> <Up> pumvisible() ? '<C-p>' : '<Up>'
|
|
|
|
|
|
|
|
" NETRW
|
|
|
|
let g:netrw_banner = 0
|
|
|
|
let g:netrw_browse_split = 3
|
|
|
|
let g:netrw_liststyle = 3
|
|
|
|
let g:netrw_ctags = "ectags"
|
|
|
|
let g:netrw_silent = 1
|
|
|
|
|
|
|
|
" STATUSLINE, AIRLINE/POWERLINE IS FOR NOOBS
|
|
|
|
set statusline=%#VisualNOS#
|
|
|
|
set statusline+=%F\ (%{&filetype})
|
|
|
|
set statusline+=%=
|
|
|
|
set statusline+=%m%r%h%w%q
|
|
|
|
set statusline+=\ %{&fileformat}/%{&fileencoding?&fileencoding:&encoding}
|
|
|
|
set statusline+=\ %b/0x%B
|
|
|
|
set statusline+=\ %c\ %p%%
|
|
|
|
set statusline+=\
|
|
|
|
|
2022-12-11 19:21:58 +01:00
|
|
|
|
|
|
|
" OPEN FILE
|
|
|
|
nnoremap <C-t> :Texplore<CR>
|
|
|
|
|
2022-12-04 23:41:31 +01:00
|
|
|
" TAGS FILE
|
|
|
|
set tags="~/.dev/tags"
|
|
|
|
nnoremap gt :cs find 1 <C-R>=expand("<cword>")<CR><CR>
|
|
|
|
nnoremap gg :cs find 4 <C-R>=expand("<cword>")<CR><CR>
|
|
|
|
nnoremap gb <c-o>
|
|
|
|
nnoremap gh :FSHere<CR>
|
|
|
|
|
|
|
|
nnoremap oo :browse oldfiles<CR>
|
|
|
|
nnoremap XX :qall!<CR>
|
|
|
|
|
|
|
|
" PLUGIN: TAGBAR
|
|
|
|
nmap <F12> :TagbarToggle<CR>
|
|
|
|
let g:tagbar_ctags_bin = "ectags"
|
|
|
|
|
|
|
|
" PLUGIN: EASY ALIGN
|
|
|
|
xmap ga <Plug>(EasyAlign)
|
|
|
|
nmap ga <Plug>(EasyAlign)
|
|
|
|
|
2022-12-11 11:55:10 +01:00
|
|
|
" Compile Stuff
|
|
|
|
nnoremap mm :call MyMake()<CR>
|
2022-12-11 19:21:58 +01:00
|
|
|
nnoremap mr :!%:p:r<CR>
|
2022-12-11 11:55:10 +01:00
|
|
|
function MyMake()
|
2022-12-12 07:51:54 +01:00
|
|
|
:silent !clear
|
2022-12-11 11:55:10 +01:00
|
|
|
if filereadable("Makefile")
|
2022-12-11 19:21:58 +01:00
|
|
|
:w! | !make
|
2022-12-11 11:55:10 +01:00
|
|
|
else
|
2022-12-11 19:21:58 +01:00
|
|
|
:w! | !cc -o %:p:r %:p
|
2022-12-11 11:55:10 +01:00
|
|
|
endif
|
|
|
|
endfunction
|
|
|
|
|
2022-12-04 23:41:31 +01:00
|
|
|
" CUSTOM: NO CLUTTER PASTE MODE
|
|
|
|
nnoremap <silent> <Tab> :call TogglePaste()<CR>
|
|
|
|
let g:paste=0
|
|
|
|
function! TogglePaste()
|
|
|
|
if (g:paste == 0)
|
|
|
|
:set paste nolist nonumber |
|
|
|
|
\ echo "-- PASTE --"
|
|
|
|
let g:paste=1
|
|
|
|
else
|
|
|
|
:set nopaste list number |
|
|
|
|
\ echo "-- NOPASTE --"
|
|
|
|
let g:paste=0
|
|
|
|
endif
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
" CUSTOM: COPY ACROSS VIM INSTANCES
|
|
|
|
vnoremap vy :call VisualYank()<CR>
|
|
|
|
nnoremap vp :call VisualPaste()<CR>
|
|
|
|
let s:temp_file_path = $HOME . '/.cache/vim-snap'
|
|
|
|
function! VisualYank()
|
|
|
|
call writefile(getline(getpos("'<")[1],
|
|
|
|
\ getpos("'>")[1]), s:temp_file_path)
|
|
|
|
endfunction
|
|
|
|
function! VisualPaste()
|
|
|
|
let file_msg = readfile(s:temp_file_path)
|
|
|
|
call append(line("."), file_msg)
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
augroup mystuff
|
|
|
|
au!
|
|
|
|
au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
|
|
|
|
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
|