-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit.vim
110 lines (82 loc) · 2.4 KB
/
init.vim
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
" Leader key to space
let mapleader=" "
set nowrap
" During search, if no maj, then case insensitive
set ignorecase smartcase
set preserveindent
set shiftwidth=4
set shiftround
set tabstop=4
set softtabstop=4
set expandtab
set smarttab
set pastetoggle=<Leader>P
" No mouse at all
set mouse=
" Do not use arrow keys
noremap <Up> <NOP>
noremap <Down> <NOP>
noremap <Left> <NOP>
noremap <Right> <NOP>
"This allows for change paste motion cp{motion}
nmap <silent> cp :set opfunc=ChangePaste<CR>g@
function! ChangePaste(type, ...)
silent exe "normal! `[v`]\"_c"
silent exe "normal! p"
endfunction
"Escape terminal mode easily
:tnoremap <Esc> <C-\><C-n>
call plug#begin()
Plug 'tpope/vim-surround'
Plug 'benekastah/neomake', has('nvim') ? {} : { 'on': [] }
Plug 'kien/ctrlp.vim'
Plug 'bling/vim-airline'
Plug 'tpope/vim-fugitive'
Plug 'airblade/vim-gitgutter'
Plug 'demorose/up.vim'
Plug 'nightsense/seabird'
Plug 'mattn/emmet-vim'
call plug#end()
" Copy and paste from system clipboard
set clipboard=unnamedplus
colorscheme up
" Number related
set relativenumber
autocmd InsertEnter * :set number
autocmd InsertEnter * :set relativenumber!
autocmd InsertLeave * :set number
autocmd InsertLeave * :set relativenumber!
" Highlight column 80 and 120
set colorcolumn=80,120
" Highlight cursor column and line
set cursorline
set cursorcolumn
" Airline configuration
if !exists('g:airline_symbols')
let g:airline_symbols = {}
endif
let g:airline_powerline_fonts = 1
let g:airline#extensions#tabline#enabled = 1
" Remove trailing space
nmap <Leader>Cts :%s/\s\+$//e <CR>
nmap <Leader>E :Vexplore <CR>
"search
" Find occurence
map <Leader>Fo :execute "noautocmd vimgrep /\\<" . expand("<cword>") . "\\>/j **/*" . expand("%:e") <Bar> cw<CR>
" Find class
map <Leader>Fc :execute "noautocmd vimgrep /\\<class " . expand("<cword>") . "\\>/j **/*" . expand("%:e") <Bar> cw<CR>
" Find function
map <Leader>Ff :execute "noautocmd vimgrep /\\<function " . expand("<cword>") . "\\>/j **/*" . expand("%:e") <Bar> cw<CR>
" Init vimgrep
map <Leader>Fg :execute "noautocmd vimgrep //j **/*"
" Find function in file
map <Leader>ff /function
" W to write as root
" command! is used to overwrite W if it exists.
command! W :execute ':silent w !sudo tee % > /dev/null' | :edit!
"
let g:netrw_liststyle=3
" emmet-vim related
let g:user_emmet_mode='a'
" Neomake php
let g:neomake_php_phpcs_args_standard = 'PSR2'