Skip to content

Instantly share code, notes, and snippets.

@DuBistKomisch
Created August 11, 2017 23:11
Show Gist options
  • Save DuBistKomisch/fc627b1fe8109834331adff6a48409ef to your computer and use it in GitHub Desktop.
Save DuBistKomisch/fc627b1fe8109834331adff6a48409ef to your computer and use it in GitHub Desktop.
" include plugins
execute pathogen#infect()
" compatibility
set nocompatible
set backspace=2
set hidden
set viminfo=
set mouse=a
" copy mode, allows selection in a graphical terminal
nnoremap <leader>y :set nonumber<CR> :set mouse=<CR>
nnoremap <leader>Y :set number<CR> :set mouse=a<CR>
" toggle paste mode
nnoremap <leader>p :set paste!<CR>
" syntax
filetype plugin indent on
syntax enable
" indent
set expandtab
set autoindent
set smarttab
set shiftwidth=2
set softtabstop=2
set tabstop=2
" search
set ignorecase
set smartcase
set incsearch
set hlsearch
nmap <leader>q :nohlsearch<CR>
nnoremap <leader>a :Ag!<space>
let g:ctrlp_match_window = 'bottom,order:ttb'
let g:ctrlp_switch_buffer = 0
let g:ctrlp_working_path_mode = 0
let g:ctrlp_user_command = 'ag %s -l --nocolor -g ""'
" movement
" inoremap <Down> <C-o>gj
" inoremap <Up> <C-o>gk
" nmap <Down> gj
" nmap <Up> gk
" statusbar
set laststatus=2
set noshowmode
" decoration
set t_Co=256
colorscheme inkpot
set number
set cursorline
set so=10
hi CursorLine cterm=NONE ctermbg=235
hi CursorLineNr cterm=NONE ctermbg=235
" trailing spaces and tabs
highlight ExtraWhitespace ctermbg=red
match ExtraWhitespace /\s\+$\|\t\+/
autocmd BufWinEnter * match ExtraWhitespace /\s\+$\|\t\+/
autocmd InsertEnter * match ExtraWhitespace /\s\+\%#\@<!$\|\t\+/
autocmd InsertLeave * match ExtraWhitespace /\s\+$\|\t\+/
autocmd BufWinLeave * call clearmatches()
function TrimWhitespace()
let _s=@/
%s/\s\+$//e
let @/=_s
endfunction
nmap <leader>t :call TrimWhitespace()<CR>
" temp files
let g:netrw_dirhistmax = 0
set backupdir=~/.vimtmp/backup/
set directory=~/.vimtmp/swap/
set undodir=~/.vimtmp/undo/
" git link
function! CopyGitLink(...) range
redir @+
silent echo gitlink#GitLink(get(a:, 1, 0))
redir END
endfunction
nmap <leader>gl :call CopyGitLink()<CR>
vmap <leader>gl :call CopyGitLink(1)<CR>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment