-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit.lua
More file actions
367 lines (322 loc) · 11 KB
/
init.lua
File metadata and controls
367 lines (322 loc) · 11 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
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
-- --------------------------------------------
-- PACKAGE MANAGER
-- Lazy.nvim
-- https://github.com/folke/lazy.nvim
-- --------------------------------------------
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
vim.fn.system({
"git",
"clone",
"--filter=blob:none",
"https://github.com/folke/lazy.nvim.git",
"--branch=stable", -- latest stable release
lazypath,
})
end
vim.opt.rtp:prepend(lazypath)
require('lazy').setup({
-- -- Provide interface for interacting with git branches
'idanarye/vim-merginal',
'scrooloose/nerdcommenter',
-- GIT
'tpope/vim-fugitive',
-- :Gbrowse to open current file on github
'tpope/vim-rhubarb',
-- Dockerfiles
-- 'ekalinin/Dockerfile.vim'
-- Ruby
-- 'tpope/vim-rails'
-- 'vim-ruby/vim-ruby'
-- 'noprompt/vim-yardoc'
-- Javascript
-- 'pangloss/vim-javascript'
-- 'posva/vim-vue'
-- Generic coding
'tpope/vim-surround',
'alvan/vim-closetag',
'tpope/vim-vinegar',
'machakann/vim-highlightedyank',
-- Other languages
-- 'avdgaag/vim-phoenix'
-- 'kchmck/vim-coffee-script'
-- 'elixir-lang/vim-elixir'
-- 'delphinus/vim-firestore'
-- :BD to close a buffer without closing the pane
'qpkorr/vim-bufkill',
-- :Delete, :Rename
'tpope/vim-eunuch',
-- Pretty
{
'junegunn/goyo.vim',
dependencies = {
'junegunn/limelight.vim',
},
cmd = "Goyo"
},
-- language server quick start
'neovim/nvim-lspconfig',
-- autopairs
'windwp/nvim-autopairs',
'RRethy/nvim-treesitter-endwise',
-- nvim-telescope
'nvim-lua/popup.nvim',
'nvim-lua/plenary.nvim',
'nvim-telescope/telescope.nvim',
{ 'nvim-telescope/telescope-fzf-native.nvim', build = 'make' },
-- nvim-treesitter: syntax highlighting
{ 'nvim-treesitter/nvim-treesitter', build = ':TSUpdate' },
-- Autocomplete
{
'hrsh7th/nvim-cmp',
-- load cmp on InsertEnter
-- :help InsertEnter
events = 'InsertEnter',
-- these dependencies will only be loaded when cmp loads
-- dependencies are always lazy-loaded unless specified otherwise
dependencies = {
'hrsh7th/cmp-nvim-lsp',
'hrsh7th/cmp-buffer',
'hrsh7th/cmp-path',
'hrsh7th/cmp-cmdline',
}
},
-- Snippet plugin, required for nvim/cmp completion
'L3MON4D3/LuaSnip',
'saadparwaiz1/cmp_luasnip',
-- Snippets
'rafamadriz/friendly-snippets',
-- added for Typescript work
-- as documented in
-- https://jose-elias-alvarez.medium.com/configuring-neovims-lsp-client-for-typescript-development-5789d58ea9c
-- 'jose-elias-alvarez/null-ls.nvim'
-- 'jose-elias-alvarez/nvim-lsp-ts-utils'
-- Theme with treesitter support
'navarasu/onedark.nvim',
-- Status line
{
'nvim-lualine/lualine.nvim',
dependencies = {
'kyazdani42/nvim-web-devicons'
}
},
})
-- " UI
-- " For use with onehalf
-- " colorscheme onehalfdark
-- set guifont=Hack:h16
vim.opt.guifont = 'Hack:h16'
-- let $NVIM_TUI_ENABLE_TRUE_COLOR=1
--
vim.g.NVIM_TUI_ENABLE_TRUE_COLOR = 1
-- " Make vim limelight work
-- set termguicolors
vim.opt.termguicolors = true
-- set tabstop=2
vim.opt.tabstop = 2
-- set shiftwidth=2
vim.opt.shiftwidth = 2
-- set softtabstop=2
vim.opt.softtabstop = 2
-- set autoindent
vim.opt.autoindent = true
-- "set smartindent
-- set expandtab
vim.opt.expandtab = true
-- set showmatch
vim.opt.showmatch = true
-- set number
vim.opt.number = true
-- "set encoding=utf-8
-- set tags=./tags,tags
vim.opt.tags = './tags,tags'
-- "no end of file at the end of files
-- set noeol
-- this is the only way to do it in Lua
vim.opt.eol = false
-- "Allow yank to macOS clipboard as well
-- set clipboard=unnamed
vim.opt.clipboard = 'unnamed'
-- "Allows using mouse to set cursor when in Iterm
-- set mouse=a
vim.opt.mouse = 'a'
-- nnoremap / /\v
-- <mode> <keys> <actions> <options>
vim.keymap.set('n', '/', '/\\v', { noremap = true })
-- vnoremap / /\v
vim.keymap.set('v', '/', '/\\v', { noremap = true })
-- nnoremap <up> <nop>
-- nnoremap <down> <nop>
-- nnoremap <left> <nop>
-- nnoremap <right> <nop>
vim.keymap.set('n', '<up>', '<nop>', { noremap = true })
vim.keymap.set('n', '<down>', '<nop>', { noremap = true })
vim.keymap.set('n', '<left>', '<nop>', { noremap = true })
vim.keymap.set('n', '<right>', '<nop>', { noremap = true })
-- inoremap <up> <nop>
-- inoremap <down> <nop>
-- inoremap <left> <nop>
-- inoremap <right> <nop>
vim.keymap.set('i', '<up>', '<nop>', { noremap = true })
vim.keymap.set('i', '<down>', '<nop>', { noremap = true })
vim.keymap.set('i', '<left>', '<nop>', { noremap = true })
vim.keymap.set('i', '<right>', '<nop>', { noremap = true })
-- "NERDTree replacement, netrw
-- let g:netrw_liststyle=3
-- let g:netrw_winsize=25
vim.g.netrw_liststyle = 3
vim.g.netrw_winsize = 25
-- map <leader>n :Lexplore<cr>
vim.keymap.set('', '<Leader>n', ':Lexplore<cr>')
-- "Vim Closetag
-- let g:closetag_filenames = "*.html,*.html.erb,*.vue"
vim.g.closetag_filenames = '*.html,*.html.erb,*.vue'
-- " new tab
-- nnoremap <C-t> :tabnew<CR>
vim.keymap.set('n', '<C-t>', ':tabnew<CR>', { noremap = true })
-- "Getting around tabs in neovim
-- nnoremap <S-h> :tabprev<cr>
-- nnoremap <S-l> :tabnext<cr>
vim.keymap.set('n', '<S-h>', ':tabprev<CR>', { noremap = true })
vim.keymap.set('n', '<S-l>', ':tabnext<CR>', { noremap = true })
-- nnoremap <leader>g :Goyo<cr>
vim.keymap.set('n', '<Leader>g', ':Goyo<CR>', { noremap = true })
-- ======================================
-- THEMING
-- ======================================
require('onedark').setup {
style = 'warmer'
}
require('onedark').load()
-- ======================================
-- SYNTAX HIGHLIGHTING
-- ======================================
-- nvim-treesitter syntax highlighting
require('nvim-treesitter.configs').setup {
ensure_installed = { 'lua', 'python', 'typescript', 'javascript', 'ruby', 'elixir' },
highlight = {
enable = true,
},
endwise = {
enable = true
},
}
-- ====================================================
-- (BRACKET) PAIRING
-- ====================================================
local npairs = require('nvim-autopairs')
npairs.setup({
disable_filetype = { "TelescopePrompt" , "vim" },
})
-- ====================================================
-- TELESCOPE CONFIG
-- ====================================================
require"telescope".setup {
extensions = {
fzf = {
fuzzy = true, -- false will only do exact matching
override_generic_sorter = false, -- override the generic sorter
override_file_sorter = true, -- override the file sorter
case_mode = "smart_case", -- or "ignore_case" or "respect_case"
-- the default case_mode is "smart_case"
}
}
}
-- To get fzf loaded and working with telescope, you need to call
-- load_extension, somewhere after setup function:
require('telescope').load_extension('fzf')
-- nnoremap <C-p> <cmd>lua require('telescope.builtin').find_files()<cr>
-- nnoremap <leader>b <cmd>lua require('telescope.builtin').buffers()<cr>
-- nnoremap <leader>a <cmd>lua require('telescope.builtin').live_grep()<cr>
vim.keymap.set('n', '<C-p>', function() require('telescope.builtin').find_files() end, { noremap = true })
vim.keymap.set('n', '<Leader>b', function() require('telescope.builtin').buffers() end, { noremap = true })
vim.keymap.set('n', '<Leader>a', function() require('telescope.builtin').live_grep() end, { noremap = true })
-- ====================================================
-- LSP CONFIG
-- ====================================================
-- " Import Lua based configs
-- " custom-nvim-cmp must come first because custom-lsp-config relies on it.
require('custom-nvim-cmp')
require("custom-lsp-config")
-- " Puts a column to the left of line numbers
-- set signcolumn=yes
vim.opt.signcolumn = 'yes'
-- "=================================================================
-- " BUFFER MANAGEMENT
-- "=================================================================
-- "Don't use vbufkill's keyboard mapping because
-- "they slow down responsiveness of :Buffers
-- let g:BufKillCreateMappings=0
vim.g.BufKillCreateMappings = 0
-- ----------------------------------------
-- NERD COMMENTER
-- ----------------------------------------
-- filetype plugin on -- Default on
-- " Adds a space after comment symbols
vim.g.NERDSpaceDelims = 1
-- "=================================================================
-- " CHANGES FOR NVIM TERM EMULATOR
-- "=================================================================
-- " Easy entrance into terminal mode
-- nnoremap <leader>t :vsp \| :term<cr>
vim.keymap.set('n', '<Leader>t', ':vsp | :term<CR>', { noremap = true })
-- " Map Alt-{h,j,k,l} in all modes to easily move between panes
-- " read this for how to map Alt-keys on a Mac
-- " http://stackoverflow.com/questions/7501092/can-i-map-alt-key-in-vim
-- " Alt-h (on Mac)
-- tnoremap ˙ <C-\><C-n><C-w>h
-- " Alt-j (on Mac)
-- tnoremap ∆ <C-\><C-n><C-w>j
-- " Alt-k (on Mac)
-- tnoremap ˚ <C-\><C-n><C-w>k
-- " Alt-l (on Mac)
-- tnoremap ¬ <C-\><C-n><C-w>l
vim.keymap.set('t', '<A-h>', '<C-\\><C-n><C-w>h', { noremap = true })
vim.keymap.set('t', '<A-j>', '<C-\\><C-n><C-w>j', { noremap = true })
vim.keymap.set('t', '<A-k>', '<C-\\><C-n><C-w>k', { noremap = true })
vim.keymap.set('t', '<A-l>', '<C-\\><C-n><C-w>l', { noremap = true })
-- " Alt-h (on Mac)
-- nnoremap ˙ <C-w>h
vim.keymap.set('n', '<A-h>', '<C-w>h', { noremap = true })
-- " Alt-j (on Mac)
-- nnoremap ∆ <C-w>j
vim.keymap.set('n', '<A-j>', '<C-w>j', { noremap = true })
-- " Alt-k (on Mac)
-- nnoremap ˚ <C-w>k
vim.keymap.set('n', '<A-k>', '<C-w>k', { noremap = true })
-- " Alt-l (on Mac)
-- nnoremap ¬ <C-w>l
vim.keymap.set('n', '<A-l>', '<C-w>l', { noremap = true })
-- "=================================================================
-- " FILE TYPE SPECIFICS
-- "=================================================================
-- au FileType python setlocal sw=4 sts=4 ts=4 et
vim.api.nvim_create_autocmd('FileType', { pattern = 'python', callback = function()
vim.opt_local.sw = 4
vim.opt_local.sts = 4
vim.opt_local.ts = 4
vim.opt_local.et = true
end
})
-- au FileType ruby setlocal nowrap sw=2 sts=2 ts=2 et
vim.api.nvim_create_autocmd('FileType', { pattern = 'ruby', callback = function()
vim.opt_local.wrap = false
vim.opt_local.sw = 2
vim.opt_local.sts = 2
vim.opt_local.ts = 2
vim.opt_local.et = true
end
})
-- " From posva/vim-vue
-- autocmd FileType vue syntax sync fromstart
vim.api.nvim_create_autocmd('FileType', { pattern = 'vue', command = 'syntax sync fromstart' })
-- " Dockerfile
-- au BufRead,BufNewFile *.docker setfiletype Dockerfile
vim.api.nvim_create_autocmd('BufRead,BufNewFile', { pattern = '*.docker', command = 'setfiletype Dockerfile' })
-- =================================================
-- STATUS LINE
-- =================================================
-- " Always displays the status line
-- set laststatus=2
vim.opt.laststatus = 2
require('lualine').setup()