-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvimrc
209 lines (152 loc) · 4.27 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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
"================================================== Netrw
" absolute width of netrw window
let g:netrw_winsize = -28
" do not display info on the top of window
let g:netrw_banner = 0
" tree-view
let g:netrw_liststyle = 3
" sort is affecting only: directories on the top, files below
let g:netrw_sort_sequence = '[\/]$,*'
" use the previous window to open file
let g:netrw_browse_split = 4
"================================================== Basic config
set number
set tags=./.tags
set tags+=./tags
set noswapfile
syntax on
set ttyfast
set completeopt=menu
"Complete menu color
highlight Pmenu ctermbg=238 gui=bold
"Mouse da vergonha
set mouse=a
set hidden
"set laststatus=2
set incsearch
set hlsearch
set scrolloff=2
set background=dark "light colors
set tabstop=4 "tab = 4 chars
set shiftwidth=4 "Auto-indent tab = 4 chars
set expandtab
set virtualedit=onemore "Go one past last character in line
set virtualedit+=block " Free V-Block
filetype indent on
filetype plugin on
" CD to dir
autocmd VimEnter * lcd %:p:h
" Highlight current line
"set cursorline
hi CursorLine cterm=NONE ctermbg=234 ctermfg=NONE
set nostartofline
set guicursor=n-v-c:block,i-ci-ve:ver25,r-cr:hor20,o:hor50,a:blinkwait700-blinkoff400-blinkon250-Cursor/lCursor,sm:block-blinkwait175-blinkoff150-blinkon175
"Ctrl+s/Ctrl+Q reach VIM
silent !stty -ixon > /dev/null 2>/dev/null
colorscheme solid
set whichwrap+=<,>,h,l,[,]
set wildmenu
set wildmode=list:longest,full
set wildignore=*.o,*~,*.pyc,*.pyo,*.so,*.sw*,__pycache__
if filereadable('.vimrc.local')
source .vimrc.local
endif
"================================================== Folding
" Don't screw up folds when inserting text that might affect them, until
" leaving insert mode. Foldmethod is local to the window. Protect against
" screwing up folding when switching between windows.
"autocmd InsertEnter * if !exists('w:last_fdm') | let w:last_fdm=&foldmethod | setlocal foldmethod=manual | endif
"autocmd InsertLeave,WinLeave * if exists('w:last_fdm') | let &l:foldmethod=w:last_fdm | unlet w:last_fdm | endif
set nofoldenable
"
"set foldnestmax=1
"================================================== Mappings
noremap <C-´> <Esc>
nnoremap <C-\> i//<Esc>
"map q: :q
"map :Q :q
"map :Wq :wq
nnoremap gi gi<Esc>
nnoremap gl `.
nnoremap <expr> gp '`[' . strpart(getregtype(), 0, 1) . '`]'
"Help as vertical split
cnoremap hv vert bo h
vnoremap K k
inoremap <C-H> <Left>
inoremap <C-L> <Right>
inoremap <C-K> <Up>
inoremap <C-J> <Down>
inoremap <C-E> <C-O>w
inoremap <C-B> <C-O>b
nnoremap <Up> <nop>
nnoremap <Down> <nop>
nnoremap <Right> <nop>
nnoremap <Left> <nop>
nnoremap <C-h> <C-w>h
nnoremap <C-j> <C-w>j
nnoremap <C-k> <C-w>k
nnoremap <C-l> <C-w>l
inoremap <Nul> <Space>
"Help as full window
cnoremap hh H
command! -nargs=1 -complete=help H call HelpFullScreen( <f-args> )
function! HelpFullScreen( topic )
exe "h " . a:topic
wincmd j
try
clo
catch /^Vim(\a\+):E444:/ " can't close last window
endtry
endfunction
" :Nt as NerdTree
"map :Nt :NERDTree
"nnoremap <silent> <C-N> :NERDTreeToggle<CR>
nnoremap <silent> <C-N> :Lexplore<CR>
let g:netrw_list_hide= '.*\.o$'
"Space as Leader
let mapleader = "\<Space>"
"Ctrl+s to save
:map <C-s> :w <Enter>
:inoremap <c-s> <c-o>:w<CR>
:noremap <Leader>a $
:noremap j gj
:noremap k gk
"Buffer stuff
:nnoremap <Leader>t :enew<CR>
:nnoremap <Leader>e :e
:nnoremap <silent> <Tab> :bnext<CR>
:nnoremap <silent> <S-Tab> :bprevious<CR>
:nnoremap <silent> <Leader>q :bp <BAR> bd #<CR>
"This unsets the "last search pattern" register by hitting return
nnoremap <silent> <Leader>\ :noh<CR>
"Shift+J/K to insert line below/above without entering insert mode
:nnoremap <S-J> o<ESC>
:nnoremap <S-K> O<ESC>
:nnoremap <silent> <Leader>j :join<cr>
"Pipe ( | ) breaks line
:nnoremap \| i<CR><ESC>
"Paste without overlapping previous yank
"vnoremap p "_dP
"Delete without overlapping previous yank
"nnoremap D "_d
"vnoremap D "_d
"nnoremap c "_c
nnoremap x "_x
command! -nargs=0 TB call ToggleBackground()
function! ToggleBackground()
if g:colors_name == "solid"
:colorscheme kolor
else
:colorscheme solid
end
endfunction
nnoremap <F3> :TB<CR>
vmap <Leader>y "+y
nnoremap <Leader>y "+y
vmap <Leader>d "+d
nmap <Leader>p "+p
nmap <Leader>P "+P
vmap <Leader>p "+p
vmap <Leader>P "+P
let g:bufferline_echo = 0
set showmode