-
Notifications
You must be signed in to change notification settings - Fork 1
/
.vimrc
executable file
·66 lines (54 loc) · 1.97 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
syntax on
color dracula
set encoding=utf-8 nobomb " Use UTF-8 without BOM
set cursorline " Highlight current line
set hlsearch " Highlight searches
set incsearch " Highlight dynamically as pattern is typed
" set laststatus=2 " Always show status line
set nostartofline " Don’t reset cursor to start of line when moving around.
set ruler " Show the cursor position
set showmode " Show the current mode
set title " Show the filename in the window titlebar
set showcmd " Show the (partial) command as it’s being typed
set nocompatible " Make Vim more useful
set clipboard=unnamed " Use the OS clipboard by default (on versions compiled with `+clipboard`)
set esckeys " Allow cursor keys in insert mode
" set backspace=indent,eol,start " Allow backspace in insert mode
set scrolloff=3 " Start scrolling three lines before the horizontal window border
" set wildmenu " Enhance command-line completion
" set number " Enable line numbers
" set ignorecase " Ignore case of searches
" set gdefault " Add the g flag to search/replace by default
" Enable per-directory .vimrc files and disable unsafe commands in them
set exrc
set secure
" Don’t add empty newlines at the end of files
set binary
set noeol
" Centralize backups, swapfiles and undo history
set backupdir=~/.vim/backups
set directory=~/.vim/swaps
if exists("&undodir")
set undodir=~/.vim/undo
endif
" Don’t create backups when editing files in certain directories
set backupskip=/tmp/*,/private/tmp/*
" Show “invisible” characters
" set lcs=tab:▸\ ,trail:·,eol:¬,nbsp:_
" set list
" Use relative line numbers
if exists("&relativenumber")
set relativenumber
au BufReadPost * set relativenumber
endif
" Strip trailing whitespace (,ss)
function! StripWhitespace()
let save_cursor = getpos(".")
let old_query = getreg('/')
:%s/\s\+$//e
call setpos('.', save_cursor)
call setreg('/', old_query)
endfunction
noremap <leader>ss :call StripWhitespace()<CR>
" Save a file as root (,W)
" noremap <leader>W :w !sudo tee % > /dev/null<CR>