Repository navigation
Expand file tree
/
Copy pathinit.vim
More file actions
230 lines (182 loc) · 5.35 KB
/
Copy pathinit.vim
File metadata and controls
230 lines (182 loc) · 5.35 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
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
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
call plug#begin()
" Plug 'junegunn/vim-peekaboo'
Plug 'bronson/vim-trailing-whitespace'
Plug 'dense-analysis/ale'
Plug 'fatih/vim-go'
Plug 'godlygeek/tabular'
Plug 'honza/vim-snippets'
Plug 'jose-elias-alvarez/null-ls.nvim'
Plug 'jparise/vim-graphql'
Plug 'junegunn/fzf'
Plug 'junegunn/fzf.vim'
Plug 'machakann/vim-sandwich'
Plug 'maxmellon/vim-jsx-pretty'
Plug 'neovim/nvim-lspconfig'
Plug 'nvim-lua/plenary.nvim'
Plug 'othree/html5.vim'
Plug 'posva/vim-vue'
Plug 'rust-lang/rust.vim'
Plug 'scrooloose/nerdtree'
Plug 'tomtom/tlib_vim'
Plug 'tpope/vim-cucumber'
Plug 'tpope/vim-endwise'
Plug 'tpope/vim-fugitive'
Plug 'vim-ruby/vim-ruby'
" Emacs yank ring
Plug 'bfredl/nvim-miniyank'
" Completion
Plug 'hrsh7th/cmp-nvim-lsp'
Plug 'hrsh7th/cmp-buffer'
Plug 'hrsh7th/cmp-path'
Plug 'hrsh7th/cmp-cmdline'
Plug 'hrsh7th/nvim-cmp'
" Snippets
Plug 'sirver/ultisnips'
Plug 'quangnguyen30192/cmp-nvim-ultisnips'
" colorschemes
Plug 'junegunn/seoul256.vim'
Plug 'morhetz/gruvbox'
Plug 'preservim/vim-colors-pencil'
call plug#end()
" Tabs and spaces
set tabstop=2 shiftwidth=2 softtabstop=2
set expandtab
" autocmd Filetype scss setlocal noexpandtab
" autocmd Filetype css setlocal noexpandtab
set backspace=2 " make backspace work like most other apps
set nofoldenable " turn off folding
set hidden " prevent unsaved warnings when switching buffers
set autoread " autoload files when they're changed underneath vim
" searching config
set ignorecase " ignore case
set hlsearch " highlight the search terms
set incsearch " search while typing
set nowrapscan " do not wrap to the beginning of the file from the last match
" always show the file name at the bottom
set laststatus=2
set statusline+=%F
" make splits more natural
set splitbelow
set splitright
" stop vim saving annoying extra files
set nobackup
set noswapfile
" use line numbers
set nu rnu
" use relative line numbers
" set rnu
nmap , <leader>
nmap ,, <leader><leader>
nmap <space> <leader>
nmap <space><space> <leader><leader>
" better j,k
" noremap j gj
" noremap k gk
" noremap gj j
" noremap gk k
" center the cursor
set scrolloff=99
" map leader w to write file to prevent constant capital W commands
nnoremap <leader>w :w<CR>
nnoremap <leader>q :wq<CR>
" Allow quick-exit of vim with ctrl-d (no save)
inoremap <C-d> <esc>:q!<cr>
nnoremap <C-d> :q!<cr>
" Copy to global clipboard
vnoremap <C-c> :w !pbcopy<CR><CR>
nnoremap <leader>c :w !pbcopy<CR><CR>
" turn numbers on and off
set number
nmap <silent> <LocalLeader>nu :set invnumber<CR>
" nerd tree
nmap <silent> <LocalLeader>nt :NERDTreeToggle<CR>
nmap <silent> <LocalLeader>nr :NERDTree<CR>
nmap <silent> <LocalLeader>nf :NERDTreeFind<CR>
let NERDTreeShowLineNumbers=1
let NERDTreeIgnore=['node_modules']
" " command-p
" map <LocalLeader>t :CtrlP<CR>
" map <LocalLeader>p :CtrlP<CR>
" map <LocalLeader>b :CtrlPBuffer<CR>
" FZF
" nnoremap <leader>ff :Files<CR>
" nnoremap <leader>fg :GFiles<CR>
" nnoremap <leader>fb :Buffers<CR>
" nnoremap <leader>fl :Lines<CR>
" nnoremap <leader>fl :BLines<CR>
" nnoremap <leader>fw :Windows<CR>
" nnoremap <leader>fh :History
" nnoremap <leader>fc :Colors<CR>
" nnoremap <leader>ft :Filetypes<CR>
nnoremap <leader>f :Rg<Space>
nnoremap <leader>g :GFiles<CR>
nnoremap <leader>t :Files<CR>
nnoremap <leader>b :Buffers<CR>
nnoremap <leader>l :BLines<CR>
" command-p mappings
" nnoremap <leader>t :Files<CR>
" nnoremap <leader>p :Files<CR>
" nnoremap <leader>b :Buffers<CR>
" vim-go
nmap <silent> <LocalLeader>gt :GoTest<CR>
nmap <silent> <LocalLeader>gc :GoCoverage<CR>
if executable("goimports")
let g:go_fmt_command = "goimports"
endif
let g:go_def_mode='gopls'
let g:go_info_mode='gopls'
" clear unwanted whitespace
" nmap <silent> <LocalLeader>w :FixWhitespace<CR>
" markdown
let g:vim_markdown_folding_disabled=1
" Enable jumping to the end of ruby do/end blocks with % key
runtime! macros/matchit.vim
" set list
set listchars=eol:$,tab:→\ ,nbsp:␣,space:·
" Automatic line wrapping
set textwidth=130
set nowrap
" Linting (there is also further config in ftplugin folder)
let g:ale_fix_on_save = 0
let g:ale_lint_on_text_changed = 'never'
let g:ale_lint_on_insert_leave = 0
let g:ale_lint_on_enter = 0
let g:ale_lint_on_save = 0
let g:ale_lint_on_filetype_changed = 0
nnoremap <leader>a :ALEFix<CR>
" More natural snippet navigation
let g:UltiSnipsJumpForwardTrigger="<tab>"
let g:UltiSnipsJumpBackwardTrigger="<s-tab>"
" syntax highlighting and colorschemes
let g:go_highlight_structs = 1
let g:go_highlight_methods = 1
let g:go_highlight_functions = 1
let g:go_highlight_operators = 1
let g:go_highlight_build_constraints = 1
" enable syntax highlighting
syntax on
" highlight the current line
set cul
" Colours
colorscheme gruvbox
" Adjust background colour
highlight Normal ctermbg=None
" Remove background color on line numbers
" highlight LineNr ctermbg=255
" highlight LineNr ctermfg=240
" Remove characters indicating an empty line (end of buffer/eob)
set fillchars=eob:\ ,
" Remove background from vertical split in between document and NerdTree
highlight VertSplit cterm=None ctermbg=None ctermfg=240
" hi Search ctermbg=045
" hi visual term=reverse ctermbg=white
" Something to do with completion...
set completeopt=menuone,noselect
lua require('cmp-config/init')
" remove auto formatting
" lua require('null-ls-config/init')
" Yank ring
map p <Plug>(miniyank-autoput)
map P <Plug>(miniyank-autoPut)
map <C-n> <Plug>(miniyank-cycle)
map <C-p> <Plug>(miniyank-cycleback)