aboutsummaryrefslogtreecommitdiffstats
path: root/.vimrc
blob: 72f4ee8e8e240e29f49a6dfdeb80221244c88b77 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
" Disable compatibility with Vi to enable
" Vim's extended features and modern behaviors.
set nocompatible

" Use system clipboard
"
" https://stackoverflow.com/a/39313208
if has('macunix')
    set clipboard=unnamed
elseif has('unix')
    set clipboard=unnamedplus
endif

" Enable a number column with numbers relative
" to the current line the cursor is on.
set number
set relativenumber

" 1. Enable filetype detection to apply filetype-specific
" settings e.g. syntax highlighting
" 2. Enable filetype plugins.
" 3. Enable the indent plugin for automatic indentation
filetype plugin indent on

" Turn on syntax highlighting
syntax on

" Convert the tab character into spaces
set expandtab

" Define the width of a tab character.
set tabstop=4

" Number of spaces to insert on tab key press
set softtabstop=4

" Number of spaces to use for auto-indentation
set shiftwidth=4

" Show highlighted text for search matches as search query
" is typed
set incsearch

" Show line/column number of cursor
set ruler

" Setup home directory locations for vim temporary files
if empty($XDG_STATE_HOME)
    let $XDG_STATE_HOME = $HOME.'/.local/state'
endif
set backupdir=$XDG_STATE_HOME/vim/backup//
set directory=$XDG_STATE_HOME/vim/swap//
set undodir=$XDG_STATE_HOME/vim/undo//
set undofile

" Enable the :Man command that ships with vim.
runtime ftplugin/man.vim

" Enable matchit which ships with vim.
runtime! macros/matchit.vim

let g:mapleader = "\<Space>"
let g:maplocalleader = ','

" Show quickfix list easier
nnoremap <Leader>q :copen<CR>