-
Notifications
You must be signed in to change notification settings - Fork 2
/
.vimrc.local
127 lines (110 loc) · 3.35 KB
/
.vimrc.local
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
filetype plugin indent on
set backspace=indent,eol,start
set wildmenu
set showmatch
set list
set listchars=tab:›\ ,trail:•,extends:#,nbsp:.
" For other files
let tabsize=3
let myfoldmethod="manual"
" For python files
au BufNewFile,BufRead *.py let tabsize=4
au BufNewFile,BufRead *.py let myfoldmethod="indent"
hi Search cterm=bold ctermfg=white ctermbg=yellow
set incsearch
set autoindent
set ignorecase
set laststatus=2
set scrolloff=10
set nohlsearch
set fileformat=unix
set path+=**
set nocompatible
set number
set relativenumber
execute "set tabstop=".tabsize
execute "set shiftwidth=".tabsize
execute "set softtabstop=".tabsize
execute "set foldmethod=".myfoldmethod
set scrolloff=8
set scrolljump=0 " Lines to scroll when cursor leaves screen
set cursorline
set foldnestmax=2
autocmd BufEnter * set mouse=
" IndentGuides settings
let indent_guides_auto_colors = 0
hi IndentGuidesOdd guibg=darkgrey ctermbg=237
hi IndentGuidesEven guibg=darkgrey ctermbg=237
let indent_guides_guide_size = 1
au VimEnter * IndentGuidesEnable
" Strip whitespace {
function! StripTrailingWhitespace()
" Preparation: save last search, and cursor position.
let _s=@/
let l = line(".")
let c = col(".")
" do the business:
%s/\s\+$//e
" clean up: restore previous search history, and cursor position
let @/=_s
call cursor(l, c)
endfunction
" }
" Replace Tabs with Spaces {
function! ReplaceTabsWithSpaces()
" Preparation: save last search, and cursor position.
let _s=@/
let l = line(".")
let c = col(".")
" do the business:
%s/\t/ /e
" clean up: restore previous search history, and cursor position
let @/=_s
call cursor(l, c)
endfunction
" }
" Custom key-bindings
let mapleader = ','
map <Leader>pt :set invpaste<CR>i
nmap // <leader>ci
nmap = G
nmap - gg
nmap '' :TagbarToggle<CR>
nmap f :find<space>
nmap t :tabnew<CR>:find<space>
nmap J :tabprevious<CR>
nmap K :tabnext<CR>
nmap <leader>x :call StripTrailingWhitespace()<CR>
nmap <leader>z :call ReplaceTabsWithSpaces()<CR>
nmap <leader><Enter> o<Esc>k
nmap <leader>dl d$
nmap <silent><leader>/ :set invhlsearch<CR>
vnoremap < <gv
vnoremap > >gv
vnoremap <up> gk
vnoremap <down> gj
nmap <down> gj
nmap <up> gk
" easy-motin mappings
map <Leader><Leader>l <Plug>(easymotion-lineforward)
map <Leader><Leader>j <Plug>(easymotion-j)
map <Leader><Leader>k <Plug>(easymotion-k)
map <Leader><Leader>h <Plug>(easymotion-linebackward)
" for code folding
nnoremap <space> za
nnoremap <leader><space> zR
vnoremap <space> zf
let g:EasyMotion_startofline = 0 " keep cursor column when JK motion
let g:EasyMotion_smartcase = 1
" ================ Searches ============================
set incsearch " do incremental searching
set hlsearch " Highlight searches by default
set ignorecase " Ignore case when searching...
set smartcase " ...unless we type a capital
map / <Plug>(easymotion-sn)
omap / <Plug>(easymotion-tn)
" These `n` & `N` mappings are options. You do not have to map `n` & `N` to EasyMotion.
" Without these mappings, `n` & `N` works fine. (These mappings just provide
" different highlight method and have some other features )
map n <Plug>(easymotion-next)
map N <Plug>(easymotion-prev)