-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.vimrc
More file actions
106 lines (88 loc) · 3.08 KB
/
.vimrc
File metadata and controls
106 lines (88 loc) · 3.08 KB
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
" Enable syntax highlighting,
syntax on
" Enable file type plug,
filetype plugin on
filetype indent on
" Fast saving,
map qq :w!<cr>
" Toggle spell checking,
map ää :setlocal spell!<cr>
" Never do sudo vim again,
cmap w!! w !sudo tee %
" Handle backups nicely
set backup
if !isdirectory($HOME."/.cache/.vim/")
silent! execute "!mkdir -p ~/.cache/.vim/"
endif
set backupdir=~/.cache/.vim//
set directory=~/.cache/.vim//
set undodir=~/.cache/.vim//
set writebackup
au BufWritePre * let &bex = '@' . strftime("%F.%H.%M")
" Enable to have automatic purging:w
"silent execute '!find $HOME/.vimtmp/backup -type f -mtime +7 -delete'
" Set some reasonable defaults
set autoindent " Simple indent
set cmdheight=2 " Height of the command bar
set cursorline " highlight current line
set encoding=utf-8 " Show files in utf8
set expandtab " Inserts <softtabstop-nr-of-spaces> instead of tabs
set fileencodings=utf-8 " Save files in utf8
set hlsearch " Highlight search results
set ic " Ignore case while searching
set incsearch " Search while typing
set laststatus=2 " Always show the status line
set lazyredraw " Don't redraw while executing macros
set linebreak " Line break
set number " Always show number-row
set ruler " Always show current position
set shiftwidth=2 " Number of spaces to use when indenting
set showmatch " Show matching brackets when text indicator is over them
set smartcase " When searching try to be smart about cases
set softtabstop=2 " Magic derp
set tabstop=2 " The amount of spaces a tab should be
set viminfo^=% " Remember info about open buffers on close
" Highlight pattern dangling spaces,
" :highlight ExtraWhitespace ctermbg=darkgreen guibg=lightgreen
" :match ExtraWhitespace /\s\+$\| \+\ze\t/
" Return to last edit position when opening files,
"autocmd BufReadPost *
" \ if line("'\"") > 0 && line("'\"") <= line("$") |
" \ exe "normal! g`\"" |
" \ endif
" Some magic,
augroup configgroup
autocmd!
autocmd BufWritePre * :call StripTrailingWhitespaces()
autocmd BufEnter Makefile setlocal noexpandtab
augroup END
" Playing with themes,
colorscheme badwolf
" Make the gutters darker than the background.
let g:badwolf_darkgutter = 1
" Make the tab line much lighter than the background.
let g:badwolf_tabline = 3
" Turn on CSS properties highlighting
let g:badwolf_css_props_highlight = 1
" Tabs
highlight SpecialKey ctermfg=red
set list
set listchars=tab:..,trail:_,extends:>,precedes:<,nbsp:~
" Shortcut for visual block when ctrl+v is used by something else
command! Vb execute "normal! \<C-v>"
" Vertical bar
highlight ColorColumn ctermbg=darkred guibg=red
set colorcolumn=80
"
" Functions
"
" Removes dangling spaces, called on buffer write in the autogroup above.
function! StripTrailingWhitespaces()
" save last search & cursor position
let _s=@/
let l = line(".")
let c = col(".")
%s/\s\+$//e
let @/=_s
call cursor(l, c)
endfunction