dotfiles/.vim/vimrc

410 lines
11 KiB
VimL
Raw Normal View History

set nocompatible
" mouse support
set mouse=
" real backspace, please
set backspace=indent,eol,start
" disable welcome screen
set shm+=I
" don't complain about $( )
let g:is_posix=1
" colors
set t_Co=257
set background=dark
colorscheme lucius
set cursorline
set scrolloff=3
set spelllang=de,en
"
syntax on
filetype plugin on
set omnifunc=syntaxcomplete#Complete
" 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 colorcolumn=72
set formatprg=par\ -w72q
set list
set listchars=tab:>_,trail:>
set fillchars=vert:\|,eob:\
" autocomplete
set wildmenu
set wildmode=longest:full,full
function! CleverTab()
if strpart( getline('.'), 0, col('.')-1 ) =~ '^\s*$'
return "\<Tab>"
else
return "\<C-N>"
endif
endfunction
inoremap <tab> <C-R>=CleverTab()<CR>
function! s:build_quickfix_list(lines)
call setqflist(map(copy(a:lines), '{ "filename": v:val, "lnum": 1 }'))
copen
cc
endfunction
let g:fzf_layout = { 'down': '40%' }
nnoremap <c-o> :Files<CR>
nnoremap <c-b> :Buffers<CR>
let g:fzf_action = {
\ 'ctrl-t': 'tab split',
\ 'ctrl-x': 'vsplit' }
let g:fzf_vim = {}
let g:fzf_vim.tags_command = 'ksh -ic mktags'
let g:mapleader = ","
nnoremap <leader>f :Files<CR>
nnoremap <leader>o :Buffers<CR>
nnoremap <leader>l :Lines<CR>
nnoremap <leader>t :Tags<CR>
let g:tagbar_ctags_bin = "ectags"
noremap <leader>tt :TagbarToggle<CR>
" TAGS FILE
set tags=./tags;/
"nnoremap gt :cs find 1 <C-R>=expand("<cword>")<CR><CR>
"nnoremap gs :cs find 4 <C-R>=expand("<cword>")<CR><CR>
"nnoremap gb <c-o>
"nnoremap gh :FSHere<CR>
let g:fzf_tags_prompt = "Gd "
noreabbrev <expr> ts getcmdtype() == ":" && getcmdline() == 'ts' ? 'FZFTselect' : 'ts'
nmap gt <Plug>(fzf_tags)
let g:autotagTagsFile = ".tags"
let g:autotagCtagsCmd = "ectags"
" HIGHLIGHT SPECIAL WORDS
match ErrorMsg '\(TODO:\|FIXME\|XXX\|workaround\|WTF\|: error:.*\|\s\+$\| \+\ze\t\)'
" DIFF
set formatoptions=crolj
" 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'
" PLUGIN: EASY ALIGN
xmap ga <Plug>(EasyAlign)
nmap ga <Plug>(EasyAlign)
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
" set autochdir
" set shm+=I
" set path+=.,**
" set mouse=v
" set laststatus=2
" set backspace=indent,eol,start
"
" set nonumber
" set cursorline
" set scrolloff=3
" set spelllang=de,en
"
" syntax off
" filetype on
"
" set spelllang=de,en
" let mapleader = ","
"
" " * and # are only highlighting
" " n searches in the direction of * or #
" " nnoremap * *``
" " nnoremap # #``
" " nnoremap n <S-n>
"
" " SMOOTH SCROLLING
" set t_TI=[4?h
" set t_TE=[4?l
"
" " 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 colorcolumn=72
" set formatprg=par\ -w72q
"
" 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
" "set makeprg=cc\ -o\ %:r\ %
" 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
" silent execute '!mkdir -p ~/.local/vim/backup ~/.local/vim/undo ~/.local/vim/swapfiles'
"
" " 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
"
" " CREATE DIRECTORIES
" silent execute 'cs add ~/.dev/cscope.out'
" set csprg=cscope\ -C
" set cst
" set cspc=9
"
" " LOOK N FEEL
" set t_ut=
" let g:is_posix=1
"
" set background=dark
" colorscheme lucius
"
"
"
" " " MY THEME
" " hi ColorColumn ctermbg=234 ctermfg=249 cterm=NONE
" " hi CursorLine ctermbg=NONE ctermfg=NONE cterm=NONE
" " hi CursorLineNr ctermbg=NONE ctermfg=NONE cterm=NONE
" " hi LineNr ctermbg=NONE ctermfg=240 cterm=NONE
" " hi Comment ctermbg=NONE ctermfg=240 cterm=NONE
" " hi Constant ctermbg=NONE ctermfg=251 cterm=italic
" " 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 MatchParen ctermbg=NONE ctermfg=202 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=251 cterm=NONE
" " hi Statement ctermbg=NONE ctermfg=NONE cterm=NONE
" " hi String ctermbg=NONE ctermfg=251 cterm=NONE
" " hi TODO ctermbg=NONE ctermfg=246 cterm=italic
" " hi TabLine ctermbg=NONE ctermfg=240 cterm=NONE
" " hi TabLineFill ctermbg=NONE ctermfg=240 cterm=NONE
" " hi TabLineSel ctermbg=NONE ctermfg=249 cterm=NONE
" " 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=52 ctermfg=NONE
" hi SpellCap ctermbg=22 ctermfg=NONE cterm=NONE
" hi SpellRare ctermbg=130 ctermfg=NONE
"
" " 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
" let g:netrw_sftp_cmd = "sftp -q"
" let g:netrw_scp_cmd = "scp -q"
"
" " " 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+=\ dec:%b\ hex:%B
" " " set statusline+=\ count:%{(mode()=='V')?wordcount().visual_words:wordcount().words}w
" " " set statusline+=/%{(mode()=='V')?wordcount().visual_chars:wordcount().chars}c
" " set statusline+=\ line:%l\ col:%c
" " set statusline+=\ %p%%
" " set statusline+=\
" "
" " " ITALIC FIX
" " set t_ZH=
" " set t_ZR=
"
"
" " OPEN FILE
" " nnoremap <C-t> :Texplore<CR>
" nnoremap <C-t> :Files<CR>
" inoremap <C-t> <ESC>:Files<CR>
"
" " TAGS FILE
" set tags="~/.dev/tags"
" nnoremap gt :cs find 1 <C-R>=expand("<cword>")<CR><CR>
" nnoremap gs :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)
"
" " Compile Stuff
" nnoremap mm :call MyMake()<CR>
" nnoremap mr :!clear && %:p:r<CR>
" function MyMake()
" :silent !clear
" if filereadable("Makefile")
" :w! | !make
" else
" :w! | !cc -Wall -g -O0 -o %:p:r -lsndio %:p
" endif
" endfunction
"
" " 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
"
" " CUSTOM: HTMLENCODE WITHOUT PRE
" function! BlogEncode()
" :%s/>/\&gt;/g | %s/</\&lt;/g | %s/&lt;pre&gt;/<pre>/g | %s/&lt;\/pre&gt;/<\/pre>/g
" endfunction