-
Notifications
You must be signed in to change notification settings - Fork 0
/
vimrc
80 lines (65 loc) · 2.33 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
set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'
Plugin 'preservim/nerdtree'
Plugin 'airblade/vim-gitgutter'
Plugin 'jiangmiao/auto-pairs'
Plugin 'igankevich/mesonic'
Plugin 'tikhomirov/vim-glsl'
Plugin 'kergoth/vim-bitbake'
Plugin 'bfrg/vim-cpp-modern'
call vundle#end() " required
filetype plugin indent on " required
" Ctrl + s - exit interactive mode & save file
" Ctrl + d - save & exit
" Ctrl + q - quit discarding changes
" Need run this command: echo 'stty -ixon' >> ~/.bashrc && exec $SHELL
inoremap <C-s> <esc>:w<cr>
nnoremap <C-s> :w<cr>
inoremap <C-d> <esc>:wq!<cr>
nnoremap <C-d> :wq!<cr>
inoremap <C-q> <esc>:qa!<cr>
nnoremap <C-q> :qa!<cr>
nnoremap + :res +5<CR>
nnoremap _ :res -5<CR>
" \<space> removes highlighted search results
map <Leader><Space> :noh<CR>
syntax enable
set background=dark
colorscheme onedark
set number
set wildmenu
set lazyredraw
set showmatch
set incsearch
set hlsearch
" NERDTree show hidden files
let NERDTreeShowHidden=1
let g:NERDTreeWinSize=40
" Affects both C and C++ files
let g:cpp_function_highlight = 1
let g:cpp_attributes_highlight = 1
let g:cpp_member_highlight = 1
let g:cpp_simple_highlight = 1
" Enable vulkan syntax
autocmd FileType cpp,c source $HOME/.vim/syntax/vulkan.vim
" Start NERDTree and put the cursor back in the other window.
autocmd VimEnter * NERDTree | wincmd p
" Exit Vim if NERDTree is the only window remaining in the only tab.
autocmd BufEnter * if tabpagenr('$') == 1 && winnr('$') == 1 && exists('b:NERDTree') && b:NERDTree.isTabTree() | quit | endif
" If another buffer tries to replace NERDTree, put it in the other window, and bring back NERDTree.
autocmd BufEnter * if bufname('#') =~ 'NERD_tree_\d\+' && bufname('%') !~ 'NERD_tree_\d\+' && winnr('$') > 1 |
\ let buf=bufnr() | buffer# | execute "normal! \<C-W>w" | execute 'buffer'.buf | endif
" vim-glsl
autocmd! BufNewFile,BufRead *.vs,*.fs set ft=glsl
" If there's a `meson.build` file, use meson for linting.
autocmd FileType c call ConsiderMesonForLinting()
function ConsiderMesonForLinting()
if filereadable('meson.build')
let g:syntastic_c_checkers = ['meson']
endif
endfunction