From b5a5a98cff4b88c6f84a3ba1b14c1a933282a9c7 Mon Sep 17 00:00:00 2001 From: Tine Jozelj Date: Sun, 28 Jan 2024 18:41:33 +0100 Subject: [PATCH] feat: more changes --- nvim/init.vim | 35 ++++++++++++++++++++--------------- nvim/lua/code_helpers.lua | 32 +++++++++++++++++++++++++++++++- nvim/lua/code_look.lua | 8 ++++++++ nvim/lua/keybindings.lua | 22 +++++++++++++++++++--- 4 files changed, 78 insertions(+), 19 deletions(-) diff --git a/nvim/init.vim b/nvim/init.vim index a689c17..aac7e00 100644 --- a/nvim/init.vim +++ b/nvim/init.vim @@ -15,7 +15,7 @@ Plug 'ojroques/vim-oscyank' Plug 'tpope/vim-obsession' Plug 'tmux-plugins/vim-tmux-focus-events' " Look -Plug 'vim-airline/vim-airline' +Plug 'nvim-lualine/lualine.nvim' Plug 'sainnhe/edge' Plug 'Yggdroot/indentLine' Plug 'koenverburg/peepsight.nvim' @@ -48,6 +48,7 @@ Plug 'hrsh7th/cmp-cmdline' Plug 'hrsh7th/cmp-buffer' Plug 'hrsh7th/cmp-path' Plug 'hrsh7th/nvim-cmp' +Plug 'onsails/lspkind.nvim' Plug 'folke/trouble.nvim' call plug#end() @@ -174,17 +175,21 @@ let g:edge_diagnostic_line_highlight = 1 let g:edge_better_performance = 1 colorscheme edge -if !exists('g:airline_symbols') - let g:airline_symbols = {} -endif -let g:airline_symbols.branch = '' -let g:airline_symbols.dirty=' ' -let g:airline_symbols.linenr = '☰ ' -let g:airline_symbols.maxlinenr = '' -let g:airline_left_sep='' -let g:airline_right_sep='' - -let g:airline_detect_spell=0 -let g:airline#extensions#coc#enabled = 1 -let g:airline#parts#ffenc#skip_expected_string='utf-8[unix]' -let g:airline_theme = 'edge' +lua << END +require('lualine').setup({ + options = { + theme = 'edge', + section_separators = {'', ''}, + component_separators = {'', ''}, + icons_enabled = true, + }, + sections = { + lualine_a = {'mode'}, + lualine_b = {'branch', 'diff'}, + lualine_c = {'filename'}, + lualine_x = {'diagnostics', 'filetype'}, + lualine_y = {'progress'}, + lualine_z = {'location'} + }, +}) +END diff --git a/nvim/lua/code_helpers.lua b/nvim/lua/code_helpers.lua index 6ed3b66..8591afc 100644 --- a/nvim/lua/code_helpers.lua +++ b/nvim/lua/code_helpers.lua @@ -17,7 +17,26 @@ require("codeium").setup({}) require("cmp_git").setup() local cmp = require("cmp") +local lspkind = require("lspkind") +lspkind.init({ + symbol_map = { Copilot = "", Codeium = "" }, +}) +vim.opt.completeopt = "menu,menuone,noselect" cmp.setup({ + formatting = { + fields = { "abbr", "kind" }, + format = lspkind.cmp_format({ + mode = "symbol_text", + maxwidth = function() + return math.min(40, math.floor(vim.o.columns * 0.4)) + end, + ellipsis_char = "...", + before = function(entry, item) + item.menu = "" + return item + end, + }), + }, snippet = { -- REQUIRED - you must specify a snippet engine expand = function(args) @@ -36,7 +55,18 @@ cmp.setup({ [""] = cmp.mapping.scroll_docs(4), [""] = cmp.mapping.complete(), [""] = cmp.mapping.abort(), - [""] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. + [""] = cmp.mapping.confirm({ select = true }), + [""] = cmp.mapping(function(fallback) + local col = vim.fn.col(".") - 1 + + if cmp.visible() then + cmp.select_next_item(select_opts) + elseif col == 0 or vim.fn.getline("."):sub(col, col):match("%s") then + fallback() + else + cmp.complete() + end + end, { "i", "s" }), }), sources = cmp.config.sources({ { name = "copilot" }, diff --git a/nvim/lua/code_look.lua b/nvim/lua/code_look.lua index 82057f7..b930d94 100644 --- a/nvim/lua/code_look.lua +++ b/nvim/lua/code_look.lua @@ -64,4 +64,12 @@ require("gitsigns").setup({ delay = 500, virt_text_pos = "eol", }, + signs = { + add = { text = "+" }, + change = { text = "~" }, + delete = { text = "-" }, + topdelete = { text = "-" }, + changedelete = { text = "~" }, + untracked = { text = "┆" }, + }, }) diff --git a/nvim/lua/keybindings.lua b/nvim/lua/keybindings.lua index 2529420..6a7aba2 100644 --- a/nvim/lua/keybindings.lua +++ b/nvim/lua/keybindings.lua @@ -1,7 +1,13 @@ require("commander").setup({ + prompt_title = "Help | Keybindings", + components = { + "DESC", + "KEYS", + }, integration = { telescope = { enable = true, + theme = require("telescope.themes").commander, }, }, }) @@ -45,12 +51,22 @@ vim.api.nvim_create_autocmd("LspAttach", { end, keys = { "n", "f", opts }, }, - { desc = "LSP References", cmd = "Telescope lsp_references", keys = { "n", "gr" } }, { desc = "LSP Diagnostics", - cmd = "Telescope diagnostics bufnr=0", - keys = { "n", "fcdi" }, + cmd = function() + require("trouble").toggle("document_diagnostics") + end, + keys = { "n", "d" }, }, + { + desc = "LSP Diagnostics whole workspace", + cmd = function() + require("trouble").toggle("workspace_diagnostics") + end, + keys = { "n", "dw" }, + }, + { desc = "LSP References", cmd = "Telescope lsp_references", keys = { "n", "gr" } }, + { desc = "LSP Definitions", cmd = "Telescope lsp_definitions", keys = { "n", "fcde" } }, { desc = "LSP Document Symbols",