From ea8f210bd97b48d2ffd664f966872a8e51f1e306 Mon Sep 17 00:00:00 2001 From: Toby Vincent Date: Thu, 17 Mar 2022 13:09:00 -0500 Subject: feat: initial working nvim --- nvim/init.lua | 5 + nvim/lua/configs.lua | 109 ++++++++ nvim/lua/mappings.lua | 87 +++++++ nvim/lua/plugins.lua | 278 +++++++++++++++++++++ nvim/lua/plugins/blankline.lua | 6 + nvim/lua/plugins/bufferline.lua | 182 ++++++++++++++ nvim/lua/plugins/cmp.lua | 138 +++++++++++ nvim/lua/plugins/dap.lua | 95 +++++++ nvim/lua/plugins/git-worktree.lua | 4 + nvim/lua/plugins/lsp-installer.lua | 121 +++++++++ nvim/lua/plugins/lspconfig.lua | 97 ++++++++ nvim/lua/plugins/lspkind.lua | 29 +++ nvim/lua/plugins/lspstatus.lua | 12 + nvim/lua/plugins/lualine.lua | 5 + nvim/lua/plugins/luasnip.lua | 13 + nvim/lua/plugins/neogit.lua | 1 + nvim/lua/plugins/null-ls.lua | 12 + nvim/lua/plugins/nvim-tree.lua | 7 + nvim/lua/plugins/telescope.lua | 51 ++++ nvim/lua/plugins/treesitter.lua | 9 + nvim/lua/utils.lua | 9 + nvim/plugin/packer_compiled.lua | 494 +++++++++++++++++++++++++++++++++++++ 22 files changed, 1764 insertions(+) create mode 100644 nvim/init.lua create mode 100644 nvim/lua/configs.lua create mode 100644 nvim/lua/mappings.lua create mode 100644 nvim/lua/plugins.lua create mode 100644 nvim/lua/plugins/blankline.lua create mode 100644 nvim/lua/plugins/bufferline.lua create mode 100644 nvim/lua/plugins/cmp.lua create mode 100644 nvim/lua/plugins/dap.lua create mode 100644 nvim/lua/plugins/git-worktree.lua create mode 100644 nvim/lua/plugins/lsp-installer.lua create mode 100644 nvim/lua/plugins/lspconfig.lua create mode 100644 nvim/lua/plugins/lspkind.lua create mode 100644 nvim/lua/plugins/lspstatus.lua create mode 100644 nvim/lua/plugins/lualine.lua create mode 100644 nvim/lua/plugins/luasnip.lua create mode 100644 nvim/lua/plugins/neogit.lua create mode 100644 nvim/lua/plugins/null-ls.lua create mode 100644 nvim/lua/plugins/nvim-tree.lua create mode 100644 nvim/lua/plugins/telescope.lua create mode 100644 nvim/lua/plugins/treesitter.lua create mode 100644 nvim/lua/utils.lua create mode 100644 nvim/plugin/packer_compiled.lua (limited to 'nvim') diff --git a/nvim/init.lua b/nvim/init.lua new file mode 100644 index 0000000..91d1273 --- /dev/null +++ b/nvim/init.lua @@ -0,0 +1,5 @@ +-- https://github.com/mikebarkmin/.dotfiles/tree/main/nvim/.config/nvim +-- https://github.com/ThePrimeagen/.dotfiles/tree/master/nvim +require('plugins') +require('configs') +require('mappings') diff --git a/nvim/lua/configs.lua b/nvim/lua/configs.lua new file mode 100644 index 0000000..6ccb40c --- /dev/null +++ b/nvim/lua/configs.lua @@ -0,0 +1,109 @@ +local g = vim.g -- global variables +local cmd = vim.cmd -- execute Vim commands +local opt = vim.opt -- vim options +local exec = vim.api.nvim_exec -- execute Vimscript + +g.vscode_style = "dark" +g.vscode_transparent = 1 +g.vscode_italic_comment = 1 +g.vscode_disable_nvimtree_bg = true +g.tex_flavor = "latex"; + +-- global options +local options = { + termguicolors = true, -- Enable GUI colors for the terminal to get truecolor + list = false, -- show whitespace + listchars = { + nbsp = '⦸', -- CIRCLED REVERSE SOLIDUS (U+29B8, UTF-8: E2 A6 B8) + extends = '»', -- RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK (U+00BB, UTF-8: C2 BB) + precedes = '«', -- LEFT-POINTING DOUBLE ANGLE QUOTATION MARK (U+00AB, UTF-8: C2 AB) + tab = '▷─', -- WHITE RIGHT-POINTING TRIANGLE (U+25B7, UTF-8: E2 96 B7) + BOX DRAWINGS HEAVY TRIPLE DASH HORIZONTAL (U+2505, UTF-8: E2 94 85) + trail = '•', -- BULLET (U+2022, UTF-8: E2 80 A2) + space = ' ' + }, + fillchars = { + diff = '∙', -- BULLET OPERATOR (U+2219, UTF-8: E2 88 99) + eob = ' ', -- NO-BREAK SPACE (U+00A0, UTF-8: C2 A0) to suppress ~ at EndOfBuffer + fold = '·', -- MIDDLE DOT (U+00B7, UTF-8: C2 B7) + vert = ' ' -- remove ugly vertical lines on window division + }, + undofile = true, + undodir = vim.fn.stdpath("config") .. "/undo", + clipboard = opt.clipboard + "unnamedplus", -- copy & paste + shortmess = opt.shortmess + "c" + wrap = false, -- don't automatically wrap on load + showmatch = true, -- show the matching part of the pair for [] {} and () + cursorline = true, -- highlight current line + number = true, -- show line numbers + relativenumber = true, -- show relative line number + incsearch = true, -- incremental search + hlsearch = true, -- highlighted search results + ignorecase = true, -- ignore case sensetive while searching + smartcase = true, + scrolloff = 1, -- when scrolling, keep cursor 1 lines away from screen border + sidescrolloff = 2, -- keep 30 columns visible left and right of the cursor at all times + backspace = 'indent,start,eol', -- make backspace behave like normal again + mouse = "a", -- turn on mouse interaction + updatetime = 500, -- CursorHold interval + expandtab = true, + softtabstop = 4, + et.textwidth = 100, + shiftwidth = 4, -- spaces per tab (when shifting), when using the >> or << commands, shift lines by 4 spaces + tabstop = 4, -- spaces per tab + smarttab = true, -- / indent/dedent in leading whitespace + autoindent = true, -- maintain indent of current line + shiftround = true, + splitbelow = true, -- open horizontal splits below current window + splitright = true, -- open vertical splits to the right of the current window + laststatus = 2, -- always show status line + colorcolumn = "100", -- vertical word limit line + hidden = true, -- allows you to hide buffers with unsaved changes without being prompted + inccommand = 'split', -- live preview of :s results + shell = 'zsh', -- shell to use for `!`, `:!`, `system()` etc. + wildignore = opt.wildignore + '*.o,*.rej,*.so', + lazyredraw = true, + completeopt = 'menuone,noselect,noinsert', +} + +for k, v in pairs(options) do + vim.opt[k] = v +end + +-- highlight on yank +exec([[ + augroup YankHighlight + autocmd! + autocmd TextYankPost * silent! lua vim.highlight.on_yank{higroup="IncSearch", timeout=500, on_visual=true} + augroup end +]], false) + +-- to Show whitespace, MUST be inserted BEFORE the colorscheme command +cmd 'autocmd ColorScheme * highlight ExtraWhitespace ctermbg=red guibg=grey' + +-- set colorscheme +cmd 'colorscheme vscode' + +-- jump to the last position when reopening a file +cmd [[ +if has("autocmd") + au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$") | exe "normal! g`\"" | endif +endif +]] + +-- remove whitespace on save +cmd [[au BufWritePre * :%s/\s\+$//e]] + +-- don't auto commenting new lines +cmd [[au BufEnter * set fo-=c fo-=r fo-=o]] + +-- 2 spaces for selected filetypes +cmd [[ autocmd FileType xml,html,xhtml,css,scss,javascript,lua,dart setlocal shiftwidth=2 tabstop=2 ]] + +-- json +cmd [[ au BufEnter *.json set ai expandtab shiftwidth=2 tabstop=2 sta fo=croql ]] + +--- latex +cmd [[ autocmd FileType latex,tex,plaintex set wrap linebreak ]] + +-- markdown +cmd [[ autocmd BufNewFile,BufRead *.mdx set filetype=markdown ]] \ No newline at end of file diff --git a/nvim/lua/mappings.lua b/nvim/lua/mappings.lua new file mode 100644 index 0000000..83d3f28 --- /dev/null +++ b/nvim/lua/mappings.lua @@ -0,0 +1,87 @@ +local map = require('cartographer') + +vim.g.mapleader = ' ' + +-- wrap +map.n.nore['w'] = ':set wrap! linebreak!' +map.n.nore['j'] = 'gj' +map.n.nore['k'] = 'gk' + +-- navigation +--- behave like other capitals +map.n.nore['Y'] = 'y$' + +--- keeping it centered +map.n.nore['n'] = 'nzzzv' +map.n.nore['N'] = 'Nzzzv' +map.n.nore['J'] = 'mzJ`z' + +--- moving text +map.v.nore['J'] = [[:m '>+1gv=gv]] +map.v.nore['K'] = [[:m '<-2gv=gv]] +map.n.nore['k'] = ':m .-2==' +map.n.nore['j'] = ':m .+1==' + +-- telescope +map.n.nore.silent[''] = [[Telescope buffers show_all_buffers=true theme=get_dropdown]] +map.n.nore.silent[''] = [[Telescope frecency theme=get_dropdown]] +map.n.nore.silent[''] = [[Telescope git_files theme=get_dropdown]] +map.n.nore.silent[''] = [[Telescope find_files theme=get_dropdown]] +map.n.nore.silent[''] = [[Telescope live_grep theme=get_dropdown]] +-- map.v.nore.silent["rr"] = [[:lua require('telescope').extensions.refactoring.refactors()]] + +-- refactoring +map.v.nore.silent['re'] = [[:lua require("refactoring").refactor(106)]] +map.n.nore.silent['ri'] = [[:lua require("refactoring").refactor(123)]] +map.n.nore.silent['dh'] = [[:lua print(vim.inspect(require("refactoring").debug.get_path()))]] +map.n.nore.silent['dg'] = [[:lua require("refactoring").debug.printf({below = false})]] +map.n.nore.silent['dm'] = [[:lua require("refactoring").debug.printf({below = true})]] +map.n.nore.silent['df'] = [[:lua require("refactoring").debug.print_var({below = false})]] +map.n.nore.silent['db'] = [[:lua require("refactoring").debug.print_var({below = true})]] + +--- quicklist +map.n.nore['qn'] = ':cnext' +map.n.nore['qp'] = ':cprev' +map.n.nore['qo'] = ':copen' + +-- lua tree +require'nvim-tree'.setup {} +map.nore[''] = 'NvimTreeToggle' +map.n.nore['tf'] = 'NvimTreeFindFileToggle' +map.n.nore['tr'] = 'NvimTreeRefresh' + +-- language server +map.n.nore['vd'] = 'lua vim.lsp.buf.definition()' +map.n.nore['vi'] = 'lua vim.lsp.buf.implementation()' +map.n.nore['vsh'] = 'lua vim.lsp.buf.signature_help()' +map.n.nore['vrr'] = 'lua vim.lsp.buf.references()' +map.n.nore['vrn'] = 'lua vim.lsp.buf.rename()' +map.n.nore['vh'] = 'lua vim.lsp.buf.hover()' +map.n.nore['vca'] = 'lua vim.lsp.buf.code_action()' +map.n.nore['vsd'] = 'lua vim.lsp.diagnostic.show_line_diagnostics()' +map.n.nore['vn'] = 'lua vim.lsp.diagnostic.goto_next()' +map.n.nore['vp'] = 'lua vim.lsp.diagnostic.goto_prev()' +map.n.nore['vf'] = 'Format' + +-- debug +map.n.nore[''] = [[lua require('dap').continue()]] +map.n.nore[''] = [[lua require('dap').step_over()]] +map.n.nore[''] = [[lua require('dap').step_into()]] +map.n.nore[''] = [[lua require('dap').step_out()]] + +-- git +local function git_branches() + require("telescope.builtin").git_branches({ + attach_mappings = function(_, map) + map("i", "", actions.git_delete_branch) + map("n", "", actions.git_delete_branch) + return true + end, + }) +end + +map.n.nore['gb'] = git_branches +map.n.nore['go'] = 'Neogit' +map.n.nore['gc'] = 'Neogit commit' +map.n.nore['gws'] = [[lua require('telescope').extensions.git_worktree.git_worktrees()]] +map.n.nore['gwc'] = [[:lua require('telescope').extensions.git_worktree.create_git_worktree()]] diff --git a/nvim/lua/plugins.lua b/nvim/lua/plugins.lua new file mode 100644 index 0000000..9ea568c --- /dev/null +++ b/nvim/lua/plugins.lua @@ -0,0 +1,278 @@ +local fn = vim.fn + +-- Automatically install packer +local install_path = fn.stdpath "data" .. "/site/pack/packer/start/packer.nvim" +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, + } + print "Installing packer close and reopen Neovim..." + vim.cmd [[packadd packer.nvim]] +end + +-- Autocommand that reloads neovim whenever you save the plugins.lua file +vim.cmd [[ + augroup packer_user_config + autocmd! + autocmd BufWritePost plugins.lua source | PackerSync + augroup end +]] + +-- Use a protected call so we don't error out on first use +local status_ok, packer = pcall(require, "packer") +if not status_ok then + return +end + +-- Have packer use a popup window +packer.init { + display = { + open_fn = function() + return require("packer.util").float { border = "rounded" } + end, + }, +} + +-- Install your plugins here +return packer.startup(function(use) + -- My plugins here + + -- Have packer manage itself + use "wbthomason/packer.nvim" + + use { + 'dstein64/vim-startuptime', + cmd = 'StartupTime', + config = [[vim.g.startuptime_tries = 3]] + } + + use 'lewis6991/impatient.nvim' + + use 'andweeb/presence.nvim' + + use 'Iron-E/nvim-cartographer' + + use 'Mofiqul/vscode.nvim' + + use { + 'tpope/vim-dispatch', + cmd = { + 'Dispatch', + 'Make', + 'Focus', + 'Start' + } + } + + use { + -- A collection of common configurations for Neovim's built-in language server client + 'neovim/nvim-lspconfig', + config = [[require('plugins/lspconfig')]], + } + + use { + "williamboman/nvim-lsp-installer", + config = [[require('plugins/lsp-installer')]], + } + + use 'nvim-lua/lsp_extensions.nvim' + use 'simrat39/rust-tools.nvim' + use 'folke/trouble.nvim' + use 'ray-x/lsp_signature.nvim' + use 'simrat39/symbols-outline.nvim' + use 'kosayoda/nvim-lightbulb' + + use { + -- vscode-like pictograms for neovim lsp completion items Topics + "onsails/lspkind-nvim", + config = [[require('plugins/lspkind')]] + } + + use { + -- A completion plugin for neovim coded in Lua. + 'hrsh7th/nvim-cmp', + requires = { + 'hrsh7th/cmp-nvim-lsp', -- nvim-cmp source for neovim builtin LSP client + 'hrsh7th/cmp-nvim-lua', -- nvim-cmp source for nvim lua + 'hrsh7th/cmp-buffer', -- nvim-cmp source for buffer words. + 'hrsh7th/cmp-path', -- nvim-cmp source for filesystem paths. + 'hrsh7th/cmp-calc', -- nvim-cmp source for math calculation. + 'saadparwaiz1/cmp_luasnip', -- luasnip completion source for nvim-cmp + 'hrsh7th/cmp-nvim-lsp-signature-help', -- luasnip completion source for lsp_signature + }, + config = [[require('plugins/cmp')]], + } + + use { 'nvim-telescope/telescope-dap.nvim' } + + use { + 'nvim-telescope/telescope-fzf-native.nvim', + run = 'make', + } + + + use { + "nvim-telescope/telescope-frecency.nvim", + requires = { + "tami5/sqlite.lua" + } + } + + use { + 'nvim-telescope/telescope.nvim', + requires = { + 'nvim-lua/plenary.nvim', + 'BurntSushi/ripgrep', + }, + config = [[require('plugins/telescope')]], + } + + use { + -- Snippet Engine for Neovim written in Lua. + "L3MON4D3/LuaSnip", + requires = { + "rafamadriz/friendly-snippets" -- Snippets collection + }, + config = [[require('plugins/luasnip')]] + } + + use { + -- Nvim Treesitter configurations and abstraction layer + "nvim-treesitter/nvim-treesitter", + run = ":TSUpdate", + requires = { + 'nvim-treesitter/nvim-treesitter-refactor', + 'RRethy/nvim-treesitter-textsubjects', + }, + config = [[require('plugins/treesitter')]] + } + + use { + "lukas-reineke/indent-blankline.nvim", + config = [[require('plugins/blankline')]] + } + + use { + "tpope/vim-eunuch" + } + + use { + "nvim-lualine/lualine.nvim", + requires = { + { + "kyazdani42/nvim-web-devicons", + opt = true + }, + }, + config = [[require('plugins/lualine')]] + } + + use { + 'tpope/vim-fugitive', + cmd = { + 'Git', + 'Gstatus', + 'Gblame', + 'Gpush', + 'Gpull' + }, + disable = true + } + + use { + 'lewis6991/gitsigns.nvim', + requires = { 'nvim-lua/plenary.nvim' }, + } + + use { + 'TimUntersberger/neogit', + cmd = 'Neogit', + config = [[require('neogit').setup {disable_commit_confirmation = true, disable_signs = true}]] + } + use 'kdheepak/lazygit.nvim' + + use { + "kyazdani42/nvim-tree.lua", + requires = "kyazdani42/nvim-web-devicons", + config = [[require('plugins/nvim-tree')]] + } + + use { + 'mbbill/undotree', + cmd = 'UndotreeToggle', + config = [[vim.g.undotree_SetFocusWhenToggle = 1]], + } + + use { + "folke/which-key.nvim", + config = [[require("which-key").setup({})]], + } + + use { + 'Pocco81/DAPInstall.nvim', + config = [[require("dap-install").config("chrome", {})]], + } + + use { + 'mfussenegger/nvim-dap', + config = [[require('plugins/dap')]], + module = 'dap', + } + + use { + 'puremourning/vimspector', + requires = 'nvim-dap', + after = 'nvim-dap', + setup = [[vim.g.vimspector_enable_mappings = 'HUMAN']], + } + + use { + 'rcarriga/nvim-dap-ui', + requires = 'nvim-dap', + disable = true, + after = 'nvim-dap', + config = [[require('dapui').setup()]], + } + + use { + "ThePrimeagen/git-worktree.nvim", + config = [[require('plugins/git-worktree')]] + } + + use { + 'ThePrimeagen/refactoring.nvim', + opt = true + -- Can't get to work... + -- config = [[require('telescope').load_extension('refactoring')]], + } + + use { + -- Highlight colors + 'norcalli/nvim-colorizer.lua', + ft = { + 'css', + 'javascript', + 'vim', + 'html' + }, + config = [[require('colorizer').setup {'css', 'javascript', 'vim', 'html'}]], + } + + -- Buffer management + use { + 'akinsho/nvim-bufferline.lua', + requires = 'kyazdani42/nvim-web-devicons', + config = [[require('plugins/bufferline')]], + } + + -- 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) diff --git a/nvim/lua/plugins/blankline.lua b/nvim/lua/plugins/blankline.lua new file mode 100644 index 0000000..d68ccf9 --- /dev/null +++ b/nvim/lua/plugins/blankline.lua @@ -0,0 +1,6 @@ +require("indent_blankline").setup { + -- for example, context is off by default, use this to turn it on + show_current_context = true, + show_current_context_start = true, + show_end_of_line = true +} diff --git a/nvim/lua/plugins/bufferline.lua b/nvim/lua/plugins/bufferline.lua new file mode 100644 index 0000000..bd3192d --- /dev/null +++ b/nvim/lua/plugins/bufferline.lua @@ -0,0 +1,182 @@ +local diagnostics_signs = { + ['error'] = '', + warning = '', + default = '', +} + +require('bufferline').setup{ + options = { + always_show_bufferline = false, + diagnostics = 'nvim_lsp', + diagnostics_indicator = function(count, level, diagnostics_dict, context) + local s = ' ' + for e, n in pairs(diagnostics_dict) do + local sym = diagnostics_signs[e] or diagnostics_signs.default + s = s .. (#s > 1 and ' ' or '') .. sym .. ' ' .. n + end + return s + end, + separator_style = 'slant', + indicator_icon = ' ', + buffer_close_icon = '', + modified_icon = '●', + close_icon = '', + close_command = "Bdelete %d", + right_mouse_command = "Bdelete! %d", + left_trunc_marker = '', + right_trunc_marker = '', + offsets = {{filetype = "NvimTree", text = "EXPLORER", text_align = "center"}}, + show_tab_indicators = true, + show_close_icon = false + }, + highlights = { + fill = { + guifg = {attribute = "fg", highlight = "Normal"}, + guibg = {attribute = "bg", highlight = "StatusLineNC"}, + }, + background = { + guifg = {attribute = "fg", highlight = "Normal"}, + guibg = {attribute = "bg", highlight = "StatusLine"} + }, + buffer_visible = { + gui = "", + guifg = {attribute = "fg", highlight = "Normal"}, + guibg = {attribute = "bg", highlight = "Normal"} + }, + buffer_selected = { + gui = "", + guifg = {attribute = "fg", highlight = "Normal"}, + guibg = {attribute = "bg", highlight = "Normal"} + }, + separator = { + guifg = {attribute = "bg", highlight = "Normal"}, + guibg = {attribute = "bg", highlight = "StatusLine"}, + }, + separator_selected = { + guifg = {attribute = "fg", highlight = "Special"}, + guibg = {attribute = "bg", highlight = "Normal"} + }, + separator_visible = { + guifg = {attribute = "fg", highlight = "Normal"}, + guibg = {attribute = "bg", highlight = "StatusLineNC"}, + }, + close_button = { + guifg = {attribute = "fg", highlight = "Normal"}, + guibg = {attribute = "bg", highlight = "StatusLine"} + }, + close_button_selected = { + guifg = {attribute = "fg", highlight = "normal"}, + guibg = {attribute = "bg", highlight = "normal"} + }, + close_button_visible = { + guifg = {attribute = "fg", highlight = "normal"}, + guibg = {attribute = "bg", highlight = "normal"} + }, + + } +} + +-- local map = require('utils').map +-- local bufferline = require 'bufferline' + +-- local bar_bg = '#1f1f1f' +-- local bar_fg = '#c9c9c9' +-- local elem_bg = '#2d2d2d' +-- local elem_fg = '#8c8c8c' +-- local selected_bg = '#444444' +-- local selected_fg = '#efefef' +-- local error_fg = '#ca241a' +-- local warning_fg = '#fabd2f' +-- local info_fg = '#83a5cb' +-- local pick_fg = '#870000' + +-- local colors = { +-- bar = { guifg = bar_fg, guibg = bar_bg }, +-- elem = { guifg = elem_fg, guibg = elem_bg }, +-- elem_inactive = { guifg = elem_fg, guibg = elem_bg }, +-- elem_selected = { guifg = selected_fg, guibg = selected_bg }, +-- separator = { guifg = bar_bg, guibg = elem_bg }, +-- separator_selected = { guifg = bar_bg, guibg = selected_bg }, +-- error = { guifg = error_fg, guibg = elem_bg, guisp = error_fg }, +-- error_selected = { guifg = error_fg, guibg = selected_bg, gui = '' }, +-- warning = { guifg = warning_fg, guibg = elem_bg, guisp = warning_fg }, +-- warning_selected = { guifg = warning_fg, guibg = selected_bg, gui = '' }, +-- info = { guifg = info_fg, guibg = elem_bg, guisp = info_fg }, +-- info_selected = { guifg = info_fg, guibg = selected_bg, gui = '' }, +-- pick = { guifg = pick_fg, guibg = elem_bg }, +-- pick_selected = { guifg = pick_fg, guibg = selected_bg }, +-- } + +-- local diagnostics_signs = { +-- ['error'] = '', +-- warning = '', +-- default = '', +-- } + +-- require('bufferline').setup{ +-- options = { +-- always_show_bufferline = false, +-- diagnostics = 'nvim_lsp', +-- diagnostics_indicator = function(count, level, diagnostics_dict, context) +-- local s = ' ' +-- for e, n in pairs(diagnostics_dict) do +-- local sym = diagnostics_signs[e] or diagnostics_signs.default +-- s = s .. (#s > 1 and ' ' or '') .. sym .. ' ' .. n +-- end +-- return s +-- end, +-- separator_style = 'slant', +-- }, +-- highlights = { +-- background = colors.elem_inactive, +-- buffer_selected = colors.elem_selected, +-- buffer_visible = colors.elem_inactive, +-- close_button = colors.elem, +-- close_button_selected = colors.elem_selected, +-- close_button_visible = colors.elem, +-- diagnostic = colors.info, +-- diagnostic_selected = colors.info_selected, +-- diagnostic_visible = colors.info, +-- duplicate = colors.elem, +-- duplicate_selected = colors.elem_selected, +-- duplicate_visible = colors.elem, +-- error = colors.error, +-- error_diagnostic = colors.error, +-- error_diagnostic_selected = colors.error_selected, +-- error_selected = colors.error_selected, +-- fill = colors.bar, +-- hint = colors.info, +-- hint_diagnostic = colors.info, +-- hint_diagnostic_selected = colors.info_selected, +-- hint_diagnostic_visible = colors.info, +-- hint_selected = colors.info_selected, +-- hint_visible = colors.info, +-- info = colors.info, +-- info_diagnostic = colors.info, +-- info_diagnostic_selected = colors.info_selected, +-- info_diagnostic_visible = colors.info, +-- info_selected = colors.info_selected, +-- info_visible = colors.info, +-- modified = colors.elem, +-- modified_selected = colors.elem_selected, +-- modified_visible = colors.elem, +-- pick = colors.pick, +-- pick_selected = colors.pick_selected, +-- separator = colors.separator, +-- separator_selected = colors.separator_selected, +-- separator_visible = colors.separator, +-- tab = colors.elem, +-- tab_close = colors.bar, +-- tab_selected = colors.elem_selected, +-- warning = colors.warning, +-- warning_diagnostic = colors.warning, +-- warning_diagnostic_selected = colors.warning_selected, +-- warning_diagnostic_visible = colors.warning, +-- warning_selected = colors.warning_selected, +-- warning_visible = colors.warning, +-- }, +-- } + +-- local opts = { silent = true, nowait = true } +-- map('n', 'gb', 'BufferLinePick', opts) +-- map('n', 'd', 'bdelete!', opts) diff --git a/nvim/lua/plugins/cmp.lua b/nvim/lua/plugins/cmp.lua new file mode 100644 index 0000000..2729b0e --- /dev/null +++ b/nvim/lua/plugins/cmp.lua @@ -0,0 +1,138 @@ +-- Set completeopt to have a better completion experience +vim.o.completeopt = 'menuone,noselect' +local cmp = require 'cmp' + +cmp.setup({ + completion = { + -- completeopt = 'menu,menuone,noinsert', + }, + snippet = { + expand = function(args) require('luasnip').lsp_expand(args.body) end + }, + formatting = { + format = function(entry, vim_item) + -- fancy icons and a name of kind + vim_item.kind = require("lspkind").presets.default[vim_item.kind] + -- set a name for each source + vim_item.menu = ({ + buffer = "[Buff]", + nvim_lsp = "[LSP]", + luasnip = "[LuaSnip]", + nvim_lua = "[Lua]", + latex_symbols = "[Latex]" + })[entry.source.name] + return vim_item + end + }, + sources = { + {name = 'nvim_lsp'}, + {name = 'nvim_lua'}, + {name = 'path'}, + {name = 'luasnip'}, + {name = 'buffer', keyword_length = 1}, + {name = 'calc'} + }, + experimental = { + -- ghost_text = true, + } + +}) + +-- Require function for tab to work with LUA-SNIP +local has_words_before = function() + local line, col = unpack(vim.api.nvim_win_get_cursor(0)) + return col ~= 0 and + vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, + col) + :match("%s") == nil +end + +cmp.setup({ + mapping = { + [''] = cmp.mapping.complete(), + [''] = cmp.mapping.close(), + [''] = cmp.mapping.scroll_docs(-4), + [''] = cmp.mapping.scroll_docs(4), + [''] = cmp.mapping.confirm({ + behavior = cmp.ConfirmBehavior.Replace, + select = false + }), + + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_next_item() + elseif luasnip.expand_or_jumpable() then + luasnip.expand_or_jump() + elseif has_words_before() then + cmp.complete() + else + fallback() + end + end, {"i", "s"}), + + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_prev_item() + elseif luasnip.jumpable(-1) then + luasnip.jump(-1) + else + fallback() + end + end, {"i", "s"}) + + } +}) + +-- local luasnip = require("luasnip") + +-- local source_mapping = { +-- nvim_lsp = "[LSP]", +-- nvim_lua = "[Lua]", +-- path = "[Path]", +-- buffer = "[Buffer]", +-- luasnip = "[LuaSnip]", +-- nvim_lsp_signature_help = "[LspSignatureHelp]", +-- calc = "[Calc]", +-- } + +-- cmp.setup({ +-- snippet = { +-- expand = function(args) require('luasnip').lsp_expand(args.body) end +-- }, + +-- mapping = { +-- [''] = cmp.mapping.select_prev_item(), +-- [''] = cmp.mapping.select_next_item(), +-- -- Add tab support +-- [''] = cmp.mapping.select_prev_item(), +-- [''] = cmp.mapping.select_next_item(), +-- [''] = cmp.mapping.scroll_docs(-4), +-- [''] = cmp.mapping.scroll_docs(4), +-- [''] = cmp.mapping.complete(), +-- [''] = cmp.mapping.close(), +-- [''] = cmp.mapping.confirm({ +-- behavior = cmp.ConfirmBehavior.Replace, +-- select = true, +-- }) +-- }, + +-- formatting = { +-- format = function(entry, vim_item) +-- vim_item.kind = require("lspkind").presets.default[vim_item.kind] +-- local menu = source_mapping[entry.source.name] +-- vim_item.menu = menu +-- return vim_item +-- end, +-- }, +-- -- Installed sources +-- sources = { +-- -- { name = 'path' }, +-- { name = "nvim_lsp" }, +-- { name = "nvim_lua" }, +-- { name = 'path' }, +-- { name = "luasnip" }, +-- { name = "buffer", keyword_length = 1 }, +-- { name = 'nvim_lsp_signature_help' }, +-- { name = 'calc' }, +-- }, +-- }) \ No newline at end of file diff --git a/nvim/lua/plugins/dap.lua b/nvim/lua/plugins/dap.lua new file mode 100644 index 0000000..065cead --- /dev/null +++ b/nvim/lua/plugins/dap.lua @@ -0,0 +1,95 @@ + +local dap = require("dap"); + +dap.configurations.typescriptreact = { -- change to typescript if needed + { + type = "chrome", + request = "attach", + program = "${file}", + cwd = vim.fn.getcwd(), + sourceMaps = true, + protocol = "inspector", + port = 9222, + webRoot = "${workspaceFolder}" + } +} + +require('dap.ext.vscode').load_launchjs() + +-- Debugpy +dap.adapters.python = { + type = 'executable', + command = 'python', + args = { '-m', 'debugpy.adapter' }, +} + +dap.configurations.python = { + { + type = 'python', + request = 'launch', + name = 'Launch file', + program = '${file}', + pythonPath = function() + local venv_path = vim.fn.getenv 'VIRTUAL_ENVIRONMENT' + if venv_path ~= vim.NIL and venv_path ~= '' then + return venv_path .. '/bin/python' + else + return '/usr/bin/python' + end + end, + }, +} + +-- Neovim Lua +dap.adapters.nlua = function(callback, config) + callback { type = 'server', host = config.host, port = config.port } +end + +dap.configurations.lua = { + { + type = 'nlua', + request = 'attach', + name = 'Attach to running Neovim instance', + host = function() + local value = vim.fn.input 'Host [127.0.0.1]: ' + if value ~= '' then + return value + end + return '127.0.0.1' + end, + port = function() + local val = tonumber(vim.fn.input 'Port: ') + assert(val, 'Please provide a port number') + return val + end, + }, +} + +-- lldb +dap.adapters.lldb = { + type = 'executable', + command = '/usr/bin/lldb-vscode', + name = 'lldb', +} + +dap.configurations.cpp = { + { + name = 'Launch', + type = 'lldb', + request = 'launch', + program = function() + return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file') + end, + cwd = '${workspaceFolder}', + stopOnEntry = false, + args = {}, + runInTerminal = false, + }, +} + +dap.configurations.c = dap.configurations.cpp +dap.configurations.rust = dap.configurations.cpp + +vim.cmd [[command! BreakpointToggle lua require('dap').toggle_breakpoint()]] +vim.cmd [[command! Debug lua require('dap').continue()]] +vim.cmd [[command! DapREPL lua require('dap').repl.open()]] diff --git a/nvim/lua/plugins/git-worktree.lua b/nvim/lua/plugins/git-worktree.lua new file mode 100644 index 0000000..d34e41c --- /dev/null +++ b/nvim/lua/plugins/git-worktree.lua @@ -0,0 +1,4 @@ +require("git-worktree").setup({ +}) + +require("telescope").load_extension("git_worktree") \ No newline at end of file diff --git a/nvim/lua/plugins/lsp-installer.lua b/nvim/lua/plugins/lsp-installer.lua new file mode 100644 index 0000000..da61bbc --- /dev/null +++ b/nvim/lua/plugins/lsp-installer.lua @@ -0,0 +1,121 @@ +local lsp_installer = require("nvim-lsp-installer") + +-- Provide settings first! +lsp_installer.settings { + ui = { + icons = { + server_installed = "✓", + server_pending = "➜", + server_uninstalled = "✗" + } + }, + + -- Limit for the maximum amount of servers to be installed at the same time. Once this limit is reached, any further + -- servers that are requested to be installed will be put in a queue. + max_concurrent_installers = 4 +} + +--------------------------------------------------- +local enhance_server_opts = { + ["eslintls"] = function(opts) + opts.settings = { + format = { + enable = true, + }, + } + end, + ["gopls"] = function(opts) + opts.cmd = { + "gopls", + "serve", + } + opts.settings = { + gopls = { + staticcheck = true, + analyses = { + unusedparams = true, + }, + }, + } + end +} + + +local function make_server_ready(attach) + lsp_installer.on_server_ready(function(server) + -- Specify the default options which we'll use to setup all servers + local opts = { + on_attach = on_attach, + } + if server.name == "rust_analyzer" then + local rustopts = { + tools = { + autoSetHints = true, + hover_with_actions = false, + inlay_hints = { + show_parameter_hints = true, + parameter_hints_prefix = "", + other_hints_prefix = "", + }, + }, + server = vim.tbl_deep_extend("force", server:get_default_options(), opts, { + settings = { + ["rust-analyzer"] = { + completion = { + postfix = { + enable = false + } + }, + checkOnSave = { + command = "clippy" + }, + } + } + }), + } + require("rust-tools").setup(rustopts) + server:attach_buffers() + else + if enhance_server_opts[server.name] then + -- Enhance the default opts with the server-specific ones + enhance_server_opts[server.name](opts) + end + -- This setup() function is exactly the same as lspconfig's setup function (:help lspconfig-quickstart) + server:setup(opts) + end + + vim.cmd [[ do User LspAttachBuffers ]] + end) +end +--------------------------------------------------- + +--------------------------------------------------- +local servers = { + "rust_analyzer", + "tsserver", -- for javascript + "jsonls", -- for json + "texlab", -- for latex + "ltex", + "sqlls", -- for sql + "pylsp", -- for python + "sumneko_lua", -- for lua + "gopls", -- for go + "yamlls", + "bashls", + "dockerls" +} + +-- setup the LS +require "plugins.lspconfig" +make_server_ready(On_attach) -- LSP mappings + +-- install the LS +for _, name in pairs(servers) do + local server_is_found, server = lsp_installer.get_server(name) + if server_is_found then + if not server:is_installed() then + print("Installing " .. name) + server:install() + end + end +end \ No newline at end of file diff --git a/nvim/lua/plugins/lspconfig.lua b/nvim/lua/plugins/lspconfig.lua new file mode 100644 index 0000000..c10e1dc --- /dev/null +++ b/nvim/lua/plugins/lspconfig.lua @@ -0,0 +1,97 @@ +local capabilities = vim.lsp.protocol.make_client_capabilities() +capabilities.textDocument.completion.completionItem.snippetSupport = true + +vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with( + vim.lsp.diagnostic.on_publish_diagnostics, { + underline = true, + signs = true, + update_in_insert = true, + virtual_text = { + true, + spacing = 6, + --severity_limit='Error' -- Only show virtual text on error + }, + } +) + +local function config(_config) + return vim.tbl_deep_extend("force", { + capabilities = require("cmp_nvim_lsp").update_capabilities(vim.lsp.protocol.make_client_capabilities()), + on_attach = function() + Nnoremap("gd", ":lua vim.lsp.buf.definition()") + Nnoremap("K", ":lua vim.lsp.buf.hover()") + Nnoremap("vws", ":lua vim.lsp.buf.workspace_symbol()") + Nnoremap("vd", ":lua vim.diagnostic.open_float()") + Nnoremap("[d", ":lua vim.lsp.diagnostic.goto_next()") + Nnoremap("]d", ":lua vim.lsp.diagnostic.goto_prev()") + Nnoremap("vca", ":lua vim.lsp.buf.code_action()") + Nnoremap("vrr", ":lua vim.lsp.buf.references()") + Nnoremap("vrn", ":lua vim.lsp.buf.rename()") + Inoremap("", "lua vim.lsp.buf.signature_help()") + end, + }, _config or {}) +end + +require("lspconfig").tsserver.setup(config()) + +require("lspconfig").ccls.setup(config()) + +require("lspconfig").jedi_language_server.setup(config()) + +require("lspconfig").svelte.setup(config()) + +require("lspconfig").solang.setup(config()) + +require("lspconfig").cssls.setup(config()) + +require("lspconfig").gopls.setup(config({ + cmd = { "gopls", "serve" }, + settings = { + gopls = { + analyses = { + unusedparams = true, + }, + staticcheck = true, + }, + }, +})) + +local rustopts = { + tools = { + autoSetHints = true, + hover_with_actions = true, + runnables = { + use_telescope = true + }, + inlay_hints = { + show_parameter_hints = false, + parameter_hints_prefix = "", + other_hints_prefix = "", + }, + }, + server = { + settings = { + ["rust-analyzer"] = { + checkOnSave = { + command = "clippy" + }, + } + } + }, +} + +require("rust-tools").setup(rustopts) + +local opts = { + -- whether to highlight the currently hovered symbol + -- disable if your cpu usage is higher than you want it + -- or you just hate the highlight + -- default: true + highlight_hovered_item = true, + + -- whether to show outline guides + -- default: true + show_guides = true, +} + +require("symbols-outline").setup(opts) diff --git a/nvim/lua/plugins/lspkind.lua b/nvim/lua/plugins/lspkind.lua new file mode 100644 index 0000000..d2b437a --- /dev/null +++ b/nvim/lua/plugins/lspkind.lua @@ -0,0 +1,29 @@ +require('lspkind').init({ + -- enables text annotations (default: 'default') + -- default symbol map can be either 'default' or 'codicons' for codicon preset (requires vscode-codicons font installed) + preset = 'codicons', + + -- override preset symbols (default: {}) + symbol_map = { + Text = '', + Method = 'ƒ', + Function = '', + Constructor = '', + Variable = '', + Class = '', + Interface = 'ﰮ', + Module = '', + Property = '', + Unit = '', + Value = '', + Enum = '了', + Keyword = '', + Snippet = '﬌', + Color = '', + File = '', + Folder = '', + EnumMember = '', + Constant = '', + Struct = '' + }, +}) \ No newline at end of file diff --git a/nvim/lua/plugins/lspstatus.lua b/nvim/lua/plugins/lspstatus.lua new file mode 100644 index 0000000..ce34ab7 --- /dev/null +++ b/nvim/lua/plugins/lspstatus.lua @@ -0,0 +1,12 @@ +require('lsp-status').status() +require('lsp-status').register_progress() +require('lsp-status').config({ + indicator_errors = '✗', + indicator_warnings = '⚠', + indicator_info = '', + indicator_hint = '', + indicator_ok = '✔', + current_function = true, + update_interval = 100, + status_symbol = ' 🇻', +}) \ No newline at end of file diff --git a/nvim/lua/plugins/lualine.lua b/nvim/lua/plugins/lualine.lua new file mode 100644 index 0000000..825ae08 --- /dev/null +++ b/nvim/lua/plugins/lualine.lua @@ -0,0 +1,5 @@ +require('lualine').setup { + options = { + theme = 'vscode' + } +} diff --git a/nvim/lua/plugins/luasnip.lua b/nvim/lua/plugins/luasnip.lua new file mode 100644 index 0000000..50c5457 --- /dev/null +++ b/nvim/lua/plugins/luasnip.lua @@ -0,0 +1,13 @@ +require("luasnip").config.set_config({ + history = true, + updateevents = "TextChanged,TextChangedI" +}) + +require("luasnip").snippets = {all = {}, html = {}} + +require("luasnip").snippets.javascript = require("luasnip").snippets.html +require("luasnip").snippets.javascriptreact = require("luasnip").snippets.html +require("luasnip").snippets.typescriptreact = require("luasnip").snippets.html +require("luasnip/loaders/from_vscode").load({include = {"html"}}) + +require('luasnip/loaders/from_vscode').lazy_load() \ No newline at end of file diff --git a/nvim/lua/plugins/neogit.lua b/nvim/lua/plugins/neogit.lua new file mode 100644 index 0000000..5d2e47b --- /dev/null +++ b/nvim/lua/plugins/neogit.lua @@ -0,0 +1 @@ +require('neogit').setup {} \ No newline at end of file diff --git a/nvim/lua/plugins/null-ls.lua b/nvim/lua/plugins/null-ls.lua new file mode 100644 index 0000000..44ee62c --- /dev/null +++ b/nvim/lua/plugins/null-ls.lua @@ -0,0 +1,12 @@ +local null_ls = require("null-ls") + +local formatting = null_ls.builtins.formatting + +null_ls.setup({ + sources = { + formatting.prettier, + formatting.black, + formatting.stylua, + formatting.rustfmt, + }, +}) \ No newline at end of file diff --git a/nvim/lua/plugins/nvim-tree.lua b/nvim/lua/plugins/nvim-tree.lua new file mode 100644 index 0000000..c2499d8 --- /dev/null +++ b/nvim/lua/plugins/nvim-tree.lua @@ -0,0 +1,7 @@ +require("nvim-tree").setup { + git = { + enable = true, + ignore = false, + timeout = 500 + } +} \ No newline at end of file diff --git a/nvim/lua/plugins/telescope.lua b/nvim/lua/plugins/telescope.lua new file mode 100644 index 0000000..d26a4c7 --- /dev/null +++ b/nvim/lua/plugins/telescope.lua @@ -0,0 +1,51 @@ +require('telescope').setup { + defaults = { + file_ignore_patterns = {"node_modules", ".git", "dist"}, + vimgrep_arguments = { + "rg", + "--color=never", + "--no-heading", + "--with-filename", + "--line-number", + "--column", + "--hidden", + "--iglob", + "!yarn.lock", + "--smart-case", + "-u" + }, + layout_strategy = 'flex', + scroll_strategy = 'cycle', + }, + extensions = { + project = { + base_dirs = { + {path = "~/src", max_depth = 1} + }, + hidden_files = true + }, + fzf = { + fuzzy = true, + override_generic_sorter = true, + override_file_sorter = true, + case_mode = 'smart_case', + }, + }, + pickers = { + find_files = { + find_command = {"rg", "--files", "--hidden"} + }, + lsp_references = { theme = 'dropdown' }, + lsp_code_actions = { theme = 'dropdown' }, + lsp_definitions = { theme = 'dropdown' }, + lsp_implementations = { theme = 'dropdown' }, + buffers = { + sort_lastused = true, + }, + }, +} + +-- Extensions +require('telescope').load_extension('frecency') +require('telescope').load_extension('fzf') +require('telescope').load_extension('dap') diff --git a/nvim/lua/plugins/treesitter.lua b/nvim/lua/plugins/treesitter.lua new file mode 100644 index 0000000..826693a --- /dev/null +++ b/nvim/lua/plugins/treesitter.lua @@ -0,0 +1,9 @@ +require("nvim-treesitter.configs").setup { + indent = { + enable = true + }, + highlight = { + enable = true, + additional_vim_regex_highlighting = false + } +} \ No newline at end of file diff --git a/nvim/lua/utils.lua b/nvim/lua/utils.lua new file mode 100644 index 0000000..14c6e62 --- /dev/null +++ b/nvim/lua/utils.lua @@ -0,0 +1,9 @@ +local M = {} + +function M.map(mode, lhs, rhs, opts) + local options = {noremap = true} + if opts then options = vim.tbl_extend("force", options, opts) end + vim.api.nvim_set_keymap(mode, lhs, rhs, options) +end + +return M \ No newline at end of file diff --git a/nvim/plugin/packer_compiled.lua b/nvim/plugin/packer_compiled.lua new file mode 100644 index 0000000..30508be --- /dev/null +++ b/nvim/plugin/packer_compiled.lua @@ -0,0 +1,494 @@ +-- Automatically generated packer.nvim plugin loader code + +if vim.api.nvim_call_function('has', {'nvim-0.5'}) ~= 1 then + vim.api.nvim_command('echohl WarningMsg | echom "Invalid Neovim version for packer.nvim! | echohl None"') + return +end + +vim.api.nvim_command('packadd packer.nvim') + +local no_errors, error_msg = pcall(function() + + local time + local profile_info + local should_profile = false + if should_profile then + local hrtime = vim.loop.hrtime + profile_info = {} + time = function(chunk, start) + if start then + profile_info[chunk] = hrtime() + else + profile_info[chunk] = (hrtime() - profile_info[chunk]) / 1e6 + end + end + else + time = function(chunk, start) end + end + +local function save_profiles(threshold) + local sorted_times = {} + for chunk_name, time_taken in pairs(profile_info) do + sorted_times[#sorted_times + 1] = {chunk_name, time_taken} + end + table.sort(sorted_times, function(a, b) return a[2] > b[2] end) + local results = {} + for i, elem in ipairs(sorted_times) do + if not threshold or threshold and elem[2] > threshold then + results[i] = elem[1] .. ' took ' .. elem[2] .. 'ms' + end + end + + _G._packer = _G._packer or {} + _G._packer.profile_output = results +end + +time([[Luarocks path setup]], true) +local package_path_str = "/home/tobyv/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/?.lua;/home/tobyv/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/?/init.lua;/home/tobyv/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/?.lua;/home/tobyv/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/?/init.lua" +local install_cpath_pattern = "/home/tobyv/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/lua/5.1/?.so" +if not string.find(package.path, package_path_str, 1, true) then + package.path = package.path .. ';' .. package_path_str +end + +if not string.find(package.cpath, install_cpath_pattern, 1, true) then + package.cpath = package.cpath .. ';' .. install_cpath_pattern +end + +time([[Luarocks path setup]], false) +time([[try_loadstring definition]], true) +local function try_loadstring(s, component, name) + local success, result = pcall(loadstring(s), name, _G.packer_plugins[name]) + if not success then + vim.schedule(function() + vim.api.nvim_notify('packer.nvim: Error running ' .. component .. ' for ' .. name .. ': ' .. result, vim.log.levels.ERROR, {}) + end) + end + return result +end + +time([[try_loadstring definition]], false) +time([[Defining packer_plugins]], true) +_G.packer_plugins = { + ["DAPInstall.nvim"] = { + config = { 'require("dap-install").config("chrome", {})' }, + loaded = true, + path = "/home/tobyv/.local/share/nvim/site/pack/packer/start/DAPInstall.nvim", + url = "https://github.com/Pocco81/DAPInstall.nvim" + }, + LuaSnip = { + config = { "require('plugins/luasnip')" }, + loaded = true, + path = "/home/tobyv/.local/share/nvim/site/pack/packer/start/LuaSnip", + url = "https://github.com/L3MON4D3/LuaSnip" + }, + ["cmp-buffer"] = { + loaded = true, + path = "/home/tobyv/.local/share/nvim/site/pack/packer/start/cmp-buffer", + url = "https://github.com/hrsh7th/cmp-buffer" + }, + ["cmp-calc"] = { + loaded = true, + path = "/home/tobyv/.local/share/nvim/site/pack/packer/start/cmp-calc", + url = "https://github.com/hrsh7th/cmp-calc" + }, + ["cmp-nvim-lsp"] = { + loaded = true, + path = "/home/tobyv/.local/share/nvim/site/pack/packer/start/cmp-nvim-lsp", + url = "https://github.com/hrsh7th/cmp-nvim-lsp" + }, + ["cmp-nvim-lsp-signature-help"] = { + loaded = true, + path = "/home/tobyv/.local/share/nvim/site/pack/packer/start/cmp-nvim-lsp-signature-help", + url = "https://github.com/hrsh7th/cmp-nvim-lsp-signature-help" + }, + ["cmp-nvim-lua"] = { + loaded = true, + path = "/home/tobyv/.local/share/nvim/site/pack/packer/start/cmp-nvim-lua", + url = "https://github.com/hrsh7th/cmp-nvim-lua" + }, + ["cmp-path"] = { + loaded = true, + path = "/home/tobyv/.local/share/nvim/site/pack/packer/start/cmp-path", + url = "https://github.com/hrsh7th/cmp-path" + }, + cmp_luasnip = { + loaded = true, + path = "/home/tobyv/.local/share/nvim/site/pack/packer/start/cmp_luasnip", + url = "https://github.com/saadparwaiz1/cmp_luasnip" + }, + ["friendly-snippets"] = { + loaded = true, + path = "/home/tobyv/.local/share/nvim/site/pack/packer/start/friendly-snippets", + url = "https://github.com/rafamadriz/friendly-snippets" + }, + ["git-worktree.nvim"] = { + config = { "require('plugins/git-worktree')" }, + loaded = true, + path = "/home/tobyv/.local/share/nvim/site/pack/packer/start/git-worktree.nvim", + url = "https://github.com/ThePrimeagen/git-worktree.nvim" + }, + ["gitsigns.nvim"] = { + loaded = true, + path = "/home/tobyv/.local/share/nvim/site/pack/packer/start/gitsigns.nvim", + url = "https://github.com/lewis6991/gitsigns.nvim" + }, + ["impatient.nvim"] = { + loaded = true, + path = "/home/tobyv/.local/share/nvim/site/pack/packer/start/impatient.nvim", + url = "https://github.com/lewis6991/impatient.nvim" + }, + ["indent-blankline.nvim"] = { + config = { "require('plugins/blankline')" }, + loaded = true, + path = "/home/tobyv/.local/share/nvim/site/pack/packer/start/indent-blankline.nvim", + url = "https://github.com/lukas-reineke/indent-blankline.nvim" + }, + ["lsp_extensions.nvim"] = { + loaded = true, + path = "/home/tobyv/.local/share/nvim/site/pack/packer/start/lsp_extensions.nvim", + url = "https://github.com/nvim-lua/lsp_extensions.nvim" + }, + ["lsp_signature.nvim"] = { + loaded = true, + path = "/home/tobyv/.local/share/nvim/site/pack/packer/start/lsp_signature.nvim", + url = "https://github.com/ray-x/lsp_signature.nvim" + }, + ["lspkind-nvim"] = { + config = { "require('plugins/lspkind')" }, + loaded = true, + path = "/home/tobyv/.local/share/nvim/site/pack/packer/start/lspkind-nvim", + url = "https://github.com/onsails/lspkind-nvim" + }, + ["lualine.nvim"] = { + config = { "require('plugins/lualine')" }, + loaded = true, + path = "/home/tobyv/.local/share/nvim/site/pack/packer/start/lualine.nvim", + url = "https://github.com/nvim-lualine/lualine.nvim" + }, + neogit = { + commands = { "Neogit" }, + config = { "require('neogit').setup {disable_commit_confirmation = true, disable_signs = true}" }, + loaded = false, + needs_bufread = true, + only_cond = false, + path = "/home/tobyv/.local/share/nvim/site/pack/packer/opt/neogit", + url = "https://github.com/TimUntersberger/neogit" + }, + ["nvim-bufferline.lua"] = { + config = { "require('plugins/bufferline')" }, + loaded = true, + path = "/home/tobyv/.local/share/nvim/site/pack/packer/start/nvim-bufferline.lua", + url = "https://github.com/akinsho/nvim-bufferline.lua" + }, + ["nvim-cartographer"] = { + loaded = true, + path = "/home/tobyv/.local/share/nvim/site/pack/packer/start/nvim-cartographer", + url = "https://github.com/Iron-E/nvim-cartographer" + }, + ["nvim-cmp"] = { + config = { "require('plugins/cmp')" }, + loaded = true, + path = "/home/tobyv/.local/share/nvim/site/pack/packer/start/nvim-cmp", + url = "https://github.com/hrsh7th/nvim-cmp" + }, + ["nvim-colorizer.lua"] = { + config = { "require('colorizer').setup {'css', 'javascript', 'vim', 'html'}" }, + loaded = false, + needs_bufread = false, + only_cond = false, + path = "/home/tobyv/.local/share/nvim/site/pack/packer/opt/nvim-colorizer.lua", + url = "https://github.com/norcalli/nvim-colorizer.lua" + }, + ["nvim-dap"] = { + after = { "vimspector" }, + config = { "require('plugins/dap')" }, + loaded = false, + needs_bufread = false, + only_cond = false, + path = "/home/tobyv/.local/share/nvim/site/pack/packer/opt/nvim-dap", + url = "https://github.com/mfussenegger/nvim-dap" + }, + ["nvim-lightbulb"] = { + loaded = true, + path = "/home/tobyv/.local/share/nvim/site/pack/packer/start/nvim-lightbulb", + url = "https://github.com/kosayoda/nvim-lightbulb" + }, + ["nvim-lsp-installer"] = { + config = { "require('plugins/lsp-installer')" }, + loaded = true, + path = "/home/tobyv/.local/share/nvim/site/pack/packer/start/nvim-lsp-installer", + url = "https://github.com/williamboman/nvim-lsp-installer" + }, + ["nvim-lspconfig"] = { + config = { "require('plugins/lspconfig')" }, + loaded = true, + path = "/home/tobyv/.local/share/nvim/site/pack/packer/start/nvim-lspconfig", + url = "https://github.com/neovim/nvim-lspconfig" + }, + ["nvim-tree.lua"] = { + config = { "require('plugins/nvim-tree')" }, + loaded = true, + path = "/home/tobyv/.local/share/nvim/site/pack/packer/start/nvim-tree.lua", + url = "https://github.com/kyazdani42/nvim-tree.lua" + }, + ["nvim-treesitter"] = { + config = { "require('plugins/treesitter')" }, + loaded = true, + path = "/home/tobyv/.local/share/nvim/site/pack/packer/start/nvim-treesitter", + url = "https://github.com/nvim-treesitter/nvim-treesitter" + }, + ["nvim-treesitter-refactor"] = { + loaded = true, + path = "/home/tobyv/.local/share/nvim/site/pack/packer/start/nvim-treesitter-refactor", + url = "https://github.com/nvim-treesitter/nvim-treesitter-refactor" + }, + ["nvim-treesitter-textsubjects"] = { + loaded = true, + path = "/home/tobyv/.local/share/nvim/site/pack/packer/start/nvim-treesitter-textsubjects", + url = "https://github.com/RRethy/nvim-treesitter-textsubjects" + }, + ["nvim-web-devicons"] = { + loaded = false, + needs_bufread = false, + path = "/home/tobyv/.local/share/nvim/site/pack/packer/opt/nvim-web-devicons", + url = "https://github.com/kyazdani42/nvim-web-devicons" + }, + ["packer.nvim"] = { + loaded = true, + path = "/home/tobyv/.local/share/nvim/site/pack/packer/start/packer.nvim", + url = "https://github.com/wbthomason/packer.nvim" + }, + ["plenary.nvim"] = { + loaded = true, + path = "/home/tobyv/.local/share/nvim/site/pack/packer/start/plenary.nvim", + url = "https://github.com/nvim-lua/plenary.nvim" + }, + ["presence.nvim"] = { + loaded = true, + path = "/home/tobyv/.local/share/nvim/site/pack/packer/start/presence.nvim", + url = "https://github.com/andweeb/presence.nvim" + }, + ["refactoring.nvim"] = { + loaded = false, + needs_bufread = false, + path = "/home/tobyv/.local/share/nvim/site/pack/packer/opt/refactoring.nvim", + url = "https://github.com/ThePrimeagen/refactoring.nvim" + }, + ripgrep = { + loaded = true, + path = "/home/tobyv/.local/share/nvim/site/pack/packer/start/ripgrep", + url = "https://github.com/BurntSushi/ripgrep" + }, + ["rust-tools.nvim"] = { + loaded = true, + path = "/home/tobyv/.local/share/nvim/site/pack/packer/start/rust-tools.nvim", + url = "https://github.com/simrat39/rust-tools.nvim" + }, + ["sqlite.lua"] = { + loaded = true, + path = "/home/tobyv/.local/share/nvim/site/pack/packer/start/sqlite.lua", + url = "https://github.com/tami5/sqlite.lua" + }, + ["symbols-outline.nvim"] = { + loaded = true, + path = "/home/tobyv/.local/share/nvim/site/pack/packer/start/symbols-outline.nvim", + url = "https://github.com/simrat39/symbols-outline.nvim" + }, + ["telescope-dap.nvim"] = { + loaded = true, + path = "/home/tobyv/.local/share/nvim/site/pack/packer/start/telescope-dap.nvim", + url = "https://github.com/nvim-telescope/telescope-dap.nvim" + }, + ["telescope-frecency.nvim"] = { + loaded = true, + path = "/home/tobyv/.local/share/nvim/site/pack/packer/start/telescope-frecency.nvim", + url = "https://github.com/nvim-telescope/telescope-frecency.nvim" + }, + ["telescope-fzf-native.nvim"] = { + loaded = true, + path = "/home/tobyv/.local/share/nvim/site/pack/packer/start/telescope-fzf-native.nvim", + url = "https://github.com/nvim-telescope/telescope-fzf-native.nvim" + }, + ["telescope.nvim"] = { + config = { "require('plugins/telescope')" }, + loaded = true, + path = "/home/tobyv/.local/share/nvim/site/pack/packer/start/telescope.nvim", + url = "https://github.com/nvim-telescope/telescope.nvim" + }, + ["trouble.nvim"] = { + loaded = true, + path = "/home/tobyv/.local/share/nvim/site/pack/packer/start/trouble.nvim", + url = "https://github.com/folke/trouble.nvim" + }, + undotree = { + commands = { "UndotreeToggle" }, + config = { "vim.g.undotree_SetFocusWhenToggle = 1" }, + loaded = false, + needs_bufread = false, + only_cond = false, + path = "/home/tobyv/.local/share/nvim/site/pack/packer/opt/undotree", + url = "https://github.com/mbbill/undotree" + }, + ["vim-dispatch"] = { + commands = { "Dispatch", "Make", "Focus", "Start" }, + loaded = false, + needs_bufread = false, + only_cond = false, + path = "/home/tobyv/.local/share/nvim/site/pack/packer/opt/vim-dispatch", + url = "https://github.com/tpope/vim-dispatch" + }, + ["vim-eunuch"] = { + loaded = true, + path = "/home/tobyv/.local/share/nvim/site/pack/packer/start/vim-eunuch", + url = "https://github.com/tpope/vim-eunuch" + }, + ["vim-startuptime"] = { + commands = { "StartupTime" }, + config = { "vim.g.startuptime_tries = 3" }, + loaded = false, + needs_bufread = false, + only_cond = false, + path = "/home/tobyv/.local/share/nvim/site/pack/packer/opt/vim-startuptime", + url = "https://github.com/dstein64/vim-startuptime" + }, + vimspector = { + load_after = { + ["nvim-dap"] = true + }, + loaded = false, + needs_bufread = false, + path = "/home/tobyv/.local/share/nvim/site/pack/packer/opt/vimspector", + url = "https://github.com/puremourning/vimspector" + }, + ["vscode.nvim"] = { + loaded = true, + path = "/home/tobyv/.local/share/nvim/site/pack/packer/start/vscode.nvim", + url = "https://github.com/Mofiqul/vscode.nvim" + }, + ["which-key.nvim"] = { + config = { 'require("which-key").setup({})' }, + loaded = true, + path = "/home/tobyv/.local/share/nvim/site/pack/packer/start/which-key.nvim", + url = "https://github.com/folke/which-key.nvim" + } +} + +time([[Defining packer_plugins]], false) +local module_lazy_loads = { + ["^dap"] = "nvim-dap" +} +local lazy_load_called = {['packer.load'] = true} +local function lazy_load_module(module_name) + local to_load = {} + if lazy_load_called[module_name] then return nil end + lazy_load_called[module_name] = true + for module_pat, plugin_name in pairs(module_lazy_loads) do + if not _G.packer_plugins[plugin_name].loaded and string.match(module_name, module_pat) then + to_load[#to_load + 1] = plugin_name + end + end + + if #to_load > 0 then + require('packer.load')(to_load, {module = module_name}, _G.packer_plugins) + local loaded_mod = package.loaded[module_name] + if loaded_mod then + return function(modname) return loaded_mod end + end + end +end + +if not vim.g.packer_custom_loader_enabled then + table.insert(package.loaders, 1, lazy_load_module) + vim.g.packer_custom_loader_enabled = true +end + +-- Setup for: vimspector +time([[Setup for vimspector]], true) +vim.g.vimspector_enable_mappings = 'HUMAN' +time([[Setup for vimspector]], false) +-- Config for: telescope.nvim +time([[Config for telescope.nvim]], true) +require('plugins/telescope') +time([[Config for telescope.nvim]], false) +-- Config for: lualine.nvim +time([[Config for lualine.nvim]], true) +require('plugins/lualine') +time([[Config for lualine.nvim]], false) +-- Config for: nvim-tree.lua +time([[Config for nvim-tree.lua]], true) +require('plugins/nvim-tree') +time([[Config for nvim-tree.lua]], false) +-- Config for: indent-blankline.nvim +time([[Config for indent-blankline.nvim]], true) +require('plugins/blankline') +time([[Config for indent-blankline.nvim]], false) +-- Config for: DAPInstall.nvim +time([[Config for DAPInstall.nvim]], true) +require("dap-install").config("chrome", {}) +time([[Config for DAPInstall.nvim]], false) +-- Config for: git-worktree.nvim +time([[Config for git-worktree.nvim]], true) +require('plugins/git-worktree') +time([[Config for git-worktree.nvim]], false) +-- Config for: nvim-treesitter +time([[Config for nvim-treesitter]], true) +require('plugins/treesitter') +time([[Config for nvim-treesitter]], false) +-- Config for: LuaSnip +time([[Config for LuaSnip]], true) +require('plugins/luasnip') +time([[Config for LuaSnip]], false) +-- Config for: nvim-bufferline.lua +time([[Config for nvim-bufferline.lua]], true) +require('plugins/bufferline') +time([[Config for nvim-bufferline.lua]], false) +-- Config for: which-key.nvim +time([[Config for which-key.nvim]], true) +require("which-key").setup({}) +time([[Config for which-key.nvim]], false) +-- Config for: nvim-lsp-installer +time([[Config for nvim-lsp-installer]], true) +require('plugins/lsp-installer') +time([[Config for nvim-lsp-installer]], false) +-- Config for: nvim-cmp +time([[Config for nvim-cmp]], true) +require('plugins/cmp') +time([[Config for nvim-cmp]], false) +-- Config for: lspkind-nvim +time([[Config for lspkind-nvim]], true) +require('plugins/lspkind') +time([[Config for lspkind-nvim]], false) +-- Config for: nvim-lspconfig +time([[Config for nvim-lspconfig]], true) +require('plugins/lspconfig') +time([[Config for nvim-lspconfig]], false) + +-- Command lazy-loads +time([[Defining lazy-load commands]], true) +pcall(vim.cmd, [[command -nargs=* -range -bang -complete=file Neogit lua require("packer.load")({'neogit'}, { cmd = "Neogit", l1 = , l2 = , bang = , args = , mods = "" }, _G.packer_plugins)]]) +pcall(vim.cmd, [[command -nargs=* -range -bang -complete=file Dispatch lua require("packer.load")({'vim-dispatch'}, { cmd = "Dispatch", l1 = , l2 = , bang = , args = , mods = "" }, _G.packer_plugins)]]) +pcall(vim.cmd, [[command -nargs=* -range -bang -complete=file Make lua require("packer.load")({'vim-dispatch'}, { cmd = "Make", l1 = , l2 = , bang = , args = , mods = "" }, _G.packer_plugins)]]) +pcall(vim.cmd, [[command -nargs=* -range -bang -complete=file Focus lua require("packer.load")({'vim-dispatch'}, { cmd = "Focus", l1 = , l2 = , bang = , args = , mods = "" }, _G.packer_plugins)]]) +pcall(vim.cmd, [[command -nargs=* -range -bang -complete=file Start lua require("packer.load")({'vim-dispatch'}, { cmd = "Start", l1 = , l2 = , bang = , args = , mods = "" }, _G.packer_plugins)]]) +pcall(vim.cmd, [[command -nargs=* -range -bang -complete=file UndotreeToggle lua require("packer.load")({'undotree'}, { cmd = "UndotreeToggle", l1 = , l2 = , bang = , args = , mods = "" }, _G.packer_plugins)]]) +pcall(vim.cmd, [[command -nargs=* -range -bang -complete=file StartupTime lua require("packer.load")({'vim-startuptime'}, { cmd = "StartupTime", l1 = , l2 = , bang = , args = , mods = "" }, _G.packer_plugins)]]) +time([[Defining lazy-load commands]], false) + +vim.cmd [[augroup packer_load_aucmds]] +vim.cmd [[au!]] + -- Filetype lazy-loads +time([[Defining lazy-load filetype autocommands]], true) +vim.cmd [[au FileType html ++once lua require("packer.load")({'nvim-colorizer.lua'}, { ft = "html" }, _G.packer_plugins)]] +vim.cmd [[au FileType vim ++once lua require("packer.load")({'nvim-colorizer.lua'}, { ft = "vim" }, _G.packer_plugins)]] +vim.cmd [[au FileType css ++once lua require("packer.load")({'nvim-colorizer.lua'}, { ft = "css" }, _G.packer_plugins)]] +vim.cmd [[au FileType javascript ++once lua require("packer.load")({'nvim-colorizer.lua'}, { ft = "javascript" }, _G.packer_plugins)]] +time([[Defining lazy-load filetype autocommands]], false) +vim.cmd("augroup END") +if should_profile then save_profiles() end + +end) + +if not no_errors then + error_msg = error_msg:gsub('"', '\\"') + vim.api.nvim_command('echohl ErrorMsg | echom "Error in packer_compiled: '..error_msg..'" | echom "Please check your config for correctness" | echohl None') +end -- cgit v1.2.3-70-g09d2