summary refs log tree commit diff
path: root/.vimrc
diff options
context:
space:
mode:
Diffstat (limited to '.vimrc')
-rw-r--r--.vimrc303
1 files changed, 26 insertions, 277 deletions
diff --git a/.vimrc b/.vimrc
index a6ce2641..7891eba9 100644
--- a/.vimrc
+++ b/.vimrc
@@ -1,304 +1,53 @@
-" Do not try to behave like vi.
 set nocompatible
 
-" Allow backspace in insert mode to delete past the beginning of the line.
+" Backspace past beginning of line in insert mode.
 set backspace=indent,eol,start
 
-" Keep buffers loaded even when they aren't shown. Allows switching buffers
-" without saving first.
+" Allow switching buffers without saving.
 set hidden
 
-" Keep 50 lines of : command history and search patterns.
-set history=50
+" Show cursor position and incomplete commands, always show status line.
+set ruler showcmd laststatus=2
 
-" Show the cursor position in the bottom right.
-set ruler
+" Search incrementally with smart case sensitivity, highlight all matches.
+set incsearch ignorecase smartcase hlsearch
 
-" Show partial command in the bottom right (i.e. if a command is started but
-" needs a motion, it will be shown).
-set showcmd
+" Automatic indentation and adjust with tab and backspace.
+set autoindent smartindent smarttab
 
-" Jump to search results while typing. Pressing enter actually jumps to the
-" result, pressing escape goes back to the cursor.
-set incsearch
+" Show line numbers, highlight current line and fixed columns.
+set number cursorline colorcolumn=80,100,120
 
-" Perform case-insensitive searching when the search pattern contains only
-" lowercase letters.
-set ignorecase
-set smartcase
-
-" Copy the indent from the previous line when starting a new line.
-" Automatically indent between curly braces and indent keywords.
-set autoindent
-set smartindent
-
-" Show line numbers.
-set number
-
-" Perform spell-checking on strings and comments.
-set spell
-
-" Highlight the 80th, 100th and 120th columns.
-set colorcolumn=80,100,120
-
-" Set the window title with the current file name, status and directory.
+" Set window title.
 set title
 
-" Make file messages shorter:
-"  - a: Shorten all file description messages
-"  - t: Truncate file messages if they are too long
-"  - I: Do not show the intro message when Vim starts
+" Shorten messages and disable intro screen
 set shortmess=atI
 
-" Disable beeping and visual bell (flashing the terminal window).
+" Disable audible bell.
 set visualbell t_vb=
 
-" Highlight the current line.
-set cursorline
-
-" Insert `shiftwidth` spaces at the beginning of a line when tab is pressed,
-" delete `shiftwidth` spaces when backspace is pressed.
-set smarttab
-
-" Highlight all search matches.
-set hlsearch
+" Show hard tabs and trailing whitespace
+set list listchars=tab:»·,trail:·
 
-" Show hard tabs and trailing whitespace.
-set list
-set listchars=tab:»·,trail:·
+" Show hard tabs as 4 side, use 2 space indentation rounded to multiples.
+set tabstop=4 expandtab shiftwidth=2 shiftround
 
-
-" Fold by syntax, start with all folds open.
-set foldmethod=syntax
-set foldlevelstart=99
-
-" Always show the status line.
-set laststatus=2
-
-" Always show one line above or below the cursor.
-set scrolloff=1
-
-" Ctrl-A and Ctrl-X work on hex and single letters
-set nrformats=alpha,hex
-
-" Enable syntax highlighting.
+" Syntax highlighting, filetype indentation rules.
 syntax on
-
-" Enable mouse in terminals
-if has('mouse')
-  set mouse=a
-endif
-
-" Disable spell-checking in terminal Vim.
-if !has('gui_running')
-  set nospell
-endif
-
-" GUI options:
-"  * -m: Disable menu bar
-"  * -r: Disable right scroll bar
-"  * -L: Disable left scroll bar
-"  * -T: Disable toolbar
-"  * +c: Use console dialogs
-set guioptions-=m
-set guioptions-=r
-set guioptions-=L
-set guioptions-=T
-set guioptions+=c
-
-" Use a font.
-set guifont=ProFont:h11
-
-" Jump to the last cursor position when opening a file.
-au BufReadPost * if &filetype !~ '^git\c' && line("'\"") > 0 && line("'\"") <= line("$")
-    \| exe "normal! g`\"" | endif
-
-" Use two-space indents.
-set expandtab
-set shiftwidth=2
-
-" Round to the nearest multiple of `shiftwidth` when indenting.
-set shiftround
-
-" Show hard tabs as 4 characters wide.
-set tabstop=4
-
-
-" Load filetype plugins and indentation rules.
 filetype plugin indent on
 
-" Use 4-space indents in C, C++ and Lua.
-autocmd FileType c,cpp,lua setlocal sw=4
-
-" Hard-wrap text at 72 characters in Markdown.
-autocmd FileType markdown setlocal tw=72
-
-" C/C++ indentation options:
-"  * :0 Align `case` with `switch`
-"  * l1 Indent case bodies with braces to case
-"  * g0 Align `public:` and friends to class
-set cinoptions=:0,l1,g0
-
-" Show tab-complete suggestions when typing in the command-line. List all
-" matches and complete to the longest common string. Ignore output files and
-" backups.
-set wildmenu
-set wildmode=list:longest
-set wildignore=*.o,*.d,*~
-
-" Smarter % matching on HTML tags, if/endif etc.
-runtime macros/matchit.vim
+" Show tab-complete suggestions and complete longest substring.
+set wildmenu wildmode=list:longest
 
