From a5f3fe65b052d29c84007287de3553fef71acbd2 Mon Sep 17 00:00:00 2001 From: Rostyslav Hnatyshyn Date: Thu, 12 Sep 2024 03:35:08 -0700 Subject: [PATCH] add outline + way to open float diagnostic --- nvim/cheatsheet.txt | 11 +++++++++-- nvim/init.lua | 31 ++++++++++++++++++++++++++----- 2 files changed, 35 insertions(+), 7 deletions(-) diff --git a/nvim/cheatsheet.txt b/nvim/cheatsheet.txt index a4ebfea..380bdfd 100644 --- a/nvim/cheatsheet.txt +++ b/nvim/cheatsheet.txt @@ -15,8 +15,15 @@ List workspace folders | wl ## Gitsigns Toggle deleted | td -Diff | hd -Preview hunk | hp +Diff | hd +Preview hunk | hp +Reset hunk | hr + ## Misc +Outline | o Trouble | xx Find in project | f +Open filetree | v +Edit luaconfig | ec +Source luaconfig | sc +Open diagnostic info in floating window |dd diff --git a/nvim/init.lua b/nvim/init.lua index ab4a780..27df1ac 100644 --- a/nvim/init.lua +++ b/nvim/init.lua @@ -21,7 +21,8 @@ vim.wo.cursorline = true vim.opt.hlsearch = false vim.opt.wrap = true vim.opt.showmatch = true -vim.opt.completeopt = { 'menu', 'menuone', 'noselect' } +vim.opt.completeopt = { 'menu', 'menuone', 'noselect', 'noinsert' } +vim.opt.shortmess = vim.opt.shortmess + "c" vim.g.python3_host_prog = '/home/frosty/.dotfiles/nvim/env/bin/python' @@ -85,6 +86,8 @@ nmap("f", "Telescope live_grep") nmap("t", "FloatermToggle") map("t", "t", "FloatermToggle") +nmap("dd", " lua vim.diagnostic.open_float() ") + local augroup = vim.api.nvim_create_augroup("Lspformatting", {}) -- lsp on_attach mappings @@ -142,11 +145,20 @@ lsp.svelte.setup { on_attach = on_attach } local capabilities = vim.lsp.protocol.make_client_capabilities() capabilities.offsetEncoding = { "utf-16" } lsp.clangd.setup { on_attach = on_attach, capabilities = capabilities } -lsp.ts_ls.setup { on_attach = function(client, bufnr) - on_attach(client, bufnr) -end, } +lsp.ts_ls.setup { on_attach = on_attach } lsp.marksman.setup { on_attach = on_attach } -lsp.rust_analyzer.setup { on_attach = on_attach } +lsp.rust_analyzer.setup { on_attach = on_attach, + settings = { + ["rust-analyzer"] = { + checkOnSave = true, + check = { + enable = true, + command = "clippy", + features = "all" + } + } + } +} lsp.lua_ls.setup { on_attach = on_attach, settings = { Lua = { @@ -375,6 +387,15 @@ return require('packer').startup(function(use) } end } + use { + "hedyhli/outline.nvim", + config = function() + nmap("o", "Outline") + require("outline").setup { + -- Your setup opts here (leave empty to use defaults) + } + end, + } use { 'akinsho/bufferline.nvim', tag = "*",