Skip to content

Instantly share code, notes, and snippets.

@seanvaleo
Created June 11, 2021 20:53
Show Gist options
  • Save seanvaleo/fe804cad7ffb486a35ddc6d8626801e8 to your computer and use it in GitHub Desktop.
Save seanvaleo/fe804cad7ffb486a35ddc6d8626801e8 to your computer and use it in GitHub Desktop.
""""""""" Plug-Vim """"""""""
" After adding below, install with :PlugInstall
" define plugins
call plug#begin('~/.vim/plugged')
" Auto-completion for all supported languages
Plug 'Valloric/YouCompleteMe', { 'do': './install.py --all' }
" More Go support
Plug 'fatih/vim-go', { 'do': ':GoUpdateBinaries' }
call plug#end()
""""""""" Preferences """"""""""
" Use Vim defaults instead of 100% vi compatibility
set nocompatible
" CVE-2007-2438
set modelines=0
" More powerful backspacing
set backspace=2
" Disable loading vim defaults
let skip_defaults_vim=1
" When editing a file, always jump to the last cursor position
if has("autocmd")
autocmd BufReadPost *
\ if line("'\"") > 0 && line ("'\"") <= line("$") |
\ exe "normal g'\"" |
\ endif
endif
" Theme
set term=xterm-256color
set t_Co=256
set termguicolors
hi LineNr guifg=#464a54
hi EndOfBuffer guifg=#464a54
hi CursorLineNr guifg=cyan
hi CursorLine guibg=#464a54
hi Pmenu guifg=#000000
hi Pmenu guibg=cyan
" Allow smart indenting
set smartindent
" Show hybrid line number on the left
set number relativenumber
" Merge clipboards
set clipboard^=unnamed,unnamedplus
" Turn syntax highlighting off
syntax off
" Highlight current line
set cursorline
" Keep the current line in the vertical center of the screen
set scrolloff=200
" Stop the cursor moving left when exiting insert. Causes a bug in arrow keys.
inoremap <silent> <Esc> <Esc>`^
" Display a column for folds
set foldcolumn=1
hi FoldColumn guifg=cyan
hi FoldColumn guibg=#1c1f25
hi Folded guifg=cyan
hi Folded guibg=#464a54
" Remember folds between sessions
augroup remember_folds
autocmd!
autocmd BufWinLeave ?* mkview | filetype detect
autocmd BufWinEnter ?* silent loadview | filetype detect
augroup END
" Statusline Options
set laststatus=2
set statusline=
set statusline +=%4*\ %<%F%* "full path
set statusline +=%2*%m%* "modified flag
set statusline +=%1*%=%5l%* "current line
set statusline +=%2*/%L%* "total lines
set statusline +=%1*%4v\ %* "virtual column number
" Home backup directory to avoid backups ending up in Git
set backupdir=$HOME//
set directory=$HOME//
" Enable mouse scrolling
set mouse=n
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment