-
Notifications
You must be signed in to change notification settings - Fork 1
/
vimrc_root
67 lines (52 loc) · 2.33 KB
/
vimrc_root
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
set nocompatible
filetype indent plugin on
syntax on
set background=dark
set t_Co=256
colorscheme desert
set encoding=utf-8
set hidden " Change buffer without saving
set wildmenu " Better command-line completion
set wildmode=list:longest
set wildignore+=*/cache/**,*/logs/**
set ignorecase " Case-insensitive searching.
set smartcase " But case-sensitive if expression contains a capital letter.
set incsearch " Highlight matches as you type.
set hlsearch " Highlight matches.
set nobackup " Don't make a backup before overwriting a file.
set nowritebackup
set directory=~/.vim/tmp " directory to put swap files
set ruler
set cursorline
set scrolloff=5 " context around cursor
set laststatus=2 " always display status line
set statusline=[%n]\ %f\ %h%m%r%w\ (%{(&fenc==\"\"?&enc:&enc)})(%{&ff}){%Y}[%L]\ %=%-16(\ %l,%c-%v\ %)%P
set showcmd " Show partial commands in the last line of the screen
set showmode
set cmdheight=2 " command bar height
set number
set nostartofline " Stop certain movements from always going to the first character of a line.
set backspace=indent,eol,start " Allow backspacing over autoindent, line breaks and start of insert action
" indent settings
set autoindent
set expandtab
set smartindent
" easy switch for indent spaces
nmap <leader>2 :setlocal tabstop=2<cr>:setlocal shiftwidth=2<cr>:setlocal softtabstop=2<cr>
nmap <leader>4 :setlocal tabstop=4<cr>:setlocal shiftwidth=4<cr>:setlocal softtabstop=4<cr>
" indent whole file
nmap <leader>= <Esc>mygg=G`y
" Go to previous buffer
map <tab><tab> <C-^>
" Map Y to yank until EOL, rather than act as yy,
map Y y$
" Map <C-L> (redraw screen) to also turn off search highlighting until the
" next search
nnoremap <C-L> :nohl<CR><C-L>
" in current directory operations
nmap <leader>e :e <C-R>=expand("%:p:h") . "/" <CR>
nmap <leader>rd :r <C-R>=expand("%:p:h") . "/" <CR>
nmap <leader>sa :saveas <C-R>=expand("%:p:h") . "/" <CR>
nmap <leader>rn :Rename <C-R>=expand("%:p:h") . "/" <CR>
nmap <leader>mk :!mkdir <C-R>=expand("%:p:h") . "/" <CR>
cnoremap %% <C-R>=expand("%:h")."/"<CR>