" load plugins execute pathogen#infect() Helptags set nocompatible " mouse support set mouse= " real backspace, please set backspace=indent,eol,start " don't complain about $( ) let g:is_posix=1 " colors 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:\ set wildmenu set wildmode=longest:full,full function! s:build_quickfix_list(lines) call setqflist(map(copy(a:lines), '{ "filename": v:val, "lnum": 1 }')) copen cc endfunction " let g:fzf_history_dir = '~/.local/vim/fzf-history' let g:fzf_layout = { 'down': '40%' } nnoremap :FZF -i -e --layout=reverse let g:fzf_action = { \ 'ctrl-t': 'tab split', \ 'ctrl-x': 'split', \ 'ctrl-v': 'vsplit' } function! CleverTab() if strpart( getline('.'), 0, col('.')-1 ) =~ '^\s*$' return "\" else return "\" endif endfunction inoremap =CleverTab() " 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' 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 " " " 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_Co=256 " 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 " nnoremap gp :prev " " " NAVIGATE ON VISUAL LINES (SOFT WRAP) " imap gj " imap gk " nmap gj " nmap gk " " " USE ARROW / VIM KEYS INSIDE OMNIBOX " inoremap j pumvisible() ? '' : 'j' " inoremap k pumvisible() ? '' : 'k' " inoremap pumvisible() ? '' : '' " inoremap pumvisible() ? '' : '' " " " 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 :Texplore " nnoremap :Files " inoremap :Files " " " TAGS FILE " set tags="~/.dev/tags" " nnoremap gt :cs find 1 =expand("") " nnoremap gs :cs find 4 =expand("") " nnoremap gb " nnoremap gh :FSHere " " nnoremap oo :browse oldfiles " nnoremap XX :qall! " " " PLUGIN: TAGBAR " nmap :TagbarToggle " let g:tagbar_ctags_bin = "ectags" " " " PLUGIN: EASY ALIGN " xmap ga (EasyAlign) " nmap ga (EasyAlign) " " " Compile Stuff " nnoremap mm :call MyMake() " nnoremap mr :!clear && %:p:r " 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 :call TogglePaste() " 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() " nnoremap vp :call VisualPaste() " 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/>/\>/g | %s//g | %s/<\/pre>/<\/pre>/g " endfunction