Created
June 16, 2020 04:42
-
-
Save OutbackMan/a98b8387e44b9a850245b330989b01f9 to your computer and use it in GitHub Desktop.
My .gvimrc file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" AUTHOR: "Ryan McClue" <[email protected]> | |
set nocompatible | |
set noswapfile noundofile nobackup | |
set spell spelllang=en_au | |
" NOTE(Ryan): z= | |
set expandtab softtabstop=2 tabstop=2 | |
set shiftwidth=2 shiftround | |
set autoindent autowrite | |
set mouse=a | |
set incsearch hlsearch | |
set foldenable | |
set foldmethod=manual | |
set foldlevelstart=0 | |
syntax on | |
set number | |
if has("gui_gtk3") | |
set guifont=Inconsolata\ 14 | |
elseif has("gui_macvim") | |
set guifont=Menlo\ Regular:h14 | |
else | |
set guifont=Consolas:h11:cANSI | |
endif | |
set showmatch | |
set backspace=indent,eol,start | |
set laststatus=2 | |
set showmode | |
set scrolloff=5 | |
set nowrap | |
" NOTE(Ryan): Although actually clang, has same errorformat as gcc | |
compiler gcc | |
if !exists('g:os') | |
if has('win64') || has('win32') | |
let g:os = 'Windows' | |
autocmd GUIEnter * simalt ~x | |
else | |
let g:os = substitute(system('uname'), '\n', '', '') | |
if g:os ==# 'Linux' | |
" NOTE(Ryan): Requires wmctrl to be installed | |
autocmd GUIEnter * call system('wmctrl -i -b add,maximized_vert,maximized_horz -r ' . v:windowid) | |
endif | |
endif | |
endif | |
" NOTE(Ryan): Vim cwd must be root directory of build script | |
if g:os ==# 'Windows' | |
let &makeprg="windows-build.bat" | |
elseif g:os ==# 'Linux' | |
let &makeprg="bash ubuntu-build.bash" | |
else | |
let &makeprg="bash macos-build.bash" | |
endif | |
nnoremap <silent> <C-B> :make! <bar> copen <bar> redraw<CR> | |
nnoremap <silent> <C-N> :cnext<CR> | |
nnoremap <silent> <C-P> :cprev<CR> | |
nnoremap <silent> <C-C> :cclose<CR> | |
function! TabSelectOrPopupOrIndent() | |
if col('.') == 1 || getline('.')[col('.') - 2] =~? '[ ]' | |
return "\<Tab>" | |
else | |
return "\<C-X>\<C-N>" | |
endif | |
endfunction | |
inoremap <expr> <Tab> TabSelectOrPopupOrIndent() | |
inoremap <expr> <CR> pumvisible() ? "\<C-Y>" : "\<CR>" | |
inoremap <expr> <Esc> pumvisible() ? "\<C-E>" : "\<Esc>" | |
inoremap <expr> n pumvisible() ? "\<C-N>" : 'n' | |
inoremap <expr> <S-N> pumvisible() ? "\<C-P>" : "\<S-N>" | |
nnoremap <S-F> :vimgrep //gj **/*.c **/*.cpp **/*.h <bar> copen<C-Left><C-Left><C-Left><C-Left><C-Left><Right> | |
augroup CommentMarkers | |
autocmd! | |
autocmd Syntax * syntax match NoteMarker /\v\_.<NOTE/hs=s+1 containedin=.*Comment,vimCommentTitle | |
autocmd Syntax * syntax match TodoMarker /\v\_.<TODO/hs=s+1 containedin=.*Comment,vimCommentTitle | |
" etc... | |
augroup END | |
highlight NoteHighlight guibg=Green | |
highlight! link NoteMarker NoteHighlight | |
highlight TodoHighlight guibg=Orange | |
highlight! link TodoMarker TodoHighlight | |
" etc... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment