aboutsummaryrefslogtreecommitdiff
path: root/.config/nvim/init.lua
blob: f3b5f554a293d8fe3153f36615f8016c31b60f54 (plain) (blame)
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
368
369
local fn = vim.fn
local install_path = fn.stdpath("data").."/site/pack/packer/start/packer.nvim"
local packer_bootstrap
if fn.empty(fn.glob(install_path)) > 0 then
	packer_bootstrap = fn.system({"git", "clone", "--depth", "1", "https://github.com/wbthomason/packer.nvim", install_path})
end

vim.api.nvim_set_option("mouse", "a")
vim.api.nvim_command("set number relativenumber mouse")

vim.opt.list = true
vim.opt.listchars:append("space:⋅")
vim.opt.listchars:append("eol:↴")
vim.opt.listchars:append("tab:-->")

vim.api.nvim_command("nnoremap <A-j> :m .+1<CR>==")
vim.api.nvim_command("nnoremap <A-k> :m .-2<CR>==")
vim.api.nvim_command("inoremap <A-j> <Esc>:m .+1<CR>==gi")
vim.api.nvim_command("inoremap <A-k> <Esc>:m .-2<CR>==gi")
vim.api.nvim_command("vnoremap <A-j> :m '>+1<CR>gv=gv")
vim.api.nvim_command("vnoremap <A-k> :m '<-2<CR>gv=gv")

return require("packer").startup(function(use)
	-- Package manager
	use "wbthomason/packer.nvim"
	-- My plugins here
	-- use "foo1/bar1.nvim"
	-- use "foo2/bar2.nvim"

	-- File tree
	use {
		"kyazdani42/nvim-tree.lua",
		requires = {
			"kyazdani42/nvim-web-devicons", -- optional, for file icon
		},
		cmd = { "NvimTreeToggle" },
		setup = function()
			vim.api.nvim_set_keymap('n', "<c-n>", ":NvimTreeToggle<CR>", { noremap = true, silent = true })
		end,
		config = function()
			require'nvim-tree'.setup { -- BEGIN_DEFAULT_OPTS
				auto_reload_on_write = true,
				disable_netrw = false,
				hijack_cursor = false,
				hijack_netrw = true,
				hijack_unnamed_buffer_when_opening = false,
				ignore_buffer_on_setup = false,
				open_on_setup = false,
				open_on_setup_file = false,
				open_on_tab = false,
				sort_by = "name",
				update_cwd = false,
				view = {
					width = 30,
					height = 30,
					hide_root_folder = false,
					side = "left",
					preserve_window_proportions = false,
					number = false,
					relativenumber = false,
					signcolumn = "yes",
					mappings = {
						custom_only = false,
						list = {
							-- user mappings go here
						},
					},
				},
				renderer = {
					indent_markers = {
						enable = false,
						icons = {
							corner = "└ ",
							edge = "│ ",
							none = "	",
						},
					},
					icons = {
						webdev_colors = true,
						git_placement = "before",
					}
				},
				hijack_directories = {
					enable = true,
					auto_open = true,
				},
				update_focused_file = {
					enable = false,
					update_cwd = false,
					ignore_list = {},
				},
				ignore_ft_on_setup = {},
				system_open = {
					cmd = "",
					args = {},
				},
				diagnostics = {
					enable = false,
					show_on_dirs = false,
					icons = {
						hint = "",
						info = "",
						warning = "",
						error = "",
					},
				},
				filters = {
					dotfiles = false,
					custom = {},
					exclude = {},
				},
				git = {
					enable = true,
					ignore = true,
					timeout = 400,
				},
				actions = {
					use_system_clipboard = true,
					change_dir = {
						enable = true,
						global = false,
						restrict_above_cwd = false,
					},
					open_file = {
						quit_on_open = false,
						resize_window = false,
						window_picker = {
							enable = true,
							chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890",
							exclude = {
								filetype = { "notify", "packer", "qf", "diff", "fugitive", "fugitiveblame" },
								buftype = { "nofile", "terminal", "help" },
							},
						},
					},
				},
				trash = {
					cmd = "trash",
					require_confirm = true,
				},
				log = {
					enable = false,
					truncate = false,
					types = {
						all = false,
						config = false,
						copy_paste = false,
						diagnostics = false,
						git = false,
						profile = false,
					},
				},
			} -- END_DEFAULT_OPTS
		end
		-- tag = "nightly" -- optional, updated every week. (see issue #1193)
	}

	use {
		'nvim-telescope/telescope.nvim',
		requires = { {'nvim-lua/plenary.nvim'} },
		config = function()
			vim.api.nvim_set_keymap('n', "<c-f>", ":Telescope find_files<CR>", { noremap = true, silent = true })
			vim.api.nvim_set_keymap('n', "<c-TAB>", ":Telescope buffers<CR>", { noremap = true, silent = true })
		end,
	}

	use {
		'kdheepak/tabline.nvim',
		config = function()
			require'tabline'.setup {
				-- Defaults configuration options
				enable = true,
				options = {
				-- If lualine is installed tabline will use separators configured in lualine by default.
				-- These options can be used to override those settings.
					section_separators = {'', ''},
					component_separators = {'', ''},
					max_bufferline_percent = 66, -- set to nil by default, and it uses vim.o.columns * 2/3
					show_tabs_always = false, -- this shows tabs only when there are more than one tab or if the first tab is named
					show_devicons = true, -- this shows devicons in buffer section
					show_bufnr = false, -- this appends [bufnr] to buffer section,
					show_filename_only = false, -- shows base filename only instead of relative path in filename
					modified_icon = "+ ", -- change the default modified icon
					modified_italic = false, -- set to true by default; this determines whether the filename turns italic if modified
					show_tabs_only = false, -- this shows only tabs instead of tabs + buffers
				}
			}
			vim.cmd[[
				set guioptions-=e " Use showtabline in gui vim
				set sessionoptions+=tabpages,globals " store tabpages and globals in session
			]]
		end,
		requires = { { 'hoob3rt/lualine.nvim', opt=true }, {'kyazdani42/nvim-web-devicons', opt = true} }
	}

	use {
		'nvim-lualine/lualine.nvim',
		requires = { 'kyazdani42/nvim-web-devicons', opt = true },
		config = function()
			local tabline = require("tabline")
			require('lualine').setup {
				options = {
					icons_enabled = true,
					theme = 'auto',
					component_separators = { left = '', right = ''},
					section_separators = { left = '', right = ''},
					disabled_filetypes = {},
					always_divide_middle = true,
					globalstatus = false,
				},
				sections = {
					lualine_a = {'mode'},
					lualine_b = {'branch', 'diff', 'diagnostics'},
					lualine_c = {'filename'},
					lualine_x = {'encoding', 'fileformat', 'filetype'},
					lualine_y = {'progress'},
					lualine_z = {'location'}
				},
				inactive_sections = {
					lualine_a = {},
					lualine_b = {},
					lualine_c = {'filename'},
					lualine_x = {'location'},
					lualine_y = {},
					lualine_z = {}
				},
				tabline = {
					lualine_a = {},
					lualine_b = {},
					lualine_c = { tabline.tabline_buffers },
					lualine_x = { tabline.tabline_tabs },
					lualine_y = {},
					lualine_z = {},

				},
				extensions = {}
			}
		end,
	}

	use {
		"karb94/neoscroll.nvim",
		 config = function()
			require("neoscroll").setup()
		 end,
	}

	use {
		"lukas-reineke/indent-blankline.nvim",
		config = function()
			vim.opt.termguicolors = true
			-- vim.cmd [[highlight IndentBlanklineIndent1 guifg=#E06C75 gui=nocombine]]
			-- vim.cmd [[highlight IndentBlanklineIndent2 guifg=#E5C07B gui=nocombine]]
			-- vim.cmd [[highlight IndentBlanklineIndent3 guifg=#98C379 gui=nocombine]]
			-- vim.cmd [[highlight IndentBlanklineIndent4 guifg=#56B6C2 gui=nocombine]]
			-- vim.cmd [[highlight IndentBlanklineIndent5 guifg=#61AFEF gui=nocombine]]
			-- vim.cmd [[highlight IndentBlanklineIndent6 guifg=#C678DD gui=nocombine]]

			require("indent_blankline").setup {
				show_end_of_line = true,
				space_char_blankline = " ",
				-- char_highlight_list = {
				-- 	"IndentBlanklineIndent1",
				-- 	"IndentBlanklineIndent2",
				-- 	"IndentBlanklineIndent3",
				-- 	"IndentBlanklineIndent4",
				-- 	"IndentBlanklineIndent5",
				-- 	"IndentBlanklineIndent6",
				-- },

			}
		end
	}

	use {
		"nvim-treesitter/nvim-treesitter",
		config = function()
			require'nvim-treesitter.configs'.setup {
				-- A list of parser names, or "all"
				ensure_installed = { "javascript", "lua", "rust" },

				-- Install parsers synchronously (only applied to `ensure_installed`)
				sync_install = false,

				-- List of parsers to ignore installing (for "all")
				-- ignore_install = {},

				highlight = {
					-- `false` will disable the whole extension
					enable = true,

					-- NOTE: these are the names of the parsers and not the filetype. (for example if you want to
					-- disable highlighting for the `tex` filetype, you need to include `latex` in this list as this is
					-- the name of the parser)
					-- list of language that will be disabled
					-- disable = { "c", "rust" },

					-- Setting this to true will run `:h syntax` and tree-sitter at the same time.
					-- Set this to `true` if you depend on 'syntax' being enabled (like for indentation).
					-- Using this option may slow down your editor, and you may see some duplicate highlights.
					-- Instead of true it can also be a list of languages
					additional_vim_regex_highlighting = false,
				},
			}
		end
	}

	use {
		"norcalli/nvim-colorizer.lua"
	}

	use {
		"google/vim-coverage",
		requires = "google/vim-maktaba",
	}

	use {
		"prettier/vim-prettier",
	}

	use {
		"editorconfig/editorconfig-vim",
	}

	use {
		requires = "neovim/nvim-lspconfig",
		"williamboman/nvim-lsp-installer",
		config = function()
			 local lsp_installer = require "nvim-lsp-installer"

			 lsp_installer.on_server_ready(function(server)
					local opts = {}

					if server.name == "denols" then
						 opts.root_dir = vim.loop.cwd
					end

					server:setup(opts)
					vim.cmd [[ do User LspAttachBuffers ]]
			 end)
		end,
	 }

	use "nathom/filetype.nvim"

	use {
		"dracula/vim",
		config = function()
			vim.api.nvim_command("colorscheme dracula")
		end
	}

	use {
		"lukas-reineke/lsp-format.nvim",
		config = function()
			require "lsp-format".setup {
				typescript = { tab_width = 4 },
				yaml = { tab_width = 2 },
			}
		end,
	}

	-- Automatically set up your configuration after cloning packer.nvim
	-- Put this at the end after all plugins
	if packer_bootstrap then
		require("packer").sync()
	end
end)