dotfiles

My personal shell configs and stuff
git clone git://git.alex.balgavy.eu/dotfiles.git
Log | Files | Refs | Submodules | README | LICENSE

commit 400c0ceabe08f11b638a32e5d4124841a5e4d9c1
parent 27a2eec5e1993652105fad2f8169376aa3a66be7
Author: Alex Balgavy <alexander.balgavy@spaceapplications.com>
Date:   Thu,  8 Aug 2024 16:30:47 +0200

nvim: configs

Diffstat:
Mnvim/lua/config/mason-lspconfig.lua | 59+++++++++++++++++++++++++----------------------------------
Mnvim/lua/config/nvim-treesitter.lua | 2+-
Mnvim/lua/config/telescope.lua | 18+++++++++---------
Mnvim/lua/plugins.lua | 28++++++++++++++++++++++++----
4 files changed, 59 insertions(+), 48 deletions(-)

diff --git a/nvim/lua/config/mason-lspconfig.lua b/nvim/lua/config/mason-lspconfig.lua @@ -6,7 +6,30 @@ local mason_lspconfig = require 'mason-lspconfig' -- the `settings` field of the server config. You must look up that documentation yourself. local servers = { ansiblels = {}, - lua_ls = {}, + lua_ls = { + ['Lua'] = { + runtime = { + -- Tell the language server which version of Lua you're using + -- (most likely LuaJIT in the case of Neovim) + version = 'LuaJIT', + }, + diagnostics = { + -- Get the language server to recognize the `vim` global + globals = { + 'vim', + 'require' + }, + }, + workspace = { + -- Make the server aware of Neovim runtime files + library = vim.api.nvim_get_runtime_file("", true), + }, + -- Do not send telemetry data containing a randomized but unique identifier + telemetry = { + enable = false, + }, + } + }, docker_compose_language_service = {}, rust_analyzer = { ['rust-analyzer'] = { @@ -46,6 +69,7 @@ local servers = { "-A", "clippy::multiple_unsafe_ops_per_block", -- broken on 0.1.74 "-A", "clippy::mod_module_files", "-A", "clippy::std_instead_of_alloc", + "-A", "clippy::integer_division_remainder_used", "-D", "rust_2018_idioms", "-D", "missing_docs", "-D", "warnings", @@ -132,36 +156,3 @@ mason_lspconfig.setup_handlers { } end, } - --- Lua needs special treatment to make it aware of Neovim builtins -require'lspconfig'.lua_ls.setup { - on_init = function(client) - local path = client.workspace_folders[1].name - if not vim.loop.fs_stat(path..'/.luarc.json') and not vim.loop.fs_stat(path..'/.luarc.jsonc') then - client.config.settings = 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 - -- "${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) - }, - telemetry = { enable = false }, - } - }) - - client.notify("workspace/didChangeConfiguration", { settings = client.config.settings }) - end - return true - end -} diff --git a/nvim/lua/config/nvim-treesitter.lua b/nvim/lua/config/nvim-treesitter.lua @@ -1,7 +1,7 @@ require('nvim-treesitter.configs').setup { -- Add languages to be installed here that you want installed for treesitter ensure_installed = { 'c', 'cpp', 'go', 'lua', 'python', 'rust', 'typescript', 'vim', 'vimdoc', 'bash', 'ledger', 'ruby', - 'python', 'java', 'sql', 'markdown_inline'}, + 'python', 'java', 'sql', 'markdown_inline', 'html'}, highlight = { enable = true }, indent = { enable = true, disable = { 'python' } }, diff --git a/nvim/lua/config/telescope.lua b/nvim/lua/config/telescope.lua @@ -9,8 +9,8 @@ require('telescope').setup { }, }, } -vim.keymap.set('n', '<leader>sp', require('telescope.builtin').oldfiles, { desc = '[?] Find recently opened files' }) -vim.keymap.set('n', '<leader>b', require('telescope.builtin').buffers, { desc = '[ ] Find existing buffers' }) +vim.keymap.set('n', '<leader>sp', require('telescope.builtin').oldfiles, { desc = '[S]earch [p]reviously opened files' }) +vim.keymap.set('n', '<leader>b', require('telescope.builtin').buffers, { desc = 'Find existing buffers' }) vim.keymap.set('n', '<leader>sf', require('telescope.builtin').find_files, { desc = '[S]earch [F]iles' }) vim.keymap.set('n', '<leader>cv', function() require('telescope.builtin').find_files({ cwd = vim.env.DOTFILES..'/nvim' }) end, { desc = 'Neovim configs' }) vim.keymap.set('n', '<leader>sh', require('telescope.builtin').help_tags, { desc = '[S]earch [H]elp' }) @@ -18,12 +18,12 @@ vim.keymap.set('n', '<leader>sw', require('telescope.builtin').grep_string, { de vim.keymap.set('n', '<leader>sg', require('telescope.builtin').live_grep, { desc = '[S]earch by [G]rep' }) vim.keymap.set('n', '<leader>sd', require('telescope.builtin').diagnostics, { desc = '[S]earch [D]iagnostics' }) vim.keymap.set('n', '<leader>sr', require('telescope.builtin').lsp_references, { desc = '[S]earch [R]eferences' }) -vim.keymap.set('n', '<leader>sI', require('telescope.builtin').lsp_incoming_calls, { desc = '[S]earch [I]ncoming calls' }) -vim.keymap.set('n', '<leader>sO', require('telescope.builtin').lsp_outgoing_calls, { desc = '[S]earch [O]utgoing calls' }) -vim.keymap.set('n', '<leader>si', require('telescope.builtin').lsp_implementations, { desc = '[S]earch [i]mplementations' }) +vim.keymap.set('n', '<leader>s<', require('telescope.builtin').lsp_incoming_calls, { desc = '[S]earch [I]ncoming calls' }) +vim.keymap.set('n', '<leader>s>', require('telescope.builtin').lsp_outgoing_calls, { desc = '[S]earch [O]utgoing calls' }) +vim.keymap.set('n', '<leader>sI', require('telescope.builtin').lsp_implementations, { desc = '[S]earch [i]mplementations' }) vim.keymap.set('n', '<leader>ss', function() - local ok, lsp_buf = pcall(require, 'vim.lsp.buf') - if ok and lsp_buf.server_ready() then + local server_ready = not not vim.lsp.buf_notify(0, '$/progress', {}) + if server_ready then require('telescope.builtin').lsp_dynamic_workspace_symbols() else require('telescope.builtin').treesitter() @@ -31,8 +31,8 @@ vim.keymap.set('n', '<leader>ss', function() end, { desc = '[S]earch [S]ymbols' }) vim.keymap.set('n', '<leader>sj', require('telescope.builtin').jumplist, { desc = '[S]earch [J]umplist' }) vim.keymap.set('n', '<leader>sb', function() - local ok, lsp_buf = pcall(require, 'vim.lsp.buf') - if ok and lsp_buf.server_ready() then + local server_ready = not not vim.lsp.buf_notify(0, '$/progress', {}) + if server_ready then require('telescope.builtin').lsp_document_symbols() else require('telescope.builtin').tags() diff --git a/nvim/lua/plugins.lua b/nvim/lua/plugins.lua @@ -213,10 +213,6 @@ return { require("nvim-dap-virtual-text").setup() end}, - { 'lvimuser/lsp-inlayhints.nvim', config = function() - require 'config.lsp-inlayhints' - end}, - { 'Eandrju/cellular-automaton.nvim', config = function() vim.keymap.set('n', 'q:', '<cmd>CellularAutomaton make_it_rain<CR>') end}, @@ -333,4 +329,28 @@ return { "echasnovski/mini.align", config = function(_, opts) require'mini.align'.setup() end, }, + { + "m00qek/baleia.nvim", + version = "*", + config = function() + vim.g.baleia = require("baleia").setup({ }) + + -- Command to colorize the current buffer + vim.api.nvim_create_user_command("BaleiaColorize", function() + vim.g.baleia.once(vim.api.nvim_get_current_buf()) + end, { bang = true }) + + -- Command to show logs + vim.api.nvim_create_user_command("BaleiaLogs", vim.g.baleia.logger.show, { bang = true }) + end, + }, + { + "OXY2DEV/markview.nvim", + lazy = false, -- Not needed, already handled by plugin + + dependencies = { + "nvim-treesitter/nvim-treesitter", + "nvim-tree/nvim-web-devicons" + } + }, }