-
Notifications
You must be signed in to change notification settings - Fork 10
/
.vimrc
161 lines (126 loc) · 6.46 KB
/
.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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
" Carlos Mafla vimrc
" https://github.com/gigo6000/dotfiles
"
" ----------------------------------------------------------------------
" | General Settings |
" ----------------------------------------------------------------------
set nocompatible " Don't make vim vi-compatibile
syntax on " Enable syntax highlighting
if has("autocmd")
filetype plugin indent on
" │ │ └──── Enable file type detection
" │ └───────── Enable loading of indent file
" └─────────────── Enable loading of plugin files
endif
set autoindent " Copy indent to the new line
set backspace=indent " ┐
set backspace+=eol " │ Allow `backspace`
set backspace+=start " ┘ in insert mode
set backupdir=~/.vim/backups " Set directory for backup files
set backupskip=/tmp/* " ┐ Don't create backups
set backupskip+=/private/tmp/* " ┘ for certain files
set clipboard=unnamed " ┐
" │ Use the system clipboard
if has("unnamedplus") " │ as the default register
set clipboard+=unnamedplus " │
endif " ┘
""" SYSTEM CLIPBOARD COPY & PASTE SUPPORT
set pastetoggle=<Leader>a "\a before pasting to preserve indentation
"Copy paste to/from clipboard
vnoremap <C-c> "*y
map <silent><Leader>p :set paste<CR>o<esc>"*]p:set nopaste<cr>"
map <silent><Leader><S-p> :set paste<CR>O<esc>"*]p:set nopaste<cr>"
set cpoptions+=$ " When making a change, don't
" redisplay the line, and instead,
" put a `$` sign at the end of
" the changed text
color desert
set cursorline " Highlight the current line
set directory=~/.vim/swaps " Set directory for swap files
set encoding=utf-8 nobomb " Use UTF-8 without BOM
set history=5000 " Increase command line history
set hlsearch " Enable search highlighting
set ignorecase " Ignore case in search patterns
set incsearch " Highlight search pattern as
" it is being typed
set laststatus=2 " Always show the status line
set lazyredraw " Do not redraw the screen while
" executing macros, registers
" and other commands that have
" not been typed
set listchars=tab:▸\ " ┐
set listchars+=trail:· " │ Use custom symbols to
set listchars+=eol:↴ " │ represent invisible characters
set listchars+=nbsp:_ " ┘
set magic " Enable extended regexp
set mousehide " Hide mouse pointer while typing
set noerrorbells " Disable error bells
set nojoinspaces " When using the join command,
" only insert a single space
" after a `.`, `?`, or `!`
set nostartofline " Kept the cursor on the same column
set number " Show line number. Disable temp with :set nonu
set relativenumber " Show line numbers relative to cursor position, this is useful to move between lines. Disable temp with :set nornu
set numberwidth=5 " Increase the minimal number of
" columns used for the `line number`
set report=0 " Report the number of lines changed
set ruler " Show cursor position
set scrolloff=5 " When scrolling, keep the cursor
" 5 lines below the top and 5 lines
" above the bottom of the screen
set shortmess=aAItW " Avoid all the hit-enter prompts
set showcmd " Show the command being typed
set showmode " Show current mode
set spelllang=en_us " Set the spellchecking language
set smartcase " Override `ignorecase` option
" if the search pattern contains
" uppercase characters
set synmaxcol=2500 " Limit syntax highlighting (this
" avoids the very slow redrawing
" when files contain long lines)
set tabstop=4 " ┐
set softtabstop=4 " │ Set global <TAB> settings
set shiftwidth=4 " │ http://vimcasts.org/e/2
set expandtab " ┘
set ttyfast " Enable fast terminal connection
set undodir=~/.vim/undos " Set directory for undo files
set undofile " Automatically save undo history
set virtualedit=all " Allow cursor to be anywhere
set visualbell " ┐
set noerrorbells " │ Disable beeping and window flashing
set t_vb= " ┘ https://vim.wikia.com/wiki/Disable_beeping
set wildmenu " Enable enhanced command-line
" completion (by hitting <TAB> in
" command mode, Vim will show the
" possible matches just above the
" command line with the first
" match highlighted)
set winminheight=0 " Allow windows to be squashed
" Quicker window movement
nnoremap <C-j> <C-w>j
nnoremap <C-k> <C-w>k
nnoremap <C-h> <C-w>h
nnoremap <C-l> <C-w>l
" Quicker tab movement
nnoremap H gT " Move to the next tab with Shift + H
nnoremap L gt " Move to the next tab with Shift + L
" Load up all of our plugins
if filereadable(expand("~/.vimrc.bundles"))
source ~/.vimrc.bundles
endif
" Show syntax highlighting groups for word under cursor
nmap <C-S-S> :call <SID>SynStack()<CR>
function! <SID>SynStack()
if !exists("*synstack")
return
endif
echo map(synstack(line('.'), col('.')), 'synIDattr(v:val, "name")')
endfunc
" Remove trailing spaces on save
" https://makandracards.com/makandra/11541-how-to-not-leave-trailing-whitespace-using-your-editor-or-git
autocmd BufWritePre * :%s/\s\+$//e
" Load .vimrc files per project
set exrc
set secure
" Always show the sign column (the column at the left of the numbers)
set signcolumn=yes