Lots of improvements, mostly nvim setup

This commit is contained in:
Trevor Vallender 2023-11-13 16:59:33 +00:00
parent 976b1a5307
commit 4bae40bb29
6 changed files with 30 additions and 56 deletions

View File

@ -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)"

View File

@ -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

View File

@ -1,4 +1,4 @@
[user]
email = trevor@foxsoft.co.uk
[commit]
template = ~/fs/git_template
template = ~/foxsoft/git_template

View File

@ -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'}]
]])

View File

@ -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" }
}

View File

@ -28,6 +28,14 @@ vim.keymap.set('n', '<leader>tli', builtin.lsp_incoming_calls, {})
vim.keymap.set('n', '<leader>tlo', builtin.lsp_outgoing_calls, {})
vim.keymap.set('n', '<leader>tld', builtin.lsp_definitions, {})
vim.keymap.set('n', '<leader>tlt', builtin.lsp_type_definitions, {})
vim.keymap.set('n', '<leader>tls', builtin.lsp_document_symbols, {})
vim.keymap.set('n', '<leader>tlm', builtin.lsp_implementations, {})
vim.keymap.set('n', '<leader>tlw', builtin.lsp_workspace_symbols, {})
vim.keymap.set('n', '<leader>tlD', builtin.diagnostics, {})
vim.keymap.set('n', '<leader>tlK', vim.lsp.buf.signature_help, {})
vim.keymap.set('n', '<leader>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", "<leader>tlf", vim.lsp.buf.format) -- Format code
vim.keymap.set('n', '<leader>e', vim.diagnostic.open_float)