Last active
February 7, 2018 17:52
-
-
Save mojobojo/12b9feffe455262b31e4 to your computer and use it in GitHub Desktop.
This file contains 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
" Joeys vim config | |
" | |
" Some options from | |
" - https://github.com/rygorous/vimfiles/blob/master/vimrc | |
set nocompatible | |
if has("win32") | |
" Maximize on startup | |
autocmd GUIEnter * simalt ~x | |
" My preferred font for use in windows | |
set guifont=Consolas:h10 | |
" My preferred color scheme | |
" Available here http://www.vim.org/scripts/script.php?script_id=2140 | |
colorscheme xoria256 | |
" colorscheme oxeded | |
function! DoBuildBatchFile() | |
if (&ft == 'c' || &ft == 'cpp' || &ft == 'cc') | |
" Thanks to https://forums.handmadehero.org/index.php/forum?view=topic&catid=4&id=704#3982 | |
" error message formats | |
" Microsoft MSBuild | |
set errorformat+=\\\ %#%f(%l\\\,%c):\ %m | |
" Microsoft compiler: cl.exe | |
set errorformat+=\\\ %#%f(%l)\ :\ %#%t%[A-z]%#\ %m | |
" Microsoft HLSL compiler: fxc.exe | |
set errorformat+=\\\ %#%f(%l\\\,%c-%*[0-9]):\ %#%t%[A-z]%#\ %m | |
" build.bat | |
set makeprg=build.bat | |
" Make sure the output doesnt interfere with anything | |
silent make | |
endif | |
if (&ft == 'go') | |
" set errorformat+=\\\ %#%f:%l:%l:\ %#%t%[A-z]%#\ %m | |
set errorformat =%-G#\ %.%# " Ignore lines beginning with '#' ('# command-line-arguments' line sometimes appears?) | |
set errorformat+=%-G%.%#panic:\ %m " Ignore lines containing 'panic: message' | |
set errorformat+=%Ecan\'t\ load\ package:\ %m " Start of multiline error string is 'can\'t load package' | |
set errorformat+=%A%f:%l:%c:\ %m " Start of multiline unspecified string is 'filename:linenumber:columnnumber:' | |
set errorformat+=%A%f:%l:\ %m " Start of multiline unspecified string is 'filename:linenumber:' | |
set errorformat+=%C%*\\s%m " Continuation of multiline error message is indented | |
set errorformat+=%-G%.%# " All lines not matching any of the above patterns are ignored | |
set makeprg=go\ build | |
" Make sure the output doesnt interfere with anything | |
silent make | |
endif | |
" Open the output buffer | |
copen | |
echo 'Build Complete' | |
endfunction | |
elseif has("unix") | |
" This is a fallback if Consolas is not installed | |
"set guifont=Courier\ 10\ Pitch\ 8 | |
set guifont=Consolas\ 8 | |
set mouse=a | |
set t_Co=256 | |
colorscheme oxeded | |
set background=dark | |
function! DoBuildShFile() | |
" build.sh | |
set makeprg=./build.sh | |
" Make sure the output doesnt interfere with anything | |
silent make | |
" Open the output buffer | |
copen | |
echo 'Build Complete' | |
endfunction | |
endif | |
" Start in my development directory | |
" This is causing problems | |
" cd D:\Development | |
set encoding=utf-8 | |
" Remove GUI components so its just text mode | |
set guioptions-=m | |
set guioptions-=T | |
set guioptions-=r | |
set guioptions-=L | |
" Enable syntax highlighting | |
syntax enable | |
" Tab/indentation options | |
set tabstop=4 | |
set shiftwidth=4 | |
set expandtab | |
set smarttab | |
set smartindent | |
set autoindent | |
" Share clipboard with windows | |
set clipboard=unnamed | |
" Make it so I can backspace over new lines and indentations | |
set backspace=indent,eol,start | |
set ruler | |
set nowrap | |
set wildmenu | |
set showcmd | |
set showmode | |
set number | |
set relativenumber | |
" Wildcard ignores | |
set wildignore=*.o,*.obj,*.a,*.lib,*.exe,*.pdb | |
" set tags+=tags,D:\ctags\ucrt,D:\ctags\um,D;\ctags\msvc | |
" Tab autocomplete | |
function! TabAutoComplete() | |
if col('.')>1 && strpart( getline('.'), col('.')-2, 3 ) =~ '^\w' | |
return "\<C-N>" | |
else | |
return "\<Tab>" | |
endif | |
endfunction | |
inoremap <Tab> <C-R>=TabAutoComplete()<CR> | |
" Ensure the buffer for building code opens in a new view | |
set switchbuf=useopen,split | |
" Set F7 to build. I like this since I use visual studio with the c++ build env | |
nnoremap <F7> :call DoBuildBatchFile()<CR> | |
"Go to next error | |
nnoremap <F6> :cn<CR> | |
"Go to previous error | |
nnoremap <F5> :cp<CR> | |
" Seriously I hate f1 | |
nmap <F1> <nop> | |
" Insert stuff for c headers | |
" http://vim.wikia.com/wiki/Automatic_insertion_of_C/C%2B%2B_header_gates | |
function! s:insert_gates() | |
let gatename = substitute(toupper(expand("%:t")), "\\.", "_", "g") | |
execute "normal! i#ifndef " . "__" . gatename . "_" | |
execute "normal! o#define " . "__" . gatename . "_" | |
execute "normal! Go#endif" | |
normal! kk | |
endfunction | |
autocmd BufNewFile *.{h,hpp} call <SID>insert_gates() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment