summaryrefslogtreecommitdiffstats
path: root/.vimrc
blob: 0494971eca5463e424f410cbf8a1fb2be78d99a1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
set nocompatible

set laststatus=2
set encoding=utf-8
set autoindent
set magic
set ruler
set nowrap
set colorcolumn=+1
set list listchars=tab:›\ ,extends:→,precedes:←
set ignorecase
set smartcase
set notimeout
set incsearch
set showmatch
set nofoldenable
set lazyredraw
set wildmenu
set spc=

let mapleader = ","
nnoremap Y y$
nnoremap <silent><expr> \ (&hls && v:hlsearch ? ':nohls' : ':set hls')."\n"

inoremap <C-X><C-B> <C-O>:set rl!<CR>

" for the emacsian in me
nnoremap <C-g> <ESC>
inoremap <C-g> <ESC>
vnoremap <C-g> <ESC>
xnoremap <C-g> <ESC>
snoremap <C-g> <ESC>
cnoremap <C-g> <ESC>
onoremap <C-g> <ESC>

syntax enable
" highlight StatusLine cterm=none ctermbg=none ctermfg=darkgrey
" highlight StatusLineNC cterm=none ctermbg=none ctermfg=darkgrey
highlight ColorColumn ctermbg=black

autocmd FileType text,mail,markdown,rst,gitcommit setlocal tw=70 et ts=2 sw=2

function! ConflictsHighlight() abort
  syntax region conflictStart start=/^<<<<<<< .*$/ end=/^\ze\(=======$\||||||||\)/
  syntax region conflictMiddle start=/^||||||| .*$/ end=/^\ze=======$/
  syntax region conflictEnd start=/^\(=======$\||||||| |\)/ end=/^>>>>>>> .*$/

  highlight conflictStart ctermbg=red ctermfg=black
  highlight conflictMiddle ctermbg=blue ctermfg=black
  highlight conflictEnd ctermbg=green cterm=bold ctermfg=black
endfunction

augroup MyColors
  autocmd!
  autocmd BufEnter * call ConflictsHighlight()
augroup END

" --[ from $VIMRUNTIME/defautls.vim ]--
" When editing a file, always jump to the last known cursor position.
" Don't do it when the position is invalid, when inside an event handler
" (happens when dropping a file on gvim), for a commit or rebase message
" (likely a different one than last time), and when using xxd(1) to filter
" and edit binary files (it transforms input files back and forth, causing
" them to have dual nature, so to speak)
autocmd BufReadPost *
  \ let line = line("'\"")
  \ | if line >= 1 && line <= line("$") && &filetype !~# 'commit'
  \      && index(['xxd', 'gitrebase'], &filetype) == -1
  \ |   execute "normal! g`\""
  \ | endif