Skip to content

Instantly share code, notes, and snippets.

@baoilleach
Created September 30, 2019 19:56
Show Gist options
  • Save baoilleach/a84468f942a005258c078c6264e2638f to your computer and use it in GitHub Desktop.
Save baoilleach/a84468f942a005258c078c6264e2638f to your computer and use it in GitHub Desktop.
My GVIM RC
set encoding=utf-8 " The encoding displayed.
set fileencoding=utf-8 " The encoding written to file.
autocmd FileType python set omnifunc=pythoncomplete#Complete
" If you prefer the Omni-Completion tip window to close when a selection is
" made, these lines close it on movement in insert mode or when leaving
" insert mode
autocmd CursorMovedI * if pumvisible() == 0|pclose|endif
autocmd InsertLeave * if pumvisible() == 0|pclose|endif
" When you hit Enter the chosen omnicompletion is inserted
inoremap <expr> <CR> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>"
" Here is a font that actually shows UTF-8 characters
set guifont=Consolas:h11:cANSI
autocmd FileType python set expandtab sw=4 ts=4 sts=4 autoindent
autocmd FileType cmake set expandtab
autocmd FileType cmake set sw=2
autocmd FileType cmake set ts=2
autocmd FileType cmake set autoindent
autocmd FileType html set expandtab
autocmd FileType html set sw=2
autocmd FileType html set ts=2
autocmd FileType html set autoindent
autocmd FileType javascript set expandtab
autocmd FileType javascript set sw=2
autocmd FileType javascript set ts=2
autocmd FileType javascript set autoindent
autocmd FileType css set expandtab
autocmd FileType css set sw=2
autocmd FileType css set ts=2
autocmd FileType css set autoindent
autocmd FileType cpp set expandtab
autocmd FileType cpp set sw=2
autocmd FileType cpp set ts=2
autocmd FileType cpp set autoindent
autocmd FileType c set expandtab
autocmd FileType c set sw=2
autocmd FileType c set ts=2
autocmd FileType c set autoindent
"
" Highlight whitespace at end of line
highlight ExtraWhitespace ctermbg=red guibg=red
autocmd Syntax * syn match ExtraWhitespace /\s\+$\| \+\ze\t/
" Put those annoying backups into C:\Users\Noel\vimfiles\temp
set backupdir=C:\\Users\\Noel\\vimfiles\\temp//
set directory=C:\\Users\\Noel\\vimfiles\\temp//
silent execute '!del C:\Users\Noel\vimfiles\temp\*~'
" Put the undo files into C:\Users\Noel\vimfiles\undodir
set undodir=C:\\Users\\Noel\\vimfiles\\undodir
let g:syntastic_check_on_open=0
let g:syntastic_enable_signs=1
let g:syntastic_enable_balloons = 1
let g:syntastic_auto_loc_list = 1
let g:syntastic_loc_list_height = 5
let g:syntastic_python_checkers=['python']
" let g:syntastic_python_checkers=['pyflakes', 'python']
let g:syntastic_rst_checkers=['rstcheck']
let g:syntastic_javascript_checkers=['jshint']
let g:syntastic_jshint_exec='C:\Users\Noel\node_modules\.bin\jshint.cmd'
au FileType python map <silent> <leader>b oimport pdb; pdb.set_trace()<esc>
au FileType python map <silent> <leader>B Oimport pdb; pdb.set_trace()<esc>
noremap <silent> <leader>s :call RunOBabel()<CR>
function! RunOBabel()
let wordUnderCursor = shellescape(expand("<cWORD>"), 1)
botright new
setlocal buftype=nofile bufhidden=wipe nobuflisted noswapfile nowrap
execute '$read ! obabel -:'. wordUnderCursor. ' -o ascii -xa 2.0'
setlocal nomodifiable
1
endfunction
function! FoldOnComments()
setlocal foldmethod=expr
setlocal foldexpr=CommentFold(v:lnum)
endfunction
function! CommentFold(lnum)
if getline(a:lnum) =~? '\v^#'
return '0'
endif
return '1'
endfunction
:command WQ wq
:command Wq wq
:command W w
:command Q q
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment