-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvimrc
121 lines (97 loc) · 3.86 KB
/
vimrc
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
"
" Enable Pathogen plugin manager
"
execute pathogen#infect()
call pathogen#helptags()
"
" General Settings
"
let mapleader=" " " Leader is space
set nocompatible " Enable all the fancy features
set term=$TERM " Terminal type
set background=dark " Optimise font colours for dark background
set mouse=a " Enable mouse usage (all modes) in terminals
set textwidth=78 " Wrap line at 78
set colorcolumn=+2 " Make it obvious where 80 characters is
set cursorline " Highlight the current line
hi cursorline cterm=NONE ctermbg=234
set ruler " Show line and column number
set showcmd " Show (partial) command in status line.
set wildmenu " Visual autocomplete for command menu
set wildmode=longest,list " use emacs-style tab completion when selecting files, etc
set hidden " Hide buffers when they are abandoned
" set spell spelllang=en_gb " Spell checking
set list listchars=tab:»·,trail:·,nbsp:· " Display extra whitespace
" Jump directly to the last position when reopening a file
if has("autocmd")
au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$")
\| exe "normal! g'\"" | endif
endif
"
" Searching
"
set showmatch " Show matching brackets
set ignorecase " Do case insensitive matching
set smartcase " Do smart case matching
set incsearch " Incremental search
set hlsearch " Highlight all matches
nnoremap <leader>/ :nohlsearch<CR> " Turn off current search highlights
"
" Screen Management
"
nnoremap <leader>s :mksession<CR> " Save session
nnoremap <leader>S :mksession!<CR> " Overwrite saved session
nmap <leader>n <plug>NERDTreeTabsToggle<CR> " <space>n toggles NERDTree
nnoremap <leader>bd :MBEbd<CR> " :bd style behaviour for MBEbd
nnoremap <leader><leader> <c-^> " Switch between the last two files
" Use ctrl-[hjkl] to select the active split
nmap <silent> <C-h> :wincmd h<CR>
nmap <silent> <C-j> :wincmd j<CR>
nmap <silent> <C-k> :wincmd k<CR>
nmap <silent> <C-l> :wincmd l<CR>
" Use <leader>-[hjkl] to select the active split
nmap <leader>h :wincmd h<CR>
nmap <leader>j :wincmd j<CR>
nmap <leader>k :wincmd k<CR>
nmap <leader>l :wincmd l<CR>
" Use <leader> with cursor keys to select the active split
nmap <leader><left> :wincmd h<CR>
nmap <leader><down> :wincmd j<CR>
nmap <leader><up> :wincmd k<CR>
nmap <leader><right> :wincmd l<CR>
" Fast window resizing with +/_ keys (horizontal); =/- keys (vertical)
map + <C-W>+
map _ <C-W>-
map = <c-w>>
map - <c-w><
"
" Programming Settings
"
syntax on " Enable syntax highlighting
set number " Line numbering. Disable with "set nonumber"
set numberwidth=5
" YCM Symbol Search
nmap <leader>yfw <Plug>(YCMFindSymbolInWorkspace)
nmap <leader>yfd <Plug>(YCMFindSymbolInDocument)
" YCM GoTo
nnoremap <leader>jd :YcmCompleter GoTo<CR>
" YCM Autoclose the preview window
let g:ycm_autoclose_preview_window_after_completion = 1
" set autowrite " Automatically save before commands like :next and :make
" Toggle line numbers and fold column for easy copying:
" nnoremap <F2> :set nonumber!<CR>:set foldcolumn=0<CR>
" Set the working directory to be the same as the buffer currently being edited
" This messes with cscope so is disabled here
" set autochdir
"
" Indentation
"
filetype plugin indent on " Load indentation rules based on detected filetype
set backspace=indent,eol,start " Allow backspace over autoindent and linebreaks
set pastetoggle=<F10> " Allow pasting without autoindenting
set tabstop=4 " Number of spaces that a tab represents
set shiftwidth=4 " Number of spaces to use for each step of (auto)indent
set softtabstop=4 " Number of spaces a tab counts for
set smarttab " Indent by shiftwidth when tabbing at start of line
set expandtab " Spaces instead of tabs (CTRL-V<Tab> to insert a real tab)
set autoindent " Copy indent from current line when starting a new line