diff --git a/init.lua b/init.lua index 91d8c1c..7d1d651 100644 --- a/init.lua +++ b/init.lua @@ -24,6 +24,7 @@ end opt.guicursor:append('a:blinkon1500-blinkoff1500-blinkwait1200') -- Blink cursor once every 1.5 seconds o.mouse = 'a' -- Enable mouse input +o.mousemoveevent = true -- Allow plugins to detect mouse movement o.termguicolors = true -- Enable 24bit terminal colors -- Other interface settings @@ -243,12 +244,22 @@ vim.diagnostic.config { underline = { -- Only underline warnings and up severity = { min = vim.diagnostic.severity.WARN } - } + }, + virtual_text = { + severity = { min = vim.diagnostic.severity.WARN }, + }, + virtual_lines = { + current_line = true, + }, + signs = { + text = { + [vim.diagnostic.severity.ERROR] = '', + [vim.diagnostic.severity.WARN] = '', + [vim.diagnostic.severity.INFO] = '', + [vim.diagnostic.severity.HINT] = '', + }, + }, } -fn.sign_define('DiagnosticSignInfo', { text = '', texthl = 'DiagnosticSignInfo' }) -fn.sign_define('DiagnosticSignHint', { text = '', texthl = 'DiagnosticSignHint' }) -fn.sign_define('DiagnosticSignWarn', { text = '', texthl = 'DiagnosticSignWarn' }) -fn.sign_define('DiagnosticSignError', { text = '', texthl = 'DiagnosticSignError' }) au('LspAttach', { callback = function(event) require'which-key'.register({ @@ -375,7 +386,7 @@ require('lazy').setup({ vim.g['test#strategy'] = 'neovim' end}, {'julian/vim-textobj-variable-segment', dependencies = {'kana/vim-textobj-user'}}, - {'nvim-treesitter/nvim-treesitter', build = ':TSUpdate', opts = { + {'nvim-treesitter/nvim-treesitter', dependencies = {'OXY2DEV/markview.nvim'}, build = ':TSUpdate', opts = { -- Configure the nvim-ts-autotag plugin autotag = { enable = true, @@ -409,45 +420,39 @@ require('lazy').setup({ lspconfig.util.default_config.capabilities = capabilities -- Set up language servers - lspconfig.ansiblels.setup {} - lspconfig.bashls.setup {} - lspconfig.clangd.setup {} - lspconfig.cssls.setup {} - lspconfig.eslint.setup { - settings = { - rulesCustomizations = { - { rule = '*no-shadow*', severity = 'off' }, - { rule = '*no-unused-vars', severity = 'off' } - }, - }, - } - lspconfig.html.setup {} - lspconfig.jsonls.setup {} - lspconfig.lemminx.setup {} - lspconfig.lua_ls.setup { + vim.lsp.config('lua_ls', { settings = { Lua = { runtime = { version = 'LuaJIT', + path = { + 'lua/?.lua', + 'lua/?/init.lua', + }, + workspace = { + checkThirdParty = false, + library = { + vim.env.VIMRUNTIME + }, + }, }, - diagnostics = { - globals = {'vim'}, - }, - workspace = { - library = vim.api.nvim_get_runtime_file('', true), - checkThirdParty = false, - }, - telemetry = { - enable = false, - }, - } - } - } - lspconfig.nil_ls.setup {} - --lspconfig.basedpyright.setup {} - lspconfig.pyright.setup {} - lspconfig.vimls.setup {} - lspconfig.yamlls.setup {} + }, + }, + }) + vim.lsp.enable({ + 'ansiblels', + 'ast_grep', + 'bashls', + 'clangd', + 'cssls', + 'html', + 'jsonls', + 'lemminx', + 'lua_ls', + 'ty', + 'vimls', + 'yamlls', + }) end}, {'Saghen/blink.cmp', dependencies = {'altermo/ultimate-autopair.nvim', 'rcarriga/cmp-dap'}, lazy = false, build = 'cargo build --release', opts_extend = {'sources.default'}, opts = { keymap = { @@ -655,7 +660,9 @@ require('lazy').setup({ else return {} end - end)() + end)(), + expose_as_code_action = 'all', + jsx_close_tag = { enable = true }, } }}, {'dmmulroy/ts-error-translator.nvim', opts = {}}, @@ -707,6 +714,8 @@ require('lazy').setup({ hover = { enabled = true, }, + tab_size = 24, + max_name_length = 24, }, }, keys = { {'', 'BufferLineCyclePrev', { desc = 'Next buffer' }}, @@ -726,32 +735,15 @@ require('lazy').setup({ {'bh', 'BufferLineMovePrev', { desc = 'Move buffer left' }}, {'bl', 'BufferLineMoveNext', { desc = 'Move buffer right' }}, }}, - {'luckasRanarison/clear-action.nvim', config = function() - require'clear-action'.setup { - signs = { - enable = true, - -- Only show one symbol instead of several per category - combine = true, - -- Don't show the number of actions, - show_count = false, - -- Which icons to use for code action sings - icons = { - combined = '🛈', - }, - }, - popup = { enable = true }, - } - au('LspAttach', { callback = function(event) - local client = vim.lsp.get_client_by_id(event.data.client_id) - local code_action - if client and client.name ~= 'jdtls' then - code_action = require'clear-action'.code_action - else - code_action = vim.lsp.buf.code_action - end - vim.keymap.set('n', 'ga', code_action, { buffer = event.buf, desc = 'Code action' }) - vim.keymap.set('n', 'la', vim.lsp.buf.code_action, { buffer = event.buf, desc = 'Code action' }) - end }) + {'Chaitanyabsprip/fastaction.nvim', opts = { + dismiss_keys = {'q', '', ''}, + keys = 'fjdkslarueiwovmcxpzbnty', + register_ui_select = false, + }, config = function(_, opts) + local fastaction = require'fastaction' + fastaction.setup(opts) + vim.keymap.set('n', 'ga', fastaction.code_action) + vim.keymap.set('n', 'la', fastaction.code_action) end}, {'MattesGroeger/vim-bookmarks', config = function() vim.g.bookmark_no_default_key_mappings = 1 @@ -785,9 +777,8 @@ require('lazy').setup({ host = 'localhost', port = '${port}', executable = { - command = 'node', + command = 'js-debug-adapter', args = { - mason_path('js-debug-adapter') .. '/js-debug/src/dapDebugServer.js', '${port}' }, }, @@ -845,10 +836,17 @@ require('lazy').setup({ { type = 'pwa-node', request = 'attach', - name = 'Attach', + name = 'Attach to process', processId = require'dap.utils'.pick_process, cwd = '${workspaceFolder}', }, + { + type = 'pwa-node', + request = 'attach', + name = 'Attach to port', + address = 'localhost', + port = 9229, + }, { type = 'pwa-node', request = 'launch', @@ -890,6 +888,9 @@ require('lazy').setup({ } } end}, + {'mfussenegger/nvim-dap-python', dependencies = {'mfussenegger/nvim-dap'}, config = function() + require'dap-python'.setup('uv') + end}, {'rcarriga/nvim-dap-ui', dependencies = { 'mfussenegger/nvim-dap', 'nvim-neotest/nvim-nio' @@ -900,9 +901,7 @@ require('lazy').setup({ dap.listeners.after.event_initialized.dapui_config = function() dapui.open {} end - require'which-key'.register { - ['dd'] = {dapui.toggle, 'Toggle'} - } + vim.keymap.set('n', 'dd', dapui.toggle, { desc = 'Toggle' }) end}, {'theHamsta/nvim-dap-virtual-text', dependencies = {'mfussenegger/nvim-dap'}, opts = { -- Clear virtual text when the debugger does a continue @@ -1053,32 +1052,22 @@ require('lazy').setup({ {'junegunn/goyo.vim', config = function() vim.g.goyo_height = '95%' end}, - {url = 'https://git.sr.ht/~whynothugo/lsp_lines.nvim', config = function() - require'lsp_lines'.setup() - vim.diagnostic.config { - virtual_text = { - severity = { min = vim.diagnostic.severity.WARN }, - }, - virtual_lines = { - only_current_line = true, - } - } - end}, - {'williamboman/mason.nvim', opts = {}}, - {'williamboman/mason-lspconfig.nvim', dependencies = {'williamboman/mason.nvim'}, opts = { - automatic_installation = true + {'williamboman/mason.nvim', version = "^2.1.0", opts = {}}, + {'williamboman/mason-lspconfig.nvim', version = "^2.1.0", dependencies = {'williamboman/mason.nvim', 'neovim/nvim-lspconfig'}, opts = { + automatic_enable = false, }}, {'NeogitOrg/neogit', lazy = false, opts = { disable_context_highlighting = true, integrations = { diffview = true, + telescope = true, }, signs = { item = {"", ""}, section = {"", ""}, }, }, keys = { - {'', 'Neogit', { desc = 'Neogit' }} + {'g', 'Neogit', { desc = 'Neogit' }} }}, {'rcarriga/nvim-notify', dependencies = {'nvim-telescope/telescope.nvim'}, opts = { stages = 'fade', @@ -1316,9 +1305,8 @@ require('lazy').setup({ pattern = 'NvimTree*', callback = function() local api = require('nvim-tree.api') - local view = require('nvim-tree.view') - if not view.is_visible() then + if not api.tree.is_visible() then api.tree.open() end end, @@ -1339,11 +1327,11 @@ require('lazy').setup({ }}, {'folke/which-key.nvim', opts = {}, config = function (plugin, opts) require'which-key'.setup(opts) - require'which-key'.register { - ['q'] = { name = 'Quickfix' }, - ['l'] = { name = 'LSP' }, - ['b'] = { name = 'Buffer' }, - ['e'] = { name = 'Diagnostic' }, + require'which-key'.add { + {'q', group = 'Quickfix' }, + {'l', group = 'LSP' }, + {'b', group = 'Buffer' }, + {'e', group = 'Diagnostic' }, } end},