From 4bae40bb29fb7eee32455565196b6e28e9a8b420 Mon Sep 17 00:00:00 2001 From: Trevor Vallender Date: Mon, 13 Nov 2023 16:59:33 +0000 Subject: [PATCH] Lots of improvements, mostly nvim setup --- .bashrc | 2 +- .config/git/config | 3 +- .config/git/config_foxsoft | 2 +- .config/nvim/init.lua | 63 ++++++---------------------------- .config/nvim/lazy-lock.json | 8 +++++ .config/nvim/lua/tsv/remap.lua | 8 +++++ 6 files changed, 30 insertions(+), 56 deletions(-) diff --git a/.bashrc b/.bashrc index 515e8cc..f0ad341 100644 --- a/.bashrc +++ b/.bashrc @@ -104,4 +104,4 @@ if ! shopt -oq posix; then fi fi -eval "$(/home/tsv/.rbenv/bin/rbenv init - bash)" +eval "$(~/.rbenv/bin/rbenv init - bash)" diff --git a/.config/git/config b/.config/git/config index 1fb25ea..d47f31a 100644 --- a/.config/git/config +++ b/.config/git/config @@ -19,6 +19,7 @@ co = checkout cm = commit cma = commit --amend + cmf = commit --fixup g = log --all --grep # Search commit messages hist = log --pretty=format:\"%h %ad | %s%d [%an]\" --graph --date=short last = log -1 HEAD @@ -37,8 +38,6 @@ wr = worktree remove [init] defaultBranch = main -[interactive] - diffFilter = delta --color-only [delta] features = collared-trogon navigate = true # use n and N to move between diff sections diff --git a/.config/git/config_foxsoft b/.config/git/config_foxsoft index 0dacacb..7be3e3a 100644 --- a/.config/git/config_foxsoft +++ b/.config/git/config_foxsoft @@ -1,4 +1,4 @@ [user] email = trevor@foxsoft.co.uk [commit] - template = ~/fs/git_template + template = ~/foxsoft/git_template diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua index 65d6f73..3e8ce2b 100644 --- a/.config/nvim/init.lua +++ b/.config/nvim/init.lua @@ -7,6 +7,7 @@ set.softtabstop = 2 set.expandtab = true set.number = true set.relativenumber = true +set.mouse='r' --- Plugins local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" @@ -43,8 +44,16 @@ require("lazy").setup({ end }, "hrsh7th/nvim-cmp", + "neovim/nvim-lspconfig", + "williamboman/mason.nvim", + "williamboman/mason-lspconfig.nvim", + "nvim-tree/nvim-web-devicons", "sar/cmp-lsp.nvim", - "neovim/nvim-lspconfig" + "ray-x/cmp-treesitter", + "rhysd/git-messenger.vim", + "mfussenegger/nvim-dap", + "rcarriga/nvim-dap-ui", + "chaoren/vim-wordmotion", }) require("tsv.remap") @@ -118,55 +127,5 @@ cmp.setup { } local capabilities = require('cmp_nvim_lsp').default_capabilities() --- textDocument/diagnostic support until 0.10.0 is released -_timers = {} -local function setup_diagnostics(client, buffer) - if require("vim.lsp.diagnostic")._enable then - return - end +require"lspconfig".ruby_ls.setup{} - local diagnostic_handler = function() - local params = vim.lsp.util.make_text_document_params(buffer) - client.request("textDocument/diagnostic", { textDocument = params }, function(err, result) - if err then - local err_msg = string.format("diagnostics error - %s", vim.inspect(err)) - vim.lsp.log.error(err_msg) - end - local diagnostic_items = {} - if result then - diagnostic_items = result.items - end - vim.lsp.diagnostic.on_publish_diagnostics( - nil, - vim.tbl_extend("keep", params, { diagnostics = diagnostic_items }), - { client_id = client.id } - ) - end) - end - - diagnostic_handler() -- to request diagnostics on buffer when first attaching - - vim.api.nvim_buf_attach(buffer, false, { - on_lines = function() - if _timers[buffer] then - vim.fn.timer_stop(_timers[buffer]) - end - _timers[buffer] = vim.fn.timer_start(200, diagnostic_handler) - end, - on_detach = function() - if _timers[buffer] then - vim.fn.timer_stop(_timers[buffer]) - end - end, - }) -end -require("lspconfig").ruby_ls.setup({ - on_attach = function(client, buffer) - setup_diagnostics(client, buffer) - end, -}) - --- Vimwiki -vim.cmd([[ - let g:vimwiki_list = [{'path': '$HOME/notes/', 'syntax': 'markdown', 'ext': '.md'}] -]]) diff --git a/.config/nvim/lazy-lock.json b/.config/nvim/lazy-lock.json index c6dc04f..62ef837 100644 --- a/.config/nvim/lazy-lock.json +++ b/.config/nvim/lazy-lock.json @@ -1,13 +1,21 @@ { "cmp-lsp.nvim": { "branch": "main", "commit": "60e1e16308c862f678ea02b8430befa20c8fda6c" }, + "cmp-treesitter": { "branch": "master", "commit": "b8bc760dfcc624edd5454f0982b63786a822eed9" }, "codeium.vim": { "branch": "main", "commit": "1efe2a2cdf516094bdb211aa8a1d45ef01836207" }, + "git-messenger.vim": { "branch": "master", "commit": "8a61bdfa351d4df9a9118ee1d3f45edbed617072" }, "gruvbox.nvim": { "branch": "main", "commit": "477c62493c82684ed510c4f70eaf83802e398898" }, "lazy.nvim": { "branch": "main", "commit": "96584866b9c5e998cbae300594d0ccfd0c464627" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "6eb8cae80f2e4322ec82cd9f8fa423f6d1eb02c3" }, + "mason.nvim": { "branch": "main", "commit": "41e75af1f578e55ba050c863587cffde3556ffa6" }, "nvim-cmp": { "branch": "main", "commit": "0b751f6beef40fd47375eaf53d3057e0bfa317e4" }, + "nvim-dap": { "branch": "master", "commit": "9d81c11fd185a131f81841e64941859305f6c42d" }, + "nvim-dap-ui": { "branch": "master", "commit": "34160a7ce6072ef332f350ae1d4a6a501daf0159" }, "nvim-lspconfig": { "branch": "master", "commit": "b0852218bc5fa6514a71a9da6d5cfa63a263c83d" }, "nvim-tree.lua": { "branch": "master", "commit": "a2aaf8b430c11af36b869cf1c0ad2f7c8ceeaf2c" }, "nvim-treesitter": { "branch": "master", "commit": "04a9a90c2a60c86aa9451c539586326b337b03e5" }, + "nvim-web-devicons": { "branch": "master", "commit": "47103b80c38c59f7a1b5408c232b92bf5d018651" }, "plenary.nvim": { "branch": "master", "commit": "50012918b2fc8357b87cff2a7f7f0446e47da174" }, "telescope.nvim": { "branch": "master", "commit": "7011eaae0ac1afe036e30c95cf80200b8dc3f21a" }, + "vim-wordmotion": { "branch": "master", "commit": "81d9bd298376ab0dc465c85d55afa4cb8d5f47a1" }, "which-key.nvim": { "branch": "main", "commit": "4433e5ec9a507e5097571ed55c02ea9658fb268a" } } \ No newline at end of file diff --git a/.config/nvim/lua/tsv/remap.lua b/.config/nvim/lua/tsv/remap.lua index f3408a0..5f4a7ca 100644 --- a/.config/nvim/lua/tsv/remap.lua +++ b/.config/nvim/lua/tsv/remap.lua @@ -28,6 +28,14 @@ vim.keymap.set('n', 'tli', builtin.lsp_incoming_calls, {}) vim.keymap.set('n', 'tlo', builtin.lsp_outgoing_calls, {}) vim.keymap.set('n', 'tld', builtin.lsp_definitions, {}) vim.keymap.set('n', 'tlt', builtin.lsp_type_definitions, {}) +vim.keymap.set('n', 'tls', builtin.lsp_document_symbols, {}) +vim.keymap.set('n', 'tlm', builtin.lsp_implementations, {}) +vim.keymap.set('n', 'tlw', builtin.lsp_workspace_symbols, {}) +vim.keymap.set('n', 'tlD', builtin.diagnostics, {}) +vim.keymap.set('n', 'tlK', vim.lsp.buf.signature_help, {}) +vim.keymap.set('n', 'tlq', vim.diagnostic.setloclist, {}) +vim.keymap.set('n', 'P', vim.diagnostic.open_float, {}) +vim.keymap.set('n', 'H', function() vim.lsp.buf.hover() end, opts) vim.keymap.set("n", "tlf", vim.lsp.buf.format) -- Format code vim.keymap.set('n', 'e', vim.diagnostic.open_float)