summaryrefslogtreecommitdiff
path: root/vimrc
blob: abb9b5e28e05c4e9bb037922c20f696bf2caeb15 (plain)
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
syntax on
set cc=80,120
set number

set foldmethod=syntax
autocmd BufEnter * silent! %foldopen!

set autoindent
set tabstop=4
set shiftwidth=4
set softtabstop=4
set backspace=2

" Force remap C+Left and C+Right for moving on words in insert mode
map <ESC>[1;5C <C-Right>
map <ESC>[1;5D <C-Left>
map! <ESC>[1;5C <C-Right>
map! <ESC>[1;5D <C-Left>

set listchars=tab:─\ ,trail:·,space:·,nbsp:␣,extends:⯈,precedes:⯇
set showbreak=\\ 
set list


highlight ExtraWhitespace ctermbg=red guibg=red
highlight SpecialKey ctermfg=23
highlight NonText ctermfg=23
highlight Folded ctermbg=0
highlight ColorColumn ctermbg=234
match ExtraWhitespace /\s\+$/

inoremap <CR> <CR>x<BS>
inoremap jj <ESC>
inoremap jk <ESC>
nnoremap o ox<BS>
nnoremap O Ox<BS>
set pastetoggle=<F2>

function! ToggleHlsearch()
    if &hlsearch
        nohlsearch
        set nohlsearch
    else
        set hlsearch
    endif
endfunction

" highlighted search colours
hi Search ctermbg=DarkYellow ctermfg=Black
nnoremap <C-_> :call ToggleHlsearch()<cr>

hi Todo ctermbg=DarkGreen ctermfg=Black


"set expandtab
autocmd BufRead,BufNewFile *.cli setfiletype xml
autocmd BufRead,BufNewFile *.bnf setfiletype bnf
"autocmd FileType c setlocal expandtab
autocmd FileType make set noexpandtab
"autocmd FileType cpp setlocal expandtab
autocmd FileType yaml setlocal ts=2 sts=2 sw=2 expandtab
autocmd FileType bitbake setlocal expandtab
autocmd FileType python setlocal expandtab
autocmd FileType haskell setlocal expandtab
autocmd FileType lhaskell setlocal expandtab

""""""""""""""""""""""""""""""
" airline
""""""""""""""""""""""""""""""
let g:airline_theme             = 'powerlineish'
let g:airline_enable_branch     = 1
let g:airline_enable_syntastic  = 1
let g:airline_powerline_fonts = 1

" vim-powerline symbols
"let g:airline_left_sep          = '⮀'
"let g:airline_left_alt_sep      = '⮁'
"let g:airline_right_sep         = '⮂'
"let g:airline_right_alt_sep     = '⮃'
"let g:airline_branch_prefix     = '⭠'
"let g:airline_readonly_symbol   = '⭤'
"let g:airline_linecolumn_prefix = '⭡'

" makes airline work before split
set laststatus=2

" Nicer colours for solarised vimdiff
highlight DiffAdd    cterm=bold ctermfg=233  ctermbg=101 gui=none guifg=bg guibg=Red
highlight DiffDelete cterm=bold ctermfg=175  ctermbg=175 gui=none guifg=bg guibg=Red
highlight DiffChange cterm=bold ctermfg=234  ctermbg=101 gui=none guifg=bg guibg=Red
highlight DiffText   cterm=none ctermfg=242  ctermbg=0   gui=none guifg=bg guibg=Red

let g:previousmode = 'i'
function PushModeSwitchNormal() abort
	let g:previousmode = mode()
	" important: l so that we don't walk backward every time clutch is pushed
	return "\<C-\>\<C-n>l"
endfunction

function PopMode() abort
	return g:previousmode
endfunction

inoremap <expr> <F11> PushModeSwitchNormal()
vnoremap <expr> <F11> PushModeSwitchNormal()
xnoremap <expr> <F11> PushModeSwitchNormal()
snoremap <expr> <F11> PushModeSwitchNormal()
onoremap <expr> <F11> PushModeSwitchNormal()
inoremap <F12> <Nop>
vnoremap <F12> <Nop>
xnoremap <F12> <Nop>
snoremap <F12> <Nop>
onoremap <F12> <Nop>
nnoremap <expr> <F12> PopMode()