diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua index 8abd31c..d66f680 100644 --- a/.config/nvim/init.lua +++ b/.config/nvim/init.lua @@ -3,4 +3,3 @@ require("core.keymaps") require("core.autocmds") require('core.package_manager') require('core.theme') -require('winbar') diff --git a/.config/nvim/lua/core/theme.lua b/.config/nvim/lua/core/theme.lua index 5f9b030..3763538 100644 --- a/.config/nvim/lua/core/theme.lua +++ b/.config/nvim/lua/core/theme.lua @@ -1,6 +1,5 @@ vim.g.gruvbox_material_better_performance=1 vim.g.gruvbox_material_background="hard" vim.g.gruvbox_material_foreground="original" -vim.g.gruvbox_material_transparent_background=2 vim.opt.background="dark" vim.cmd('colorscheme gruvbox-material') diff --git a/.config/nvim/lua/core/variables.lua b/.config/nvim/lua/core/variables.lua index 0d143cd..e9c628e 100644 --- a/.config/nvim/lua/core/variables.lua +++ b/.config/nvim/lua/core/variables.lua @@ -47,7 +47,3 @@ vim.opt.signcolumn = "yes" vim.opt.autoread = true -- disable swapfile vim.opt.swapfile = false --- disable statusline -vim.o.laststatus = 1 --- border on floating windows -vim.o.winborder = nil diff --git a/.config/nvim/lua/plugins/lsp.lua b/.config/nvim/lua/plugins/lsp.lua index 80f1dbb..1ff5fdd 100644 --- a/.config/nvim/lua/plugins/lsp.lua +++ b/.config/nvim/lua/plugins/lsp.lua @@ -49,29 +49,6 @@ return { local fzflua = require("fzf-lua") local conform = require("conform") - local function jumpWithVirtLineDiags(jumpCount) - pcall(vim.api.nvim_del_augroup_by_name, "jumpWithVirtLineDiags") -- prevent autocmd for repeated jumps - - vim.diagnostic.jump { count = jumpCount } - - local initialVirtTextConf = vim.diagnostic.config().virtual_text - vim.diagnostic.config { - virtual_text = false, - virtual_lines = { current_line = true }, - } - - vim.defer_fn(function() -- deferred to not trigger by jump itself - vim.api.nvim_create_autocmd("CursorMoved", { - desc = "User(once): Reset diagnostics virtual lines", - once = true, - group = vim.api.nvim_create_augroup("jumpWithVirtLineDiags", {}), - callback = function() - vim.diagnostic.config { virtual_lines = false, virtual_text = initialVirtTextConf } - end, - }) - end, 1) - end - local rename_func = function() return ":IncRename " .. vim.fn.expand("") end @@ -89,8 +66,8 @@ return { vim.keymap.set("n", "D", vim.lsp.buf.type_definition, bufopts) vim.keymap.set("n", "rn", rename_func, bufopts_expr) vim.keymap.set({ "n", "v" }, "ca", vim.lsp.buf.code_action, bufopts) - vim.keymap.set("n", "ge", function() jumpWithVirtLineDiags(1) end, bufopts) - vim.keymap.set("n", "gE", function() jumpWithVirtLineDiags(-1) end, bufopts) + vim.keymap.set("n", "ge", vim.diagnostic.goto_next, bufopts) + vim.keymap.set("n", "gE", vim.diagnostic.goto_prev, bufopts) vim.keymap.set("n", "fo", function() conform.format({ lsp_fallback = true }) end, bufopts) end, }) diff --git a/.config/nvim/lua/plugins/misc.lua b/.config/nvim/lua/plugins/misc.lua index b6c9899..4d2182c 100644 --- a/.config/nvim/lua/plugins/misc.lua +++ b/.config/nvim/lua/plugins/misc.lua @@ -50,7 +50,6 @@ return { { "afonsofrancof/worktrees.nvim", dev = true, - event = "VeryLazy", opts = { mappings = { create = "wtc", diff --git a/.config/nvim/lua/plugins/statusline.lua b/.config/nvim/lua/plugins/statusline.lua new file mode 100644 index 0000000..0b3d5e7 --- /dev/null +++ b/.config/nvim/lua/plugins/statusline.lua @@ -0,0 +1,24 @@ +return { + { + 'nvim-lualine/lualine.nvim', + dependencies = { 'nvim-tree/nvim-web-devicons' }, + opts = { + sections = { + lualine_a = { 'mode' }, + lualine_b = { 'branch', 'diff', 'diagnostics' }, + lualine_c = { { 'filename', path = 1 } }, + lualine_x = { 'filetype' }, + lualine_y = { 'progress' }, + lualine_z = { 'location' } + }, + inactive_sections = { + lualine_a = {}, + lualine_b = {}, + lualine_c = { 'filename' }, + lualine_x = { 'location' }, + lualine_y = {}, + lualine_z = {} + }, + } + } +} diff --git a/.config/nvim/lua/winbar.lua b/.config/nvim/lua/winbar.lua deleted file mode 100644 index 18060d2..0000000 --- a/.config/nvim/lua/winbar.lua +++ /dev/null @@ -1,81 +0,0 @@ -local M = {} -local icons = require("mini.icons") - ---- Window bar that shows the current file path (in a fancy way). ----@return string -function M.render() - -- Get the path and expand variables. - local path = vim.fs.normalize(vim.fn.expand '%:p' --[[@as string]]) - - -- No special styling for diff views. - if vim.startswith(path, 'diffview') then - return string.format('%%#Winbar#%s', path) - end - - -- Replace slashes by arrows. - local separator = ' %#WinbarSeparator# ' - - local prefix, prefix_path = '', '' - local folder_icon = '' - - -- If the window gets too narrow, shorten the path and drop the prefix. - if vim.api.nvim_win_get_width(0) < math.floor(vim.o.columns / 3) then - path = vim.fn.pathshorten(path) - else - -- For some special folders, add a prefix instead of the full path (making - -- sure to pick the longest prefix). - ---@type table - local special_dirs = { - DOTFILES = vim.env.XDG_CONFIG_HOME, - GITS = vim.env.HOME .. '/gits', - HOME = vim.env.HOME, - PROJECTS = vim.env.HOME .. '/projects', - } - for dir_name, dir_path in pairs(special_dirs) do - if vim.startswith(path, vim.fs.normalize(dir_path)) and #dir_path > #prefix_path then - prefix, prefix_path, folder_icon = dir_name, dir_path, icons.get('file',path) - end - end - if prefix ~= '' then - path = path:gsub('^' .. prefix_path, '') - prefix = string.format('%%#WinBarFile#%s %s%s', folder_icon, prefix, separator) - end - end - - -- Remove leading slash. - path = path:gsub('^/', '') - - vim.api.nvim_set_hl(0, "Winbar", { link = "Normal" }) - vim.api.nvim_set_hl(0, "WinbarSeparator", { link = "Normal" }) - vim.api.nvim_set_hl(0, "WinBarFile", { link = "Normal" }) - - return table.concat { - ' ', - prefix, - table.concat( - vim.iter(vim.split(path, '/')) - :map(function(segment) - return string.format('%%#Winbar#%s', segment) - end) - :totable(), - separator - ), - } -end - -vim.api.nvim_create_autocmd('BufWinEnter', { - group = vim.api.nvim_create_augroup('afonso/winbar', { clear = true }), - desc = 'Attach winbar', - callback = function(args) - if - not vim.api.nvim_win_get_config(0).zindex -- Not a floating window - and vim.bo[args.buf].buftype == '' -- Normal buffer - and vim.api.nvim_buf_get_name(args.buf) ~= '' -- Has a file name - and not vim.wo[0].diff -- Not in diff mode - then - vim.wo.winbar = "%{%v:lua.require'winbar'.render()%}" - end - end, -}) - -return M diff --git a/.local/bin/change-theme.sh b/.local/bin/change-theme.sh index cb3c8bd..95af692 100755 --- a/.local/bin/change-theme.sh +++ b/.local/bin/change-theme.sh @@ -37,7 +37,6 @@ themes[gruvbox-original-hard-dark]=\ vim.g.gruvbox_material_better_performance=1 vim.g.gruvbox_material_background=\"hard\" vim.g.gruvbox_material_foreground=\"original\" -vim.g.gruvbox_material_transparent_background=2 vim.opt.background=\"dark\"" kitty_theme="Gruvbox Dark Hard"' @@ -53,7 +52,6 @@ themes[gruvbox-original-medium-light]=\ vim.g.gruvbox_material_better_performance=1 vim.g.gruvbox_material_background=\"medium\" vim.g.gruvbox_material_foreground=\"original\" -vim.g.gruvbox_material_transparent_background=2 vim.opt.background=\"light\"" kitty_theme="Gruvbox Light Medium"' @@ -69,7 +67,6 @@ themes[gruvbox-material-hard-dark]=\ vim.g.gruvbox_material_better_performance=1 vim.g.gruvbox_material_background=\"hard\" vim.g.gruvbox_material_foreground=\"material\" -vim.g.gruvbox_material_transparent_background=2 vim.opt.background=\"dark\"" kitty_theme="Gruvbox Material Dark Hard"' @@ -85,7 +82,6 @@ themes[gruvbox-material-medium-dark]=\ vim.g.gruvbox_material_better_performance=1 vim.g.gruvbox_material_background=\"medium\" vim.g.gruvbox_material_foreground=\"material\" -vim.g.gruvbox_material_transparent_background=2 vim.opt.background=\"dark\"" kitty_theme="Gruvbox Material Dark Medium"' @@ -101,7 +97,6 @@ themes[gruvbox-material-soft-dark]=\ vim.g.gruvbox_material_better_performance=1 vim.g.gruvbox_material_background=\"soft\" vim.g.gruvbox_material_foreground=\"material\" -vim.g.gruvbox_material_transparent_background=2 vim.opt.background=\"dark\"" kitty_theme="Gruvbox Material Dark Soft"' @@ -117,7 +112,6 @@ themes[gruvbox-material-hard-light]=\ vim.g.gruvbox_material_better_performance=1 vim.g.gruvbox_material_background=\"hard\" vim.g.gruvbox_material_foreground=\"material\" -vim.g.gruvbox_material_transparent_background=2 vim.opt.background=\"light\"" kitty_theme="Gruvbox Material Light Hard"' @@ -133,7 +127,6 @@ themes[gruvbox-material-medium-light]=\ vim.g.gruvbox_material_better_performance=1 vim.g.gruvbox_material_background=\"medium\" vim.g.gruvbox_material_foreground=\"material\" -vim.g.gruvbox_material_transparent_background=2 vim.opt.background=\"light\"" kitty_theme="Gruvbox Material Light Medium"' @@ -149,7 +142,6 @@ themes[gruvbox-material-soft-light]=\ vim.g.gruvbox_material_better_performance=1 vim.g.gruvbox_material_background=\"soft\" vim.g.gruvbox_material_foreground=\"material\" -vim.g.gruvbox_material_transparent_background=2 vim.opt.background=\"light\"" kitty_theme="Gruvbox Material Light Soft"'