Skip to content

Instantly share code, notes, and snippets.

@francium francium/.vimrc Secret
Created Dec 25, 2016

Embed
What would you like to do?
" Colorscheme
colorscheme leya
set background=light
" Toggle darkness
function! ToggleBackgroundDarkness()
if &background ==# "light"
colo darth
set background=dark
else
colo leya
set background=light
endif
endfunction
map <F8> :call ToggleBackgroundDarkness()<CR>
" Reload vim automatically
augroup myvimrc
au!
au BufWritePost .vimrc,_vimrc,vimrc,.gvimrc,_gvimrc,gvimrc so $MYVIMRC |
if has('gui_running') | so $MYGVIMRC | endif
augroup END
" File specific settings
filetype plugin indent on
" 80 column warning
set colorcolumn=80
" Highlight matching parenthesis and braces
hi MatchParen cterm=bold ctermbg=darkgray ctermfg=magenta
" Line numbering
set number
" Saving shortcut
nnoremap <leader>s :w<CR>
" Scroll padding
set so=4
" Search highlighting
set hlsearch
" Search highlights clear using Space
nnoremap <silent> <Space> :nohlsearch<Bar>:echo<CR>
" Splitting
set splitbelow
set splitright
nnoremap <C-J> <C-W><C-J>
nnoremap <C-K> <C-W><C-K>
nnoremap <C-L> <C-W><C-L>
nnoremap <C-H> <C-W><C-H>
" Status line
set laststatus=2
" Syntax
syntax on
" Tabs and spaces
set tabstop=4
set shiftwidth=4
set expandtab
" GVim settings ===============================================================
" UI
set guioptions-=T " Remove toolbar
set guioptions-=r " Remove right-hand scroll bar
set guioptions-=L " Remove left-hand scroll bar
" Plugins =====================================================================
" Better Whitespace -----------------------------------------------------------
" Strip whitespace
map <leader><leader>w :StripWhitespace<CR>
" NERDTreee -------------------------------------------------------------------
" Show hidden files
let NERDTreeShowHidden=1
" Map Ctrl+n to toggle
map <C-n> :NERDTreeToggle<CR>
" Close with last file
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree")
\ && b:NERDTree.isTabTree()) | q | endif
" Auto start when no files specified
autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif
" Auto start when directory specified
" autocmd StdinReadPre * let s:std_in=1
" autocmd VimEnter * if argc() == 1 && isdirectory(argv()[0])
" \ && !exists("s:std_in") | exe 'NERDTree' argv()[0] | wincmd p | ene |
" \ endif
" NERDCommenter ---------------------------------------------------------------
" Add spaces after comment delimiters by default
let g:NERDSpaceDelims = 1
" Use compact syntax for prettified multi-line comments
let g:NERDCompactSexyComs = 1
" Align line-wise comment delimiters flush left instead of following code
" indentation
let g:NERDDefaultAlign = 'left'
" Set a language to use its alternate delimiters by default
let g:NERDAltDelims_java = 1
" Add your own custom formats or override the defaults
let g:NERDCustomDelimiters = { 'c': { 'left': '/**','right': '*/' } }
" Allow commenting and inverting empty lines (useful when commenting a
" region)
let g:NERDCommentEmptyLines = 1
" Enable trimming of trailing whitespace when uncommenting
let g:NERDTrimTrailingWhitespace = 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.