dotfiles

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

commit 6994070fda5d8d5f945e5e08c6313d590003f4e6
parent 81ad9ed674c81ad083db206cc476f577083c456e
Author: Alex Balgavy <alexander.balgavy@spaceapplications.com>
Date:   Fri, 22 Dec 2023 23:59:19 +0100

vim: misc configs

Diffstat:
Mnvim/lua/config/mason-lspconfig.lua | 8++++++--
Mnvim/lua/config/telescope.lua | 12++++++++++--
Mnvim/lua/plugins.lua | 59+++++++++++++++++++++++++++++++++++++++++++++++++++++++++--
Mvim/vimrc | 12+++++-------
4 files changed, 78 insertions(+), 13 deletions(-)

diff --git a/nvim/lua/config/mason-lspconfig.lua b/nvim/lua/config/mason-lspconfig.lua @@ -5,6 +5,7 @@ local mason_lspconfig = require 'mason-lspconfig' -- Add any additional override configuration in the following tables. They will be passed to -- the `settings` field of the server config. You must look up that documentation yourself. local servers = { + ansiblels = {}, lua_ls = {}, rust_analyzer = { ['rust-analyzer'] = { @@ -23,6 +24,7 @@ local servers = { "-D", "clippy::pedantic", "-D", "clippy::nursery", "-D", "clippy::restriction", + "-A", "clippy::blanket_clippy_restriction_lints", "-A", "clippy::missing_docs_in_private_items", "-A", "clippy::implicit_return", "-A", "clippy::question_mark_used", @@ -36,10 +38,12 @@ local servers = { "-A", "clippy::float_arithmetic", "-A", "clippy::pub_use", "-A", "clippy::single_char_lifetime_names", + "-A", "clippy::missing_trait_methods", + "-A", "clippy::multiple_unsafe_ops_per_block", -- broken on 0.1.74 "-D", "rust_2018_idioms", "-D", "missing_docs", "-D", "warnings", - "-A", "clippy::too_many_lines"} + "-A", "clippy::too_many_lines"}, -- command = "check", -- extraArgs = { "--no-deps" }, }, @@ -52,6 +56,7 @@ local servers = { }, }, }, + }, -- solargraph = {}, -- bashls = {}, -- pyright = {}, @@ -60,7 +65,6 @@ local servers = { -- texlab = {}, -- clangd = {}, -- perlnavigator = {}, - }, } diff --git a/nvim/lua/config/telescope.lua b/nvim/lua/config/telescope.lua @@ -9,9 +9,10 @@ require('telescope').setup { }, }, } -vim.keymap.set('n', '<leader>?', require('telescope.builtin').oldfiles, { desc = '[?] Find recently opened files' }) +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>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' }) vim.keymap.set('n', '<leader>sw', require('telescope.builtin').grep_string, { desc = '[S]earch current [W]ord' }) vim.keymap.set('n', '<leader>sg', require('telescope.builtin').live_grep, { desc = '[S]earch by [G]rep' }) @@ -28,4 +29,11 @@ vim.keymap.set('n', '<leader>ss', function() end 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>T', require('telescope.builtin').tags, { desc = 'Telescope [T]ags' }) +vim.keymap.set('n', '<leader>sb', function() + local ok, lsp_buf = pcall(require, 'vim.lsp.buf') + if ok and lsp_buf.server_ready() then + require('telescope.builtin').lsp_document_symbols() + else + require('telescope.builtin').tags() + end +end, { desc = 'Telescope [T]ags' }) diff --git a/nvim/lua/plugins.lua b/nvim/lua/plugins.lua @@ -110,6 +110,56 @@ return { }, { + "debugloop/telescope-undo.nvim", + dependencies = { -- note how they're inverted to above example + { + "nvim-telescope/telescope.nvim", + dependencies = { "nvim-lua/plenary.nvim" }, + }, + }, + keys = { + { -- lazy style key map + "<leader>u", + "<cmd>Telescope undo<cr>", + desc = "undo history", + }, + }, + opts = { + -- don't use `defaults = { }` here, do this in the main telescope spec + extensions = { + undo = { + mappings = { + i = { + ["<cr>"] = function(bufnr) + return require("telescope-undo.actions").restore(bufnr) + end, + ["<C-y>"] = function(bufnr) + return require("telescope-undo.actions").yank_additions(bufnr) + end, + }, + n = { + ["<cr>"] = function(bufnr) + return require("telescope-undo.actions").restore(bufnr) + end, + ["y"] = function(bufnr) + return require("telescope-undo.actions").yank_additions(bufnr) + end, + }, + }, + }, + -- no other extensions here, they can have their own spec too + }, + }, + config = function(_, opts) + -- Calling telescope's setup from multiple specs does not hurt, it will happily merge the + -- configs for us. We won't use data, as everything is in it's own namespace (telescope + -- defaults, as well as each extension). + require("telescope").setup(opts) + require("telescope").load_extension("undo") + end, + }, + + { "folke/which-key.nvim", config = function() vim.o.timeout = true @@ -177,7 +227,12 @@ return { }, -- LSP diagnostics at your corner. - { 'RaafatTurki/corn.nvim', - opts = {}, + -- Messes up visual selection.. + -- { 'RaafatTurki/corn.nvim', + -- opts = {}, + -- }, + { + 'dgagn/diagflow.nvim', + opts = {} }, } diff --git a/vim/vimrc b/vim/vimrc @@ -40,10 +40,6 @@ Plug 'majutsushi/tagbar' " Git wrapper from tpope Plug 'tpope/vim-fugitive' -" Undo tree visualiser -" TODO: consider mbbill/undotree instead? -Plug 'simnalamburt/vim-mundo' - " Repeat everything with '.' Plug 'tpope/vim-repeat' @@ -139,7 +135,7 @@ Plug 'jceb/vim-orgmode', { 'for': 'org' } Plug 'rust-lang/rust.vim', { 'for': 'rust' } " Show context -Plug 'wellle/context.vim' +" Plug 'wellle/context.vim' " Fuzzy finder in vim Plug 'junegunn/fzf', { 'dir': '$DOTFILES/tools/fzf', 'do': './install --all --xdg --no-fish'} @@ -148,6 +144,8 @@ Plug 'junegunn/fzf.vim' " Additional text objects Plug 'wellle/targets.vim' +Plug 'mbbill/undotree' + " Vim-only if !has('nvim') " Substitute preview @@ -347,8 +345,8 @@ nnoremap <leader>! :Todo<CR> " Set a filetype cabbrev setf Filetypes -command! Scripts call fzf#run(fzf#wrap({'source': 'command find "$(readlink ~/.scripts)" -type f -or -type l -not -ipath "*/.git/*"', 'options': '--multi --reverse --inline-info --prompt="scripts> "', 'sink': 'sp'})) -command! Configs call fzf#run(fzf#wrap({'source': 'command find ~/.dotfiles -type f ! -ipath "*/.git/*" ! -ipath "*/bin/*" ! -ipath "*/oh-my-zsh/*" ! -name ".DS_Store"', 'options': '--multi --reverse --inline-info --prompt="configs> "', 'sink': 'sp'})) +command! Scripts call fzf#run(fzf#wrap({'source': 'command find $DOTFILES -type f -or -type l -not -ipath "*/.git/*"', 'options': '--multi --reverse --inline-info --prompt="scripts> "', 'sink': 'sp'})) +command! Configs call fzf#run(fzf#wrap({'source': 'command find $DOTFILES -type f ! -ipath "*/.git/*" ! -ipath "*/bin/*" ! -ipath "*/oh-my-zsh/*" ! -name ".DS_Store"', 'options': '--multi --reverse --inline-info --prompt="configs> "', 'sink': 'sp'})) " Haskell {{{3 let hs_highlight_delimiters = 1 let hs_highlight_boolean = 1