diff --git a/nvim/lua/keymaps.lua b/nvim/lua/keymaps.lua index e091b8a..805c968 100644 --- a/nvim/lua/keymaps.lua +++ b/nvim/lua/keymaps.lua @@ -3,7 +3,7 @@ local g = vim.g g.mapleader = " " g.maplocalleader = " " -local keymaps = { +require("utils").add_keymaps({ n = { -- Navigation [""] = { @@ -58,7 +58,7 @@ local keymaps = { }, }, i = { }, - v = { + v = { [""] = { cmd = "v:count || mode(1)[0:1] == \"no\" ? \"k\" : \"gk\"", opts = { @@ -98,6 +98,4 @@ local keymaps = { }, }, }, -} - -require("utils").add_keymaps(keymaps) +}) diff --git a/nvim/lua/lualine_extension_lspsaga.lua b/nvim/lua/lualine_extension_lspsaga.lua new file mode 100644 index 0000000..43c2d29 --- /dev/null +++ b/nvim/lua/lualine_extension_lspsaga.lua @@ -0,0 +1,9 @@ +local M = {} + +function M.get_breadcrumbs() + local breadcrumbs = require("lspsaga.symbol.winbar").get_bar() + -- Return breadcrumbs if the string exists and is not empty, otherwise, get the filename and return it + return breadcrumbs and breadcrumbs ~= "" and breadcrumbs or vim.fn.expand("%:t") +end + +return M diff --git a/nvim/lua/plugs/lspsaga.lua b/nvim/lua/plugs/lspsaga.lua new file mode 100644 index 0000000..50428b0 --- /dev/null +++ b/nvim/lua/plugs/lspsaga.lua @@ -0,0 +1,65 @@ +return { + "LarssonMartin1998/lspsaga.nvim", + branch = "improved_winbar", + dependencies = { + "nvim-treesitter/nvim-treesitter", + "nvim-tree/nvim-web-devicons", + }, + config = function() + require("lspsaga").setup({ + symbol_in_winbar = { + enable = false, + separator = " › ", + hide_keyword = true, + ignore_patterns = nil, + show_file = true, + folder_level = 3, + color_mode = true, + dely = 300, + show_nodes = true, + max_nodes = 3, + }, + implement = { + enable = false, + }, + }) + + require("utils").add_keymaps({ + n = { + [""] = { + cmd = ":Lspsaga diagnostic_jump_next" + }, + [""] = { + cmd = ":Lspsaga diagnostic_jump_prev" + }, + ["K"] = { + cmd = ":Lspsaga hover_doc" + }, + ["lo"] = { + cmd = ":Lspsaga outline" + }, + ["lr"] = { + cmd = ":Lspsaga rename" + }, + ["h"] = { + cmd = ":Lspsaga term_toggle" + }, + ["lf"] = { + cmd = ":Lspsaga finder" + }, + ["lpt"] = { + cmd = ":Lspsaga peek_type_definition" + }, + ["lph"] = { + cmd = ":Lspsaga peek_definition" + }, + ["ca"] = { + cmd = ":Lspsaga code_action" + }, + ["lc"] = { + cmd = ":Lspsaga incoming_calls" + }, + } + }) + end, +} diff --git a/nvim/lua/plugs/lualine.lua b/nvim/lua/plugs/lualine.lua index dbe082b..9f63ef2 100644 --- a/nvim/lua/plugs/lualine.lua +++ b/nvim/lua/plugs/lualine.lua @@ -3,7 +3,31 @@ return { dependencies = { "nvim-tree/nvim-web-devicons" }, - opts = { - theme = "tokyonight-storm", - }, + config = function() + require("lualine").setup { + options = { + theme = "tokyonight", + section_separators = {"", ""}, + component_separators = {"", ""}, + icons_enabled = true, + }, + sections = { + lualine_a = {"mode"}, + lualine_b = {"branch"}, + lualine_c = { "require(\"lualine_extension_lspsaga\").get_breadcrumbs()" }, + lualine_x = {"encoding", "fileformat", "filetype"}, + lualine_y = {"progress"}, + lualine_z = {"location"} + }, + inactive_sections = { + lualine_a = {}, + lualine_b = {}, + lualine_c = { "filename" }, + lualine_x = {"location"}, + lualine_y = {}, + lualine_z = {} + }, + tabline = {}, + } + end } diff --git a/nvim/lua/plugs/telescope.lua b/nvim/lua/plugs/telescope.lua index 8bf0b0b..ad39f63 100644 --- a/nvim/lua/plugs/telescope.lua +++ b/nvim/lua/plugs/telescope.lua @@ -8,7 +8,7 @@ return { require("telescope").setup({ }) require("telescope").load_extension("fzf") - local keymaps = { + require("utils").add_keymaps({ n = { -- File search ["to"] = { @@ -21,16 +21,16 @@ return { cmd = ":Telescope live_grep find_command=rg,--ignore-file,.gitignore,--exclude,*.git,--exclude,*.svn,--exclude,*.vs,--exclude,*.idea", }, -- Git - ["gc"] = { + ["gc"] = { cmd = " Telescope git_commits ", }, - ["gs"] = { + ["gs"] = { cmd = " Telescope git_status ", }, - ["gh"] = { + ["gh"] = { cmd = " Telescope git_bcommits ", }, - ["gb"] = { + ["gb"] = { cmd = " Telescope git_branches ", }, -- Misc @@ -38,8 +38,7 @@ return { cmd = " Telescope marks ", } } - } + }) - require("utils").add_keymaps(keymaps) end, } diff --git a/nvim/lua/vim_opt.lua b/nvim/lua/vim_opt.lua index a0f88d5..faae4bd 100644 --- a/nvim/lua/vim_opt.lua +++ b/nvim/lua/vim_opt.lua @@ -9,7 +9,7 @@ opt.clipboard = "unnamedplus" -- Highlight the currently selected row opt.cursorline = true opt.cursorlineopt = "both" - + -- Indenting opt.expandtab = true opt.smartindent = true @@ -17,22 +17,22 @@ opt.breakindent = true opt.shiftwidth = 4 opt.tabstop = 4 opt.softtabstop = 4 - + -- Disable home screen opt.shortmess:append("sI") - + -- Signcolumn opt.signcolumn = "yes:1" -- Adds a spacing to the left which can contain gutter icons opt.fillchars = { eob = " " } -- Remove the fill character for empty lines which defaults to: "~" - + -- Search opt.ignorecase = true opt.smartcase = true opt.incsearch = true - + -- Disable mouse support opt.mouse = "" - + -- Numbers opt.number = true opt.relativenumber = true @@ -52,4 +52,7 @@ opt.swapfile = false opt.splitright = true opt.splitbelow = true + -- Removes the extra command line bar at the bottom, using lualine instead +opt.cmdheight = 0 + return opt