-
Notifications
You must be signed in to change notification settings - Fork 0
/
dot-vimrc
97 lines (79 loc) · 1.79 KB
/
dot-vimrc
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
" Misc
" ====
" Don't try to be vi compatible
set nocompatible
" Put swap files in a specific folder
set backupdir=~/.swp_files
set directory=~/.swp_files
" Visual/Layout
" =============
" Syntax, line numbers, relative line numbers, cursor line
syntax on
filetype plugin on
set relativenumber
set number
set cursorline
" Highlight brackets
set showmatch
" Forces vim to redraw less frequently the window
set lazyredraw
" Rendering
set ttyfast
" Status bar
set laststatus=2
" Show the current mode
set showmode
" Show the last command that has been typed
set showcmd
" Enables a wildcard menu when typing commands
set wildmenu
" Show file stats on bottom left corner (line numbers, columns, etc)
set ruler
" Blink cursor on error instead of beeping
set visualbell
" Content
" =======
" Encoding
set encoding=utf-8
" Enable specific identation settings for different filetypes
filetype indent on
" Ignore file spceific settings
set modelines=0
" When pressing >> or << you get 4 spaces
set shiftwidth=4
" Pressing tab gets 4 spaces
set tabstop=4
" Do smart identation eg. after : or {
set smarttab
" Keep identation after pressing enter
set autoindent
" Convert tabs to spaces
set expandtab
" Keybindings
" ===========
" Leader
let mapleader = ","
" Move up/down editor lines
nnoremap j gj
nnoremap k gk
" When going to a specific line, put it in the center of the view
nnoremap G Gzz
" Searching
nnoremap / /\v
vnoremap / /\v
set hlsearch
set incsearch
set ignorecase
set smartcase
map <leader><space> :nohl<cr>
" Formatting
map <leader>q gqip
" Fix pasting (from https://stackoverflow.com/a/38258720/2099726)
let &t_SI .= "\<Esc>[?2004h"
let &t_EI .= "\<Esc>[?2004l"
inoremap <special> <expr> <Esc>[200~ XTermPasteBegin()
function! XTermPasteBegin()
set pastetoggle=<Esc>[201~
set paste
return ""
endfunction