-
Notifications
You must be signed in to change notification settings - Fork 0
/
vimrc
executable file
·143 lines (121 loc) · 3.78 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
syntax on
" -----------------------------------------------------------------------
" Plugins {{{
" -----------------------------------------------------------------------
call plug#begin('~/.vim/plugged')
Plug 'chriskempson/base16-vim'
Plug 'haya14busa/vim-poweryank'
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
Plug 'junegunn/fzf.vim'
Plug 'mhinz/vim-signify'
Plug 'sheerun/vim-polyglot'
Plug 'tpope/vim-commentary'
Plug 'tpope/vim-repeat'
Plug 'tpope/vim-surround'
Plug 'tpope/vim-unimpaired'
Plug 'tpope/vim-vinegar'
Plug 'w0rp/ale'
call plug#end()
filetype plugin indent on
" }}}
" -----------------------------------------------------------------------
" Options {{{
" -----------------------------------------------------------------------
let mapleader=' '
set autoindent
set autoread
set backspace=indent,eol,start
if has('unnamedplus')
set clipboard^=unnamedplus
endif
set complete-=i
set display+=lastline
set encoding=utf-8
set expandtab
set foldlevel=99
set hidden
set history=1000
set hlsearch
set ignorecase
set incsearch
set laststatus=2
set linebreak
set list
set listchars=tab:>\ ,trail:-,extends:>,precedes:<,nbsp:+
set mouse=a
set nobackup
set noswapfile
set number
set relativenumber
set ruler
set scrolloff=5
set shiftwidth=4
set showtabline=2
set smartcase
set smartindent
set smarttab
set splitbelow
set splitright
set tabpagemax=50
set tabstop=4
set undodir=~/.vim/undodir
set undofile
set visualbell
set wildchar=<TAB>
set wildmenu
set wildmode=list:longest,full
set writebackup
" }}}
" -----------------------------------------------------------------------
" Autocommands {{{
" -----------------------------------------------------------------------
" Remove extra whitespace
autocmd FileType php,js,jsx,css,scss,tpl,vim autocmd BufWritePre <buffer> %s/\s\+$//e
" Refresh buffer on focus
autocmd FocusGained,BufEnter * :silent! !
" Try relative numbers in normal mode and absolute in insert
autocmd InsertEnter * :set norelativenumber
autocmd InsertLeave * :set relativenumber
" }}}
" -----------------------------------------------------------------------
" Ale (linter) {{{
" -----------------------------------------------------------------------
let g:ale_fixers = { 'javascript': ['eslint'], }
let g:ale_linters = { 'javascript': ['eslint'], 'php': ['php'], }
let g:ale_sign_column_always = 1
" }}}
" -----------------------------------------------------------------------
" Colorscheme {{{
" -----------------------------------------------------------------------
call matchadd('ColorColumn', '\%81v', 100)
colorscheme base16-onedark
" -----------------------------------------------------------------------
" FZF - Fuzzy File {{{
" -----------------------------------------------------------------------
let g:fzf_buffers_jump = 1
" FZF Mapping selecting mappings
nmap <leader><tab> <plug>(fzf-maps-n)
xmap <leader><tab> <plug>(fzf-maps-x)
omap <leader><tab> <plug>(fzf-maps-o)
" Fuzzy search in all files names in current directory
noremap <leader>f :Files<CR>
" Fuzzy search in all edited files names in current git directory
noremap <leader>g :GFiles?<CR>
" Fuzzy search in all files in current directory
noremap <leader>r :Rg<CR>
" Fuzzy search in all commands
noremap <leader>c :Commands<CR>
" }}}
" -----------------------------------------------------------------------
" Mappings {{{
" -----------------------------------------------------------------------
" Edit vimrc and apply changes
nnoremap <leader>ev :vsplit $MYVIMRC<CR>
nnoremap <leader>sv :source $MYVIMRC<CR>
" Trim trailing whitespace
map <leader>ws :%s/\s\+$//e<CR>
" Yank selection from remote to local clipboard
map <leader>py <Plug>(operator-poweryank-osc52)
" Yank github url for current buffer from remote to local clipboard
map <leader>gy :redir @g<CR>:Gbrowse!<CR>:redir END<CR>:PowerYankOSC52 <C-R>g<CR>
" }}}