-" Do not show whitespace in insert mode.
-autocmd InsertEnter * setlocal nolist
-autocmd InsertLeave * setlocal list
-
-" Set leader to , and remap , to \.
+" Swap , and \ for leader.
 noremap \ ,
-let mapleader = ","
-
-" Swap ' and ` (' is now character-wise and ` is line-wise).
-nnoremap ' `
-nnoremap ` '
+let mapleader=","
 
-" Swap 0 and ^ (0 now moves to the first non-whitespace character).
-nnoremap 0 ^
-nnoremap ^ 0
-
-" Clear search result highlighting.
+" Clear search results.
 nmap <leader>n :nohlsearch<CR>
 
-" Toggle visible whitespace.
-nmap <leader>s :set list!<CR>
-
-" Toggle spell checking.
-nmap <leader>z :set spell!<CR>
-
-" Cut/copy/paste to system clipboard.
-nmap <leader>p "+p
-nmap <leader>P "+P
-nmap <leader>y "+y
-nmap <leader>Y "+Y
-nmap <leader>d "+d
-nmap <leader>D "+D
-
-" Yank to end of line.
-nmap Y y$
-
-" Insert hard tab.
-imap <S-tab> <C-v><tab>
-
-" Toggle relative/absolute line numbers.
-nmap <C-n> :set relativenumber!<CR>
-
-" Common typos.
-command! W :w
-command! Q :q
-
-" Plugins
-
-call plug#begin('~/.vim/plugged')
-
-" Fancy statusline.
-Plug 'bling/vim-airline'
-" Don't show mode in last line.
-set noshowmode
-" Disable silly > separators.
-let g:airline_left_sep = ''
-let g:airline_right_sep = ''
-" Only show diff stats if there are some.
-let g:airline#extensions#hunks#non_zero_only = 1
-" Don't complain about whitespace constantly.
-let g:airline#extensions#whitespace#enabled = 0
-
-" Syntax checking.
-Plug 'scrooloose/syntastic'
-let g:syntastic_check_on_open=1
-let g:syntastic_enable_signs=0
-
-" Git diff signs in margins.
-Plug 'mhinz/vim-signify'
-let g:signify_vcs_list = ['git']
-let g:signify_sign_overwrite = 1
-let g:signify_sign_change = '~'
-
-" Fuzzy matching files/buffers.
-Plug 'kien/ctrlp.vim'
-nmap <leader>b :CtrlPBuffer<CR>
-nmap <leader>e :CtrlP<CR>
-nmap <leader>t :CtrlPBufTag<CR>
-nmap <leader>l :CtrlPLine<CR>
-
-" Git commands.
-Plug 'tpope/vim-fugitive'
-nmap <leader>gs :Gstatus<CR>
-nmap <leader>gc :Gcommit<CR>
-nmap <leader>gp :Git push<CR>
-
-" Alignment of = : , etc.
-Plug 'junegunn/vim-easy-align'
-vnoremap <silent> <Enter> :EasyAlign<Enter>
-
-" Auto-close braces, parens, quotes, etc.
-Plug 'Raimondi/delimitMate'
-let delimitMate_expand_cr = 1
-let delimitMate_expand_space = 1
-let delimitMate_jump_expansion = 1
-
-" Indent guides by alternating background colour. (<leader>ig)
-Plug 'nathanaelkane/vim-indent-guides'
-let g:indent_guides_start_level = 2
-
-" Distraction-free editing
-Plug 'junegunn/goyo.vim'
-Plug 'junegunn/limelight.vim'
-nmap <leader>G :Goyo<CR>
-autocmd User GoyoEnter Limelight
-autocmd User GoyoLeave Limelight!
-
-" Colorschemes.
-Plug 'programble/jellybeans.vim'
-Plug 'programble/vim-hybrid'
-Plug 'morhetz/gruvbox'
-" Show nearest tag in statusline.
-Plug 'majutsushi/tagbar'
-" Scratch buffers.
-Plug 'programble/itchy.vim'
-" Better paste indentation.
-Plug 'sickill/vim-pasta'
-" Commenting.
-Plug 'tpope/vim-commentary'
-" Surround text objects.
-Plug 'tpope/vim-surround'
-" Increment, decrement dates and roman numerals with C-a, C-x.
-Plug 'tpope/vim-speeddating'
-" File-related commands.
-Plug 'tpope/vim-eunuch'
-" Highlight color values with their color in CSS.
-Plug 'ap/vim-css-color'
-" Swap two selections.
-Plug 'tommcdo/vim-exchange'
-
-" Language support.
-Plug 'digitaltoad/vim-jade'
-Plug 'groenewege/vim-less'
-Plug 'kchmck/vim-coffee-script'
-Plug 'pangloss/vim-javascript'
-Plug 'tpope/vim-markdown'
-Plug 'tpope/vim-ragtag'
-
-Plug 'Z1MM32M4N/vim-superman'
-
-Plug 'kshenoy/vim-signature'
-
-call plug#end()
+colorscheme hybrid
 
-set background=dark
-let g:gruvbox_termcolors = 16
-let g:gruvbox_italic = 0
-let g:gruvbox_invert_selection = 0
-let g:gruvbox_sign_column = 'dark0'
-let g:gruvbox_vert_split = 'dark0'
-set fillchars+=vert:│
-colorscheme gruvbox
-let g:airline_theme = 'tomorrow'
+" Set GUI font and disable GUI features.
+set guifont=ProFont:h11 guioptions=c