aboutsummaryrefslogblamecommitdiff
path: root/.config/nvim/init.lua
blob: fdf2a1181fc2b76e5a5bec4665827952f41828b0 (plain) (tree)
1
2
3
4
5
6
7
8
9
             
                 
                                                                                

                                           



                                                                                            


                                     
                                                            
 
                                                               




                                     
                                                      








                                                          




















                                                                                             


                    
                                                              
                            
                                                                                                     


                                           

                                                                                    

                                   
                                                  
                                                            
                                                  





                                                                            

                                                              
                                                           
                                  
                                                                                  
                                               
                                                      

                                                                                                               
                                  

                         



                                                                                     







                                                                                          

                    
             

                                                                                                 
         
             

                                                                                             
                                   

                                                             

                                                             


                                                                                               




                                                                    





                                                                                             



                                                       

                                                                   

                                                       
                                  
                                                




                         

                                                                     


             
                                                                         

                                                    





                                                                                                



                                                           




                                                                                           

                         
                    


             
                                                                     
                                   
                                                                

























                                                                                                                                           
                    

         
                                                                

             

                                                                   

         
                                                                                
 
                                                                  

             

                                                                      
                                   
                                                                           
 

                                                                      
 
                                                                                                
 


                                                                      
                    
         
 



                                                                    

             

                                                                                    


             
                                                                   
                                   
                                                   





                                                               
















                                                                           

                                                                            
                                                             

    
-- :vi ft=lua
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 cursorline")

-- Comment the following lines to disable whitespace characters
vim.opt.list = true
vim.opt.listchars:append("space:⋅")
vim.opt.listchars:append("eol:↴")
vim.opt.listchars:append("tab:-->")

-- VSCode like moving lines up and down with alt+{j,k}
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 { "https://github.com/wbthomason/packer.nvim" }

	use { "https://github.com/vladdoster/remember.nvim" }

	use {
		"https://github.com/filipdutescu/renamer.nvim",
		branch = "master",
		requires = { { "https://github.com/nvim-lua/plenary.nvim" } },
		config = function()
			vim.api.nvim_set_keymap("i", "<F2>",
			                        "<cmd>lua require(\"renamer\").rename()<cr>",
			                        { noremap = true, silent = true })
			vim.api.nvim_set_keymap("n", "<leader>rn",
			                        "<cmd>lua require(\"renamer\").rename()<cr>",
			                        { noremap = true, silent = true })
			vim.api.nvim_set_keymap("v", "<leader>rn",
			                        "<cmd>lua require(\"renamer\").rename()<cr>",
			                        { noremap = true, silent = true })

		end,
	}

	-- File tree
	use {
		"https://github.com/kyazdani42/nvim-tree.lua",
		requires = {
			"https://github.com/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 {
				auto_reload_on_write = true,
				update_cwd = true,
				view = {
					width = 30,
					height = 30,
					hide_root_folder = false,
					side = "left",
					preserve_window_proportions = false,
					number = true,
					relativenumber = true,
					signcolumn = "yes",
				},
				renderer = { indent_markers = { enable = true } },
				diagnostics = {
					enable = true,
					show_on_dirs = true,
					icons = { hint = "", info = "", warning = "", error = "" },
				},
			}
		end,
		-- tag = "nightly" -- optional, updated every week. (see issue #1193)
	}

	use {
		"https://github.com/nvim-telescope/telescope.nvim",
		cmd = { "Telescope" },
		requires = { { "https://github.com/nvim-lua/plenary.nvim" } },
		setup = 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 {
		"https://github.com/akinsho/bufferline.nvim",
		config = function() require("bufferline").setup { diagnostics = "nvim_lsp" } end,
	}
	use {
		"https://github.com/nvim-lualine/lualine.nvim",
		requires = { "https://github.com/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 = {},
				},
				extensions = {},
			}
		end,
	}

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

	use {
		"https://github.com/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 {
		"https://github.com/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 { "https://github.com/norcalli/nvim-colorizer.lua" }

	use {
		"https://github.com/google/vim-coverage",
		requires = "https://github.com/google/vim-maktaba",
	}

	use { "https://github.com/prettier/vim-prettier", cmd = { "Prettier" } }

	use { "https://github.com/editorconfig/editorconfig-vim" }

	use {
		requires = "https://github.com/neovim/nvim-lspconfig",
		"https://github.com/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 {
		"https://github.com/nathom/filetype.nvim",
		setup = function() vim.g.did_load_filetypes = 1 end,
	}

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

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

	use { "https://github.com/github/copilot.vim" }

	use {
		"https://github.com/ms-jpq/coq_nvim",
		requires = {
			"https://github.com/ms-jpq/coq.artifacts",
   "https://github.com/ms-jpq/coq.thirdparty",
		},
		config = function()
			vim.g.coq_settings = {
				auto_start = "shut-up",
				clients = { tabnine = { enabled = true } },
			}
			require("coq")
		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)