summaryrefslogtreecommitdiff
path: root/vimrc
blob: fe18419c161648b73a7041c4a48ec58e81c34ae2 (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
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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
" The .vimrc of laumann, written from scratch
" For some reason, the comment syntax is " and not #, but whatever.

" set relativenumber
" set number
set encoding=utf8
set ffs=unix,dos,mac
set title

set nocompatible	" We're running Vim, no Vi!
filetype on		" Enable filetype detection
filetype indent on	" Enable filetype-specific indenting
filetype plugin on	" Enable filetype-specific plugins

set incsearch
set hlsearch

set tabstop=8		" Number of spaces per tab
set softtabstop=8	" Number of spaces to insert when pressing tab
" set expandtab		" tabs are spaces, pressing <TAB> inserts spaces
set smarttab
set autoindent
" set number
set ruler

set ai			" Auto indent
set si			" Smart indent
set hidden		" Allow switching from buffers with unsaved changes

" Smart defaults
set showmatch		" Show matching [, { and (
set showcmd

" set list
set listchars=tab:▸\ 

if has("wildmenu")
	set wildmenu
	set wildmode=list,full

	" set up ignores
	set wildignore+=*.a,*.o
	set wildignore+=*.bmp,*.gif,*.ico,*.jpg,*.png
	set wildignore+=.git,.hg,.svn
	set wildignore+=*~,*.swp,*.tmp
endif

set formatoptions+=t
set textwidth=80

set laststatus=2	" Always show the status line
"set statusline=%f\ %L\ %y%=L%-4l\ C%-4c\
set statusline=\ %F%m%r%h\ %w\ %y\ \ CWD:\ %r%{getcwd()}%h\ \ \ L%4l/%-4L\ C%-4c\ \ %P

" Learning Vim the hard way
" Mapping arrow keys to <nop> to prevent myself from using them
inoremap <Up> <nop>
inoremap <Down> <nop>
inoremap <Left> <nop>
inoremap <Right> <nop>

" Plugins managed by vim-plug
call plug#begin('~/.vim/plugged')

Plug 'rust-lang/rust.vim'
Plug 'racer-rust/vim-racer'
Plug 'wincent/command-t'

" Color themes
" Plug 'pbrisbin/vim-colors-off'
" Plug 'andreypopp/vim-colors-plain'
" Plug 'liuchengxu/space-vim-dark'
Plug 'vim-airline/vim-airline'
Plug 'mbbill/undotree'

Plug 'ewilazarus/preto'
Plug 'pgdouyon/vim-yin-yang'
Plug 'lurst/austere.vim'
Plug '/usr/bin/fzf'

call plug#end()

"colorscheme off
"set bg=dark



" Leader
" So the leader is somewhere you can add custom commands with time - good to
" know.
"
" As a minimum, let the leader be "," - maybe space might even be a good choice
let mapleader = ","
nnoremap <leader>W :%s/\s\+$//<cr>:let @/=''<CR>
nnoremap <leader>w :w<CR>
nnoremap <leader>s :source ~/.vimrc<CR>
nnoremap <silent> <leader>/ :nohlsearch<CR>


" Use CommandTJump to switch buffers
nnoremap <leader>tb :CommandTJump<CR>

" FZF
nnoremap <leader>f :FZF<CR>

" Undotree
nnoremap <leader>ut :UndotreeToggle<CR>
nnoremap <leader>uf :UndotreeFocus<CR>

" cscope for Linux kernel development
if has("cscope")
	if filereadable("cscope.out")
		cs add cscope.out
	endif
	set csto=0

	" Add mappings
	noremap <leader>csg :cs find g <C-R>=expand("<cword>")<CR><CR>		" Find definition
	noremap <leader>css :cs find s <C-R>=expand("<cword>")<CR><CR>		" Find C symbol
	noremap <leader>csd :cs find d <C-R>=expand("<cword>")<CR><CR>		" Find functions called by this function
	noremap <leader>csc :cs find c <C-R>=expand("<cword>")<CR><CR>		" Find callers
endif

autocmd BufNewFile,BufRead COMMIT_EDITMSG syntax on

if has("gui_running")
	" No: scrollbars, menu, toolbar
	set guioptions-=L
	set guioptions-=b
	set guioptions-=r
	set guioptions-=m
	set guioptions-=T

	" Set font
	" set guifont=Inconsolata\ Regular\ 12
	set guifont=Hack\ 10

	" Open NERDTree
	" autocmd VimEnter * NERDTree
endif

syntax off
highlight Visual term=reverse ctermbg=159