-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnvimrc
More file actions
executable file
·183 lines (151 loc) · 3.99 KB
/
nvimrc
File metadata and controls
executable file
·183 lines (151 loc) · 3.99 KB
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
" https://github.com/VundleVim/Vundle.vim
filetype off
set rtp+=~/.config/nvim/bundle/Vundle.vim/
call vundle#begin('~/.config/nvim/bundle')
" Packages
Plugin 'VundleVim/Vundle.vim'
Plugin 'scrooloose/nerdtree'
Plugin 'junegunn/fzf'
Plugin 'jlanzarotta/bufexplorer'
Plugin 'godlygeek/tabular'
Plugin 'tpope/vim-commentary'
Plugin 'mileszs/ack.vim'
Plugin 'airblade/vim-gitgutter'
Plugin 'itchyny/lightline.vim'
Plugin 'tpope/vim-fugitive'
Plugin 'tpope/vim-rhubarb'
Plugin 'nelstrom/vim-visual-star-search'
Plugin 'tpope/vim-surround'
Plugin 'wellle/targets.vim'
Plugin 'machakann/vim-highlightedyank'
Plugin 'kshenoy/vim-signature'
" Additional language support
Plugin 'vim-ruby/vim-ruby'
Plugin 'elixir-lang/vim-elixir'
Plugin 'elzr/vim-json'
Plugin 'rust-lang/rust.vim'
Plugin 'cespare/vim-toml'
Plugin 'leafgarland/typescript-vim'
Plugin 'pangloss/vim-javascript'
Plugin 'mxw/vim-jsx'
" Colour schemes
" Plugin 'trusktr/seti.vim'
Plugin 'nanotech/jellybeans.vim'
call vundle#end()
filetype plugin on
filetype indent on
" Colours
set background=dark
set termguicolors
let g:lightline = { 'colorscheme': 'jellybeans' }
colorscheme jellybeans
" Render HTML attributes in italics
highlight Comment gui=italic cterm=italic
highlight htmlArg gui=italic cterm=italic
highlight xmlAttrib gui=italic cterm=italic
" Peace and quiet
set noerrorbells
set visualbell t_vb=
" neomake
let g:neomake_javascript_enabled_makers = ['eslint']
" Use rg instead of ack
let g:ackprg = 'rg --vimgrep'
" FZF
nnoremap <C-p> :FZF<CR>
" NERDTree
nnoremap <C-d> :NERDTreeToggle<CR>
nnoremap <C-f> :NERDTreeFind<CR>
" vim-json
let g:vim_json_syntax_conceal = 0
" highlightedyank
let g:highlightedyank_highlight_duration = 200
" Use the dot command in normal mode
xnoremap . :norm.<CR>
" Use git-stripspace
function! StripWhitespace()
let l = line(".")
let c = col(".")
%!git stripspace
call cursor(l, c)
endfunction
function! FormatJavaScript()
let l = line(".")
let c = col(".")
%!prettier --stdin --trailing-comma=es5 --single-quote --no-bracket-spacing
call cursor(l, c)
endfunction
" Run goimports on current file
function! GoImports()
let l = line(".")
let c = col(".")
%!goimports
call cursor(l, c)
endfunction
" Toggle relative numbers
function! ToggleRelativeNumbers()
if (&relativenumber == 1)
set norelativenumber
else
set relativenumber
endif
endfunction
" Some handy shortcuts
let mapleader=","
nnoremap <Leader>c :nohl<CR>
nnoremap <Leader>p :set paste!<CR>
nnoremap <Leader>r :call ToggleRelativeNumbers()<CR>
nnoremap <Leader>w :call StripWhitespace()<CR>:w<CR>
nnoremap <Leader>j :call FormatJavaScript()<CR>
nnoremap <Leader>i :call GoImports()<CR>
nnoremap <Leader>b :BufExplorer<CR>
" Don't trigger jump list with tab
nnoremap <Tab> <Nop>
nnoremap <C-I> <Tab>
" <esc> out of terminal
tnoremap <Esc> <C-\><C-n>
" lol ex mode
map Q <Nop>
" Quick comment toggling
noremap \ :Commentary<CR>
" Make Y consistent with C/D
nnoremap Y y$
" Show hidden chars
" http://vimcasts.org/episodes/show-invisibles/
set listchars=tab:▸\ ,eol:¬
nmap <leader>h :set list!<CR>
" Run goimports on files before saving
autocmd BufWritePre *.go call GoImports()
" Convenience
set nobackup noswapfile
" text editing
set tabstop=2 softtabstop=2 shiftwidth=2 expandtab
set textwidth=0
set formatoptions-=t " Auto-wrap text
set formatoptions-=c " Auto-wrap comments
set formatoptions-=l " Auto-wrap in insert mode
" search
set ignorecase smartcase
" live substitution
set inccommand=split
" Display
set number
set hidden
set cursorline
set fillchars=""
" set nowrap
set wrap linebreak nolist
set wildmode=list:longest,full
set title
set scrolloff=3
set sidescrolloff=5
set splitright
set splitbelow
" Use system clipboard by default
" https://github.com/spf13/spf13-vim/blob/7d48f769d1c991f82beee18a7f644b4ed351e5ce/.vimrc#L73-L79
if has('clipboard')
if has('unnamedplus') " When possible use + register for copy-paste
set clipboard=unnamedplus
else " On mac and Windows, use * register for copy-paste
set clipboard=unnamed
endif
endif