From 457ce9e6017c081e02a566895fa1fe488cd87b9c Mon Sep 17 00:00:00 2001 From: Michaël Ball Date: Thu, 18 Jul 2024 09:07:05 +0100 Subject: Refactor plugins for lazy.nvim --- neovim/.config/nvim/lua/plugins/csound.lua | 6 + neovim/.config/nvim/lua/plugins/django_plus.lua | 5 + neovim/.config/nvim/lua/plugins/galaxyline.lua | 230 +++++++++++++++++++++ neovim/.config/nvim/lua/plugins/gitsigns.lua | 45 ++++ neovim/.config/nvim/lua/plugins/goyo.lua | 43 ++++ .../.config/nvim/lua/plugins/indent_blankline.lua | 9 + neovim/.config/nvim/lua/plugins/lspsaga.lua | 24 +++ neovim/.config/nvim/lua/plugins/neo_tree.lua | 15 ++ neovim/.config/nvim/lua/plugins/neogit.lua | 36 ++++ neovim/.config/nvim/lua/plugins/nerdcommenter.lua | 5 + neovim/.config/nvim/lua/plugins/nvim_cmp.lua | 86 ++++++++ neovim/.config/nvim/lua/plugins/nvim_dap.lua | 94 +++++++++ neovim/.config/nvim/lua/plugins/nvim_lspconfig.lua | 80 +++++++ .../.config/nvim/lua/plugins/nvim_treesitter.lua | 31 +++ neovim/.config/nvim/lua/plugins/scvim.lua | 9 + neovim/.config/nvim/lua/plugins/tabby.lua | 41 ++++ neovim/.config/nvim/lua/plugins/tabular.lua | 5 + neovim/.config/nvim/lua/plugins/telescope.lua | 13 ++ neovim/.config/nvim/lua/plugins/tmux_plugins.lua | 18 ++ neovim/.config/nvim/lua/plugins/undotree.lua | 8 + neovim/.config/nvim/lua/plugins/venv_selector.lua | 10 + neovim/.config/nvim/lua/plugins/vim_devicons.lua | 5 + .../.config/nvim/lua/plugins/vim_jinja2_syntax.lua | 6 + neovim/.config/nvim/lua/plugins/vim_markdown.lua | 9 + neovim/.config/nvim/lua/plugins/vim_prettier.lua | 5 + 25 files changed, 838 insertions(+) create mode 100644 neovim/.config/nvim/lua/plugins/csound.lua create mode 100644 neovim/.config/nvim/lua/plugins/django_plus.lua create mode 100644 neovim/.config/nvim/lua/plugins/galaxyline.lua create mode 100644 neovim/.config/nvim/lua/plugins/gitsigns.lua create mode 100644 neovim/.config/nvim/lua/plugins/goyo.lua create mode 100644 neovim/.config/nvim/lua/plugins/indent_blankline.lua create mode 100644 neovim/.config/nvim/lua/plugins/lspsaga.lua create mode 100644 neovim/.config/nvim/lua/plugins/neo_tree.lua create mode 100644 neovim/.config/nvim/lua/plugins/neogit.lua create mode 100644 neovim/.config/nvim/lua/plugins/nerdcommenter.lua create mode 100644 neovim/.config/nvim/lua/plugins/nvim_cmp.lua create mode 100644 neovim/.config/nvim/lua/plugins/nvim_dap.lua create mode 100644 neovim/.config/nvim/lua/plugins/nvim_lspconfig.lua create mode 100644 neovim/.config/nvim/lua/plugins/nvim_treesitter.lua create mode 100644 neovim/.config/nvim/lua/plugins/scvim.lua create mode 100644 neovim/.config/nvim/lua/plugins/tabby.lua create mode 100644 neovim/.config/nvim/lua/plugins/tabular.lua create mode 100644 neovim/.config/nvim/lua/plugins/telescope.lua create mode 100644 neovim/.config/nvim/lua/plugins/tmux_plugins.lua create mode 100644 neovim/.config/nvim/lua/plugins/undotree.lua create mode 100644 neovim/.config/nvim/lua/plugins/venv_selector.lua create mode 100644 neovim/.config/nvim/lua/plugins/vim_devicons.lua create mode 100644 neovim/.config/nvim/lua/plugins/vim_jinja2_syntax.lua create mode 100644 neovim/.config/nvim/lua/plugins/vim_markdown.lua create mode 100644 neovim/.config/nvim/lua/plugins/vim_prettier.lua (limited to 'neovim/.config/nvim/lua/plugins') diff --git a/neovim/.config/nvim/lua/plugins/csound.lua b/neovim/.config/nvim/lua/plugins/csound.lua new file mode 100644 index 0000000..dce88e2 --- /dev/null +++ b/neovim/.config/nvim/lua/plugins/csound.lua @@ -0,0 +1,6 @@ +return { + { + 'luisjure/csound-vim', + ft = 'csound', + }, +} diff --git a/neovim/.config/nvim/lua/plugins/django_plus.lua b/neovim/.config/nvim/lua/plugins/django_plus.lua new file mode 100644 index 0000000..2ca10a4 --- /dev/null +++ b/neovim/.config/nvim/lua/plugins/django_plus.lua @@ -0,0 +1,5 @@ +return { + { + 'tweekmonster/django-plus.vim', + } +} diff --git a/neovim/.config/nvim/lua/plugins/galaxyline.lua b/neovim/.config/nvim/lua/plugins/galaxyline.lua new file mode 100644 index 0000000..9f58157 --- /dev/null +++ b/neovim/.config/nvim/lua/plugins/galaxyline.lua @@ -0,0 +1,230 @@ +return { + { + 'nvimdev/galaxyline.nvim', + branch = 'main', + dependencies = { + { + 'nvim-tree/nvim-web-devicons', + }, + { + 'arzg/vim-colors-xcode', + lazy = false, + priority = 1000, + config = function() + vim.cmd[[colorscheme xcode]] + end + }, + }, + config = function() + local gl = require('galaxyline') + local colors = { + yellow = vim.g.terminal_color_11, + cyan = vim.g.terminal_color_14, + darkblue = vim.g.terminal_color_4, + green = vim.g.terminal_color_10, + orange = vim.g.terminal_color_3, + violet = vim.g.terminal_color_5, + magenta = vim.g.terminal_color_13, + blue = vim.g.terminal_color_12, + red = vim.g.terminal_color_9, + } + local condition = require('galaxyline.condition') + local gls = gl.section + local lsp = require('galaxyline.provider_lsp') + gl.short_line_list = {'nerdtree', 'NeogitStatus', 'vim-plug', 'lspsagaoutline'} + + gls.left[1] = { + RainbowBlue = { + provider = function() return '▊ ' end, + highlight = {colors.blue, 'StatusLine'} + }, + } + gls.left[2] = { + ViMode = { + provider = function() + -- auto change color according the vim mode + local mode_color = {n = colors.red, i = colors.green,v=colors.blue, + ['^V'] = colors.blue,V=colors.blue, + c = colors.magenta,no = colors.red,s = colors.orange, + S=colors.orange,['^S'] = colors.orange, + ic = colors.yellow,R = colors.violet,Rv = colors.violet, + cv = colors.red,ce=colors.red, r = colors.cyan, + rm = colors.cyan, ['r?'] = colors.cyan, + ['!'] = colors.red,t = colors.red} + vim.api.nvim_command('hi GalaxyViMode guifg='..mode_color[vim.fn.mode()]) + return ' ' + end, + highlight = {colors.red, 'StatusLine', 'bold'}, + }, + } + + gls.left[3] = { + FileSize = { + provider = 'FileSize', + condition = condition.buffer_not_empty, + highlight = {'StatusLine', 'StatusLine'}, + } + } + gls.left[4] ={ + FileIcon = { + provider = 'FileIcon', + condition = function() + if vim.g.GtkGuiLoaded ~= nil and condition.buffer_not_empty() then + return true + end + return false + end, + highlight = {require('galaxyline.provider_fileinfo').get_file_icon_color, 'StatusLine'}, + }, + } + + gls.left[5] = { + FileName = { + provider = 'FileName', + condition = condition.buffer_not_empty, + highlight = {colors.magenta, 'StatusLine', 'bold'} + } + } + + gls.left[6] = { + LineInfo = { + provider = 'LineColumn', + separator = ' ', + separator_highlight = {'NONE', 'StatusLine'}, + highlight = {'NONE', 'StatusLine'}, + }, + } + + gls.left[7] = { + PerCent = { + provider = 'LinePercent', + separator = ' ', + separator_highlight = {'NONE', 'StatusLine'}, + highlight = {'NONE', 'StatusLine', 'bold'}, + } + } + + gls.left[8] = { + DiagnosticError = { + provider = 'DiagnosticError', + icon = '  ', + highlight = {colors.red, 'StatusLine'} + } + } + gls.left[9] = { + DiagnosticWarn = { + provider = 'DiagnosticWarn', + icon = '  ', + highlight = {colors.yellow, 'StatusLine'}, + } + } + + gls.left[10] = { + DiagnosticHint = { + provider = 'DiagnosticHint', + icon = '  ', + highlight = {colors.cyan, 'StatusLine'}, + } + } + + gls.left[11] = { + DiagnosticInfo = { + provider = 'DiagnosticInfo', + icon = '  ', + highlight = {colors.blue, 'StatusLine'}, + } + } + + gls.mid[1] = { + ShowLspClient = { + provider = 'GetLspClient', + condition = function () + local tbl = {['dashboard'] = true,['']=true} + if tbl[vim.bo.filetype] then + return false + elseif lsp.get_lsp_client() == 'No Active Lsp' then + return false + end + return true + end, + icon = '⚙ LSP:', + highlight = {colors.cyan, 'StatusLine','bold'} + } + } + + gls.right[1] = { + GitIcon = { + provider = function() return '  ' end, + condition = condition.check_git_workspace, + separator = ' ', + separator_highlight = {'NONE', 'StatusLine'}, + highlight = {colors.violet, 'StatusLine', 'bold'}, + } + } + + gls.right[2] = { + GitBranch = { + provider = 'GitBranch', + condition = condition.check_git_workspace, + highlight = {colors.violet, 'StatusLine', 'bold'}, + } + } + + gls.right[3] = { + DiffAdd = { + provider = 'DiffAdd', + condition = condition.hide_in_width, + icon = ' +', + highlight = {colors.green, 'StatusLine'}, + } + } + gls.right[4] = { + DiffModified = { + provider = 'DiffModified', + condition = condition.hide_in_width, + icon = ' ±', + highlight = {colors.orange, 'StatusLine'}, + } + } + gls.right[5] = { + DiffRemove = { + provider = 'DiffRemove', + condition = condition.hide_in_width, + icon = ' -', + highlight = {colors.red, 'StatusLine'}, + } + } + + gls.right[6] = { + RainbowBlue = { + provider = function() return ' ▊' end, + highlight = {colors.blue, 'StatusLine'} + }, + } + + gls.short_line_left[1] = { + BufferType = { + provider = 'FileTypeName', + separator = ' ', + separator_highlight = {'NONE', 'StatusLine'}, + highlight = {colors.blue, 'StatusLine', 'bold'} + } + } + + gls.short_line_left[2] = { + SFileName = { + provider = 'SFileName', + condition = condition.buffer_not_empty, + highlight = {'StatusLine', 'StatusLine', 'bold'} + } + } + + gls.short_line_right[1] = { + BufferIcon = { + provider= 'BufferIcon', + highlight = {'StatusLine', 'StatusLine'}, + } + } + end, + }, +} diff --git a/neovim/.config/nvim/lua/plugins/gitsigns.lua b/neovim/.config/nvim/lua/plugins/gitsigns.lua new file mode 100644 index 0000000..91ec74d --- /dev/null +++ b/neovim/.config/nvim/lua/plugins/gitsigns.lua @@ -0,0 +1,45 @@ +return { + { + 'lewis6991/gitsigns.nvim', + opts = { + on_attach = function(bufnr) + local gs = package.loaded.gitsigns + + local function map(mode, l, r, opts) + opts = opts or {} + opts.buffer = bufnr + vim.keymap.set(mode, l, r, opts) + end + + -- Navigation + map('n', ']c', function() + if vim.wo.diff then return ']c' end + vim.schedule(function() gs.next_hunk() end) + return '' + end, {expr=true}) + + map('n', '[c', function() + if vim.wo.diff then return '[c' end + vim.schedule(function() gs.prev_hunk() end) + return '' + end, {expr=true}) + + -- Actions + map({'n', 'v'}, 'hs', ':Gitsigns stage_hunk') + map({'n', 'v'}, 'hr', ':Gitsigns reset_hunk') + map('n', 'hS', gs.stage_buffer) + map('n', 'hu', gs.undo_stage_hunk) + map('n', 'hR', gs.reset_buffer) + map('n', 'hp', gs.preview_hunk) + map('n', 'hb', function() gs.blame_line{full=true} end) + map('n', 'tb', gs.toggle_current_line_blame) + map('n', 'hd', gs.diffthis) + map('n', 'hD', function() gs.diffthis('~') end) + map('n', 'td', gs.toggle_deleted) + + -- Text object + map({'o', 'x'}, 'ih', ':Gitsigns select_hunk') + end + }, + }, +} diff --git a/neovim/.config/nvim/lua/plugins/goyo.lua b/neovim/.config/nvim/lua/plugins/goyo.lua new file mode 100644 index 0000000..7de7150 --- /dev/null +++ b/neovim/.config/nvim/lua/plugins/goyo.lua @@ -0,0 +1,43 @@ +return { + { + 'junegunn/goyo.vim', + cond = function() return vim.fn.exists('g:gui_vimr') == 1 end, + dependencies = { + { + 'junegunn/limelight.vim', + }, + }, + keys = { + { 'z', 'Goyo', desc = 'Goyo' }, + }, + config = function() + local goyo_enter = function() + vim.opt.showmode = false + vim.opt.showcmd = false + vim.opt.scrolloff = 999 + vim.cmd('Limelight') + end + + local goyo_leave = function() + vim.opt.showmode = true + vim.opt.showcmd = true + vim.opt.scrolloff = 5 + vim.cmd('Limelight!') + end + + local goyo_augroup = vim.api.nvim_create_augroup('Goyo', { clear = true }) + vim.api.nvim_create_autocmd('User', + { + pattern = 'GoyoEnter', + group = goyo_augroup, + callback = goyo_enter, + }) + vim.api.nvim_create_autocmd('User', + { + pattern = 'GoyoLeave', + group = goyo_augroup, + callback = goyo_leave, + }) + end, + }, +} diff --git a/neovim/.config/nvim/lua/plugins/indent_blankline.lua b/neovim/.config/nvim/lua/plugins/indent_blankline.lua new file mode 100644 index 0000000..0991c0c --- /dev/null +++ b/neovim/.config/nvim/lua/plugins/indent_blankline.lua @@ -0,0 +1,9 @@ +return { + { + 'lukas-reineke/indent-blankline.nvim', + main = 'ibl', + opts = { + indent = { char = '▏' }, + }, + }, +} diff --git a/neovim/.config/nvim/lua/plugins/lspsaga.lua b/neovim/.config/nvim/lua/plugins/lspsaga.lua new file mode 100644 index 0000000..1fe1194 --- /dev/null +++ b/neovim/.config/nvim/lua/plugins/lspsaga.lua @@ -0,0 +1,24 @@ +return { + { + 'nvimdev/lspsaga.nvim', + lazy = false, + priority = 500, + dependencies = { + 'nvim-tree/nvim-web-devicons', + }, + opts = { + symbol_in_winbar = { + respect_root = true, + }, + }, + keys = { + { "gh", "Lspsaga finder", desc = "Lspsaga finder" }, + { "cx", "Lspsaga code_action", desc = "Lspsaga codeaction" }, + { "cx", "Lspsaga range_code_action", mode = "v", desc = "Lspsaga codeaction" }, + { "K", "Lspsaga hover_doc", desc = "Lspsaga hover doc" }, + { "rn", "Lspsaga rename", desc = "Lspsaga rename" }, + { "[g", "Lspsaga diagnostic_jump_next", desc = "Lspsaga jump to next diagnostic" }, + { "]g", "Lspsaga diagnostic_jump_prev", desc = "Lspsaga jump to previous diagnostic" }, + } + }, +} diff --git a/neovim/.config/nvim/lua/plugins/neo_tree.lua b/neovim/.config/nvim/lua/plugins/neo_tree.lua new file mode 100644 index 0000000..f2ea5d2 --- /dev/null +++ b/neovim/.config/nvim/lua/plugins/neo_tree.lua @@ -0,0 +1,15 @@ +return { + { + "nvim-neo-tree/neo-tree.nvim", + branch = "v3.x", + dependencies = { + "nvim-lua/plenary.nvim", + "nvim-tree/nvim-web-devicons", -- not strictly required, but recommended + "MunifTanjim/nui.nvim", + -- "3rd/image.nvim", -- Optional image support in preview window: See `# Preview Mode` for more information + }, + keys = { + { '', 'Neotree toggle', desc = 'Neotree toggle' }, + } + }, +} diff --git a/neovim/.config/nvim/lua/plugins/neogit.lua b/neovim/.config/nvim/lua/plugins/neogit.lua new file mode 100644 index 0000000..a0a3f90 --- /dev/null +++ b/neovim/.config/nvim/lua/plugins/neogit.lua @@ -0,0 +1,36 @@ +return { + { + 'NeogitOrg/neogit', + cmd = 'Neogit', + dependencies = { + 'nvim-lua/plenary.nvim', + 'sindrets/diffview.nvim', + }, + opts = { + disable_commit_confirmation = true, + auto_refresh = true, + kind = 'tab', + commit_editor = { + kind = 'auto', + }, + integrations = { + -- Neogit only provides inline diffs. If you want a more traditional way to look at diffs, you can use `sindrets/diffview.nvim`. + -- The diffview integration enables the diff popup, which is a wrapper around `sindrets/diffview.nvim`. + -- + -- Requires you to have `sindrets/diffview.nvim` installed. + -- use { + -- 'TimUntersberger/neogit', + -- requires = { + -- 'nvim-lua/plenary.nvim', + -- 'sindrets/diffview.nvim' + -- } + -- } + -- + diffview = true + } + }, + keys = { + { 'g', 'Neogit', desc = 'Neogit toggle' }, + }, + }, +} diff --git a/neovim/.config/nvim/lua/plugins/nerdcommenter.lua b/neovim/.config/nvim/lua/plugins/nerdcommenter.lua new file mode 100644 index 0000000..280dd8e --- /dev/null +++ b/neovim/.config/nvim/lua/plugins/nerdcommenter.lua @@ -0,0 +1,5 @@ +return { + { + 'preservim/nerdcommenter' + }, +} diff --git a/neovim/.config/nvim/lua/plugins/nvim_cmp.lua b/neovim/.config/nvim/lua/plugins/nvim_cmp.lua new file mode 100644 index 0000000..0958eac --- /dev/null +++ b/neovim/.config/nvim/lua/plugins/nvim_cmp.lua @@ -0,0 +1,86 @@ +return { + { + 'hrsh7th/nvim-cmp', + priority = 900, + lazy = false, + dependencies = { + { + 'andersevenrud/cmp-tmux', + cond = function() return vim.fn.exists('g:gui_vimr') == 0 end + }, + { + 'hrsh7th/cmp-nvim-lsp' + }, + { + 'hrsh7th/cmp-nvim-lsp-signature-help' + }, + { + 'hrsh7th/cmp-nvim-lsp-document-symbol' + }, + { + 'hrsh7th/cmp-buffer' + }, + { + 'hrsh7th/cmp-path' + }, + { + 'hrsh7th/cmp-cmdline' + }, + { + 'hrsh7th/cmp-vsnip', + dependencies = { + 'hrsh7th/vim-vsnip', + }, + } + }, + config = function () + local cmp = require('cmp') + + cmp.setup({ + snippet = { + -- REQUIRED - you must specify a snippet engine + expand = function(args) + vim.fn["vsnip#anonymous"](args.body) -- For `vsnip` users. + end, + }, + view = { + entries = {name = 'custom', selection_order = 'near_cursor' } + }, + mapping = cmp.mapping.preset.insert({ + [''] = cmp.mapping.scroll_docs(-4), + [''] = cmp.mapping.scroll_docs(4), + [''] = cmp.mapping.complete(), + [''] = cmp.mapping.abort(), + [''] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. + }), + sources = cmp.config.sources({ + { name = 'nvim_lsp' }, + { name = 'nvim_lsp_signature_help' }, + { name = 'vsnip' }, -- For vsnip users. + }, { + { name = 'buffer' }, + }, { + { name = 'tmux' }, + }), + }) + + -- Use buffer source for `/` (if you enabled `native_menu`, this won't work anymore). + cmp.setup.cmdline('/', { + sources = cmp.config.sources({ + { name = 'nvim_lsp_document_symbol' } + }, { + { name = 'buffer' } + }) + }) + + -- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore). + cmp.setup.cmdline(':', { + sources = cmp.config.sources({ + { name = 'path' } + }, { + { name = 'cmdline' } + }) + }) + end, + }, +} diff --git a/neovim/.config/nvim/lua/plugins/nvim_dap.lua b/neovim/.config/nvim/lua/plugins/nvim_dap.lua new file mode 100644 index 0000000..1a3a12a --- /dev/null +++ b/neovim/.config/nvim/lua/plugins/nvim_dap.lua @@ -0,0 +1,94 @@ +return { + { + 'mfussenegger/nvim-dap', + dependencies = { + 'mfussenegger/nvim-dap-python', + 'rcarriga/nvim-dap-ui', + 'nvim-neotest/nvim-nio', + }, + config = function() + local dap = require'dap' + vim.fn.sign_define('DapBreakpoint', { + text = '⬤', + texthl = 'ErrorMsg', + linehl = '', + numhl = 'ErrorMsg' + }) + + vim.fn.sign_define('DapBreakpointCondition', { + text = '⬤', + texthl = 'ErrorMsg', + linehl = '', + numhl = 'SpellBad' + }) + + local pythonPath = function() + local cwd = vim.loop.cwd() + if vim.fn.executable(cwd .. '/venv/bin/python') == 1 then + return cwd .. '/venv/bin/python' + else + return '/Users/michael/.pyenv/shims/python3' + end + end + + local set_python_dap = function() + require('dap-python').setup() -- earlier so setup the various defaults ready to be replaced + dap.configurations.python = { + { + type = 'python'; + request = 'launch'; + name = "Launch file"; + program = "${file}"; + pythonPath = pythonPath() + }, + { + type = 'python', + request = 'launch', + name = 'DAP Django', + program = vim.loop.cwd() .. '/manage.py', + args = {'runserver', '--noreload'}, + justMyCode = true, + django = true, + console = "integratedTerminal", + }, + { + type = 'python'; + request = 'attach'; + name = 'Attach remote'; + connect = function() + return { + host = '127.0.0.1', + port = 5678 + } + end; + }, + { + type = 'python'; + request = 'launch'; + name = 'Launch file with arguments'; + program = '${file}'; + args = function() + local args_string = vim.fn.input('Arguments: ') + return vim.split(args_string, " +") + end; + console = "integratedTerminal", + pythonPath = pythonPath() + } + } + + dap.adapters.python = { + type = 'executable', + command = pythonPath(), + args = {'-m', 'debugpy.adapter'} + } + end + + set_python_dap() + vim.api.nvim_create_autocmd({"DirChanged"}, { + callback = function() set_python_dap() end, + }) + + require("dapui").setup() + end, + }, +} diff --git a/neovim/.config/nvim/lua/plugins/nvim_lspconfig.lua b/neovim/.config/nvim/lua/plugins/nvim_lspconfig.lua new file mode 100644 index 0000000..f03db19 --- /dev/null +++ b/neovim/.config/nvim/lua/plugins/nvim_lspconfig.lua @@ -0,0 +1,80 @@ +return { + { + 'neovim/nvim-lspconfig', + lazy = false, + priority = 800, + config = function() + local nvim_lsp = require('lspconfig') + local capabilities = require('cmp_nvim_lsp').default_capabilities() + -- Use a loop to conveniently call 'setup' on multiple servers and + -- map buffer local keybindings when the language server attaches + local servers = { "bashls", "clangd", "cssls", "gopls", "html", "jsonls", "pylsp", "rust_analyzer", "yamlls" } + for _, lsp in ipairs(servers) do + nvim_lsp[lsp].setup { + capabilities = capabilities, + flags = { + debounce_text_changes = 150, + } + } + end + + require'lspconfig'.lua_ls.setup { + on_init = function(client) + local path = client.workspace_folders[1].name + if vim.loop.fs_stat(path..'/.luarc.json') or vim.loop.fs_stat(path..'/.luarc.jsonc') then + return + end + + client.config.settings.Lua = vim.tbl_deep_extend('force', client.config.settings.Lua, { + runtime = { + -- Tell the language server which version of Lua you're using + -- (most likely LuaJIT in the case of Neovim) + version = 'LuaJIT' + }, + -- Make the server aware of Neovim runtime files + workspace = { + checkThirdParty = false, + library = { + vim.env.VIMRUNTIME + -- Depending on the usage, you might want to add additional paths here. + -- "${3rd}/luv/library" + -- "${3rd}/busted/library", + } + -- or pull in all of 'runtimepath'. NOTE: this is a lot slower + -- library = vim.api.nvim_get_runtime_file("", true) + } + }) + end, + settings = { + Lua = {} + }, + capabilities = capabilities, + } + + require'lspconfig'.tsserver.setup { + filetypes = { 'typescript', 'typescriptreact', 'typescript.tsx' }, + capabilities = capabilities, + flags = { + debounce_text_changes = 150, + }, + } + + -- Use LspAttach autocommand to only map the following keys + -- after the language server attaches to the current buffer + vim.api.nvim_create_autocmd('LspAttach', { + group = vim.api.nvim_create_augroup('UserLspConfig', {}), + callback = function(ev) + -- Enable completion triggered by + vim.bo[ev.buf].omnifunc = 'v:lua.vim.lsp.omnifunc' + + local opts = { buffer = ev.buf } + vim.keymap.set('n', 'gd', 'lua vim.lsp.buf.definition()', { noremap = true }) + vim.keymap.set('x', 'f', 'lua vim.lsp.buf.range_formatting()', {}) + vim.keymap.set('n', 'f', function() + vim.lsp.buf.format { async = true } + end, opts) + end, + }) + end, + }, +} diff --git a/neovim/.config/nvim/lua/plugins/nvim_treesitter.lua b/neovim/.config/nvim/lua/plugins/nvim_treesitter.lua new file mode 100644 index 0000000..5ccb95a --- /dev/null +++ b/neovim/.config/nvim/lua/plugins/nvim_treesitter.lua @@ -0,0 +1,31 @@ +return { + { + 'nvim-treesitter/nvim-treesitter', + build = ':TSUpdate', + opts = { + ensure_installed = { "bash", "c", "cmake", "cpp", "css", "go", "html", "htmldjango", "json", "lua", "make", "markdown", "markdown_inline", "python", "rust", "toml", "typescript", "vim" }, -- one of "all", "maintained" (parsers with maintainers), or a list of languages + ignore_install = {}, -- List of parsers to ignore installing + highlight = { + enable = true, -- false will disable the whole extension + disable = {}, -- list of language that will be disabled + -- 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 = true, + }, + incremental_selection = { + enable = true, + keymaps = { + init_selection = "gnn", + node_incremental = "grn", + scope_incremental = "grc", + node_decremental = "grm", + }, + }, + indent = { + enable = true + } + }, + }, +} diff --git a/neovim/.config/nvim/lua/plugins/scvim.lua b/neovim/.config/nvim/lua/plugins/scvim.lua new file mode 100644 index 0000000..0a2e680 --- /dev/null +++ b/neovim/.config/nvim/lua/plugins/scvim.lua @@ -0,0 +1,9 @@ +return { + { + 'supercollider/scvim', + config = function() + vim.g.scFlash = 1 + end, + ft = 'supercollider', + }, +} diff --git a/neovim/.config/nvim/lua/plugins/tabby.lua b/neovim/.config/nvim/lua/plugins/tabby.lua new file mode 100644 index 0000000..b989ae5 --- /dev/null +++ b/neovim/.config/nvim/lua/plugins/tabby.lua @@ -0,0 +1,41 @@ +return { + { + 'nanozuki/tabby.nvim', + dependencies = { + 'nvim-tree/nvim-web-devicons', + }, + config = function () + local theme = { + fill = 'TabLineFill', + -- Also you can do this: fill = { fg='#f2e9de', bg='#907aa9', style='italic' } + head = 'TabLine', + current_tab = 'TabLineSel', + tab = 'TabLine', + win = 'TabLine', + tail = 'TabLine', + } + require('tabby.tabline').set(function(line) + return { + { + line.sep('', theme.head, theme.fill), + }, + line.tabs().foreach(function(tab) + local hl = tab.is_current() and theme.current_tab or theme.tab + return { + line.sep('', hl, theme.fill), + tab.is_current() and '' or '', + tab.number(), + tab.name(), + tab.close_btn(''), + line.sep('', hl, theme.fill), + hl = hl, + margin = ' ', + } + end), + hl = theme.fill, + } + end) + end, + cond = function() return vim.fn.has('gui_running') == 0 end, + }, +} diff --git a/neovim/.config/nvim/lua/plugins/tabular.lua b/neovim/.config/nvim/lua/plugins/tabular.lua new file mode 100644 index 0000000..2415eb6 --- /dev/null +++ b/neovim/.config/nvim/lua/plugins/tabular.lua @@ -0,0 +1,5 @@ +return { + { + 'godlygeek/tabular' + }, +} diff --git a/neovim/.config/nvim/lua/plugins/telescope.lua b/neovim/.config/nvim/lua/plugins/telescope.lua new file mode 100644 index 0000000..6a81359 --- /dev/null +++ b/neovim/.config/nvim/lua/plugins/telescope.lua @@ -0,0 +1,13 @@ +return { + { + 'nvim-telescope/telescope.nvim', + dependencies = { + 'nvim-lua/plenary.nvim', + }, + keys = { + { '', 'Telescope buffers', desc = 'Telescope buffers' }, + { '', 'Telescope find_files', desc = 'Telescope find files' }, + { '', 'Telescope live_grep', desc = 'Telescope live grep' }, + }, + }, +} diff --git a/neovim/.config/nvim/lua/plugins/tmux_plugins.lua b/neovim/.config/nvim/lua/plugins/tmux_plugins.lua new file mode 100644 index 0000000..1ff0312 --- /dev/null +++ b/neovim/.config/nvim/lua/plugins/tmux_plugins.lua @@ -0,0 +1,18 @@ +return { + { + 'tmux-plugins/vim-tmux', + cond = function() return vim.fn.exists('g:gui_vimr') == 0 end, + }, + { + 'tmux-plugins/vim-tmux-focus-events', + cond = function() return vim.fn.exists('g:gui_vimr') == 0 end, + }, + { + 'benmills/vimux', + cond = function() return vim.fn.exists('g:gui_vimr') == 0 end, + config = function() + vim.g.VimuxUseNearest = 0 + vim.gVimuxResetSequence = "" + end, + } +} diff --git a/neovim/.config/nvim/lua/plugins/undotree.lua b/neovim/.config/nvim/lua/plugins/undotree.lua new file mode 100644 index 0000000..7492481 --- /dev/null +++ b/neovim/.config/nvim/lua/plugins/undotree.lua @@ -0,0 +1,8 @@ +return { + { + 'mbbill/undotree', + keys = { + { '', 'UndotreeToggle', desc = 'UndoTree toggle' }, + }, + }, +} diff --git a/neovim/.config/nvim/lua/plugins/venv_selector.lua b/neovim/.config/nvim/lua/plugins/venv_selector.lua new file mode 100644 index 0000000..0e4fb30 --- /dev/null +++ b/neovim/.config/nvim/lua/plugins/venv_selector.lua @@ -0,0 +1,10 @@ +return { + { + 'linux-cultist/venv-selector.nvim', + branch = 'regexp', + opts = {}, + keys = { + { ',v', 'VenvSelect', desc = 'VenvSelect' }, + }, + }, +} diff --git a/neovim/.config/nvim/lua/plugins/vim_devicons.lua b/neovim/.config/nvim/lua/plugins/vim_devicons.lua new file mode 100644 index 0000000..f348be7 --- /dev/null +++ b/neovim/.config/nvim/lua/plugins/vim_devicons.lua @@ -0,0 +1,5 @@ +return { + { + 'ryanoasis/vim-devicons' + }, +} diff --git a/neovim/.config/nvim/lua/plugins/vim_jinja2_syntax.lua b/neovim/.config/nvim/lua/plugins/vim_jinja2_syntax.lua new file mode 100644 index 0000000..eed3d6a --- /dev/null +++ b/neovim/.config/nvim/lua/plugins/vim_jinja2_syntax.lua @@ -0,0 +1,6 @@ +return { + { + 'Glench/Vim-Jinja2-Syntax', + ft = 'jinja', + }, +} diff --git a/neovim/.config/nvim/lua/plugins/vim_markdown.lua b/neovim/.config/nvim/lua/plugins/vim_markdown.lua new file mode 100644 index 0000000..67b1563 --- /dev/null +++ b/neovim/.config/nvim/lua/plugins/vim_markdown.lua @@ -0,0 +1,9 @@ +return { + { + 'plasticboy/vim-markdown', + config = function() + vim.g.vim_markdown_folding_disabled = 1 + end, + ft = 'markdown', + }, +} diff --git a/neovim/.config/nvim/lua/plugins/vim_prettier.lua b/neovim/.config/nvim/lua/plugins/vim_prettier.lua new file mode 100644 index 0000000..5ec2aa2 --- /dev/null +++ b/neovim/.config/nvim/lua/plugins/vim_prettier.lua @@ -0,0 +1,5 @@ +return { + { + 'prettier/vim-prettier', + }, +} -- cgit v1.2.3