From 36147cfea3726f45c145b63e0c6b9feacca58073 Mon Sep 17 00:00:00 2001 From: servostar Date: Mon, 27 Nov 2023 23:37:34 +0100 Subject: [PATCH] updated config with cokeline --- init.lua | 6 +- lua/{config => core}/autocmds.lua | 0 lua/{config/lazy.lua => core/bootstrap.lua} | 13 +- lua/{config => core}/keymaps.lua | 0 lua/{config => core}/language-server.lua | 8 +- lua/{config => core}/options.lua | 3 +- lua/plugins/bufferline.lua | 24 ---- lua/plugins/cokeline.lua | 80 +++++++++++ lua/plugins/indent-blankline.lua | 22 +-- lua/plugins/lualine.lua | 149 ++++++++++++++------ lua/plugins/navic.lua | 16 ++- lua/plugins/neo-tree.lua | 13 +- lua/plugins/nvim-cmp.lua | 12 +- lua/plugins/nvim-lspconfig.lua | 2 +- lua/plugins/plenary.lua | 3 +- lua/plugins/smooth-scroll.lua | 5 - lua/plugins/symbols-outline.lua | 4 +- lua/plugins/tokyonight.lua | 8 +- 18 files changed, 251 insertions(+), 117 deletions(-) rename lua/{config => core}/autocmds.lua (100%) rename lua/{config/lazy.lua => core/bootstrap.lua} (94%) rename lua/{config => core}/keymaps.lua (100%) rename lua/{config => core}/language-server.lua (70%) rename lua/{config => core}/options.lua (94%) delete mode 100644 lua/plugins/bufferline.lua create mode 100644 lua/plugins/cokeline.lua delete mode 100644 lua/plugins/smooth-scroll.lua diff --git a/init.lua b/init.lua index 2514f9e..88801ba 100644 --- a/init.lua +++ b/init.lua @@ -1,2 +1,4 @@ --- bootstrap lazy.nvim, LazyVim and your plugins -require("config.lazy") +require('core.options') +require('core.keymaps') +require('core.autocmds') +require("core.bootstrap") diff --git a/lua/config/autocmds.lua b/lua/core/autocmds.lua similarity index 100% rename from lua/config/autocmds.lua rename to lua/core/autocmds.lua diff --git a/lua/config/lazy.lua b/lua/core/bootstrap.lua similarity index 94% rename from lua/config/lazy.lua rename to lua/core/bootstrap.lua index 24e041a..c498b45 100644 --- a/lua/config/lazy.lua +++ b/lua/core/bootstrap.lua @@ -2,7 +2,8 @@ local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" if not vim.loop.fs_stat(lazypath) then -- bootstrap lazy.nvim -- stylua: ignore - vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", "--branch=stable", + vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", + "--branch=stable", lazypath }) end vim.opt.rtp:prepend(vim.env.LAZY or lazypath) @@ -46,6 +47,10 @@ require("lazy").setup({ }, }, icons = { + ft = "", + lazy = "󰂠 ", + loaded = "", + not_loaded = "", misc = { dots = "󰇘", }, @@ -63,9 +68,9 @@ require("lazy").setup({ Info = " ", }, git = { - added = " ", - modified = " ", - removed = " ", + added = "+", + modified = "~", + removed = "-", }, kinds = { Array = " ", diff --git a/lua/config/keymaps.lua b/lua/core/keymaps.lua similarity index 100% rename from lua/config/keymaps.lua rename to lua/core/keymaps.lua diff --git a/lua/config/language-server.lua b/lua/core/language-server.lua similarity index 70% rename from lua/config/language-server.lua rename to lua/core/language-server.lua index 979a454..772b866 100644 --- a/lua/config/language-server.lua +++ b/lua/core/language-server.lua @@ -2,7 +2,7 @@ return { lua_ls = { mason = false }, - bash_ls = { + bashls = { mason = false, }, clangd = { @@ -14,4 +14,10 @@ return { pyright = { mason = false }, + html = { + mason = false + }, + gopls = { + mason = false + } } diff --git a/lua/config/options.lua b/lua/core/options.lua similarity index 94% rename from lua/config/options.lua rename to lua/core/options.lua index 1f0a12f..e855e72 100644 --- a/lua/config/options.lua +++ b/lua/core/options.lua @@ -1,5 +1,6 @@ local opt = vim.opt +opt.swapfile = false -- disable swapfiles because they are fucking garbage opt.autowrite = true -- Enable auto write opt.clipboard = "unnamedplus" -- Sync with system clipboard opt.completeopt = "menu,menuone,noselect" @@ -30,7 +31,7 @@ opt.signcolumn = "yes" -- Always show the signcolumn, otherwise it would shi opt.smartcase = false -- Don't ignore case with capitals opt.smartindent = true -- Insert indents automatically opt.spelllang = { "en" } -opt.splitbelow = true -- Put new windows below current +opt.splitbelow = false -- Put new windows below current opt.splitkeep = "screen" opt.splitright = true -- Put new windows right of current opt.tabstop = 4 -- Number of spaces tabs count for diff --git a/lua/plugins/bufferline.lua b/lua/plugins/bufferline.lua deleted file mode 100644 index d3fdb98..0000000 --- a/lua/plugins/bufferline.lua +++ /dev/null @@ -1,24 +0,0 @@ -return { - { - "akinsho/bufferline.nvim", - dependencies = { - 'nvim-tree/nvim-web-devicons' - }, - opts = { - options = { - close_command = function(n) require("mini.bufremove").delete(n, false) end, - always_show_bufferline = true, - numbers = 'none', - separator_style = { "", "" }, - offsets = { - { - filetype = 'neo-tree', - text = 'Explorer', - separator = true - } - }, - - }, - } - } -} diff --git a/lua/plugins/cokeline.lua b/lua/plugins/cokeline.lua new file mode 100644 index 0000000..bd13cb6 --- /dev/null +++ b/lua/plugins/cokeline.lua @@ -0,0 +1,80 @@ +return { + { + "willothy/nvim-cokeline", + config = true, + opts = { + show_if_buffers_are_at_least = 1, + buffers = { + focus_on_delete = "next", + new_buffers_position = 'last', + }, + mappings = { + disable_mouse = false, + }, + default_hl = { + bg = function(buffer) + if buffer.is_focused then + return "Normal" + end + return "ColorColumn" + end, + fg = function(buffer) + if buffer.is_focused then + return "Normal" + end + return "TabLine" + end, + bold = function(buffer) + return buffer.is_focused + end + }, + components = { + { + text = function(buffer) return ' ' .. buffer.devicon.icon end, + fg = function(buffer) return buffer.devicon.color end, + }, + { + text = function(buffer) return ' ' .. buffer.filename .. ' ' end, + }, + { + text = function(buffer) + if buffer.is_modified then + return ' ' + elseif buffer.is_readonly then + return ' ' + else + return '' + end + end + }, + { + text = '󰅖', + on_click = function(_, _, _, _, buffer) + buffer:delete() + end + }, + { + text = ' ', + } + }, + tabs = { + placement = "right", + components = { + { + text = function(tabpage) + return '' .. tabpage.number + end + } + } + }, + sidebar = { + filetype = { "NvimTree", "neo-tree", "SidebarNvim" }, + components = { + { + text = "Explorer", + } + }, + }, + } + } +} diff --git a/lua/plugins/indent-blankline.lua b/lua/plugins/indent-blankline.lua index cd426af..a02443f 100644 --- a/lua/plugins/indent-blankline.lua +++ b/lua/plugins/indent-blankline.lua @@ -9,17 +9,17 @@ return { }, scope = { enabled = false }, exclude = { - filetypes = { - "help", - "alpha", - "dashboard", - "neo-tree", - "Trouble", - "trouble", - "lazy", - "mason", - "notify", - "toggleterm", + filetypes = { + "help", + "alpha", + "dashboard", + "neo-tree", + "Trouble", + "trouble", + "lazy", + "mason", + "notify", + "toggleterm", "lazyterm", }, }, diff --git a/lua/plugins/lualine.lua b/lua/plugins/lualine.lua index 531eaa0..47e7c0e 100644 --- a/lua/plugins/lualine.lua +++ b/lua/plugins/lualine.lua @@ -18,65 +18,128 @@ return { 'packer', 'neogitstatus', -- 'NvimTree', - -- 'Trouble', + 'Trouble', 'alpha', 'lir', - -- 'Outline', + 'Outline', + 'neo-tree', 'spectre_panel', - -- 'toggleterm', + 'toggleterm', + 'qf', + }, + winbar = { + 'help', + 'startify', + 'dashboard', + 'packer', + 'neogitstatus', + 'NvimTree', + 'neo-tree', + 'Trouble', + 'alpha', + 'lir', + 'Outline', + 'spectre_panel', + 'toggleterm', 'qf', } }, - sections = { - lualine_a = { 'mode' }, - lualine_b = { + }, + sections = { + lualine_a = { 'mode' }, + lualine_b = { + { 'branch', - draw_empty = true, + on_click = function(_, _) + vim.defer_fn(function() + vim.cmd("LazyGit") + end, 100) + end + } + }, + lualine_c = { + { + 'diff', + symbols = { + added = icons.git.added, + modified = icons.git.modified, + removed = icons.git.removed + }, + colored = true, + on_click = function(_, _) + vim.defer_fn(function() + vim.cmd("Gdiffsplit") + end, 100) + end }, - lualine_c = { - { - 'diff', - symbols = { added = '+', modified = '~', removed = '-' }, - colored = true, - }, - { - "diagnostics", - sources = { 'nvim_diagnostic' }, - symbols = { - error = icons.diagnostics.Error, - warn = icons.diagnostics.Warn, - info = icons.diagnostics.Info, - hint = icons.diagnostics.Hint, - }, - colored = true - }, - { - 'filename', - file_status = true, - path = 0, - symbols = { - modified = '[+]', -- Text to show when the file is modified. - readonly = '[-]', -- Text to show when the file is non-modifiable or readonly. - unnamed = '[No Name]', -- Text to show for unnamed buffers. - newfile = '[New]', -- Text to show for newly created file before first write - }, + { + "diagnostics", + sources = { 'nvim_diagnostic' }, + symbols = { + error = icons.diagnostics.Error, + warn = icons.diagnostics.Warn, + info = icons.diagnostics.Info, + hint = icons.diagnostics.Hint, }, + colored = true, + on_click = function(_, _) + require("trouble").toggle({ mode = "document_diagnostics" }) + end }, - lualine_x = { - 'encoding', - 'fileformat', - { - 'filetype', - colored = true, + { + 'filename', + file_status = true, + path = 0, + symbols = { + modified = '[+]', -- Text to show when the file is modified. + readonly = '[-]', -- Text to show when the file is non-modifiable or readonly. + unnamed = '[No Name]', -- Text to show for unnamed buffers. + newfile = '[New]', -- Text to show for newly created file before first write } }, - lualine_y = { 'progress' }, - lualine_z = { 'location' }, + }, + lualine_x = { + 'encoding', + 'fileformat', + { + 'filetype', + colored = true, + on_click = function(_, _) + vim.defer_fn(function() + vim.cmd("Telescope filetypes") + end, 100) + end + } + }, + lualine_y = { 'progress' }, + lualine_z = { 'location' }, + }, + winbar = { + lualine_c = { + { + "navic", + color_correction = nil, + navic_opts = { + click = true, + depth_limit = 4, + depth_limit_indicator = "…", + separator = "  ", + icons = require("lazyvim.config").icons.kinds, + lazy_update_context = true, + } + } + } + }, + inactive_winbar = { + lualine_c = { + 'filename', }, }, }, dependencies = { - 'nvim-tree/nvim-web-devicons' + 'nvim-tree/nvim-web-devicons', + "SmiteshP/nvim-navic", + 'kdheepak/lazygit.nvim' } }, } diff --git a/lua/plugins/navic.lua b/lua/plugins/navic.lua index 90dbc43..28259aa 100644 --- a/lua/plugins/navic.lua +++ b/lua/plugins/navic.lua @@ -1,6 +1,7 @@ return { { "SmiteshP/nvim-navic", + lazy = true, init = function() vim.g.navic_silence = true require("lazyvim.util").lsp.on_attach(function(client, buffer) @@ -9,11 +10,14 @@ return { end end) end, - opts = { - highlight = true, - icons = require("lazyvim.config").icons.kinds, - separator = "  ", - depth_limit = 5, - } + opts = function() + return { + separator = " ", + highlight = true, + depth_limit = 5, + icons = require("lazyvim.config").icons.kinds, + lazy_update_context = true, + } + end, } } diff --git a/lua/plugins/neo-tree.lua b/lua/plugins/neo-tree.lua index 49450f5..fe28e3d 100644 --- a/lua/plugins/neo-tree.lua +++ b/lua/plugins/neo-tree.lua @@ -31,15 +31,15 @@ return { git_status = { symbols = { -- Change type - added = "", -- or "✚", but this is redundant info if you use git_status_colors on the name - modified = "", -- or "", but this is redundant info if you use git_status_colors on the name - deleted = "", -- this can only be used in the git_status source + added = "+", -- or "✚", but this is redundant info if you use git_status_colors on the name + modified = "M", -- or "", but this is redundant info if you use git_status_colors on the name + deleted = "D", -- this can only be used in the git_status source renamed = "󰁕", -- this can only be used in the git_status source -- Status type untracked = "", ignored = "", - unstaged = "󰄱 ", - staged = " ", + unstaged = "U", + staged = "S", conflict = " ", } }, @@ -47,6 +47,9 @@ return { symbol = "+", highlight = "NeoTreeModified", }, + }, + filesystem = { + use_libuv_file_watcher = true } } } diff --git a/lua/plugins/nvim-cmp.lua b/lua/plugins/nvim-cmp.lua index 1ac4cf5..3c83810 100644 --- a/lua/plugins/nvim-cmp.lua +++ b/lua/plugins/nvim-cmp.lua @@ -9,17 +9,15 @@ return { window = { completion = { border = "rounded", + scrollbar = false, + winhighlight = "Normal:CmpPmenu,FloatBorder:CmpPmenu,Search:None" }, documentation = { - border = "rounded" + border = "rounded", + scrollbar = false, + winhighlight = "Normal:CmpPmenu,FloatBorder:CmpPmenu,Search:None" }, }, - completion = { - completeopt = "menu,menuone,noinsert", - winhighlight = "Normal:Pmenu,FloatBorder:Pmenu,Search:None", - col_offset = -3, - side_padding = 0, - }, snippet = { expand = function(args) require("luasnip").lsp_expand(args.body) diff --git a/lua/plugins/nvim-lspconfig.lua b/lua/plugins/nvim-lspconfig.lua index a0083d1..98e1d15 100644 --- a/lua/plugins/nvim-lspconfig.lua +++ b/lua/plugins/nvim-lspconfig.lua @@ -39,7 +39,7 @@ return { formatting_options = nil, timeout_ms = nil, }, - servers = require("config.language-server"), + servers = require("core.language-server"), setup = { } }, diff --git a/lua/plugins/plenary.lua b/lua/plugins/plenary.lua index 2b0f8b0..894ed2a 100644 --- a/lua/plugins/plenary.lua +++ b/lua/plugins/plenary.lua @@ -2,4 +2,5 @@ return { { 'nvim-lua/plenary.nvim' } -} \ No newline at end of file +} + diff --git a/lua/plugins/smooth-scroll.lua b/lua/plugins/smooth-scroll.lua deleted file mode 100644 index ff0e7db..0000000 --- a/lua/plugins/smooth-scroll.lua +++ /dev/null @@ -1,5 +0,0 @@ -return { - { - "karb94/neoscroll.nvim" - } -} diff --git a/lua/plugins/symbols-outline.lua b/lua/plugins/symbols-outline.lua index 98db369..aa8658a 100644 --- a/lua/plugins/symbols-outline.lua +++ b/lua/plugins/symbols-outline.lua @@ -3,9 +3,9 @@ return { 'simrat39/symbols-outline.nvim', opts = { show_guides = true, - fold_markers = { '', '' }, autofold_depth = 3, - show_symbol_details = false + show_symbol_details = false, + show_numbers = false, } } } diff --git a/lua/plugins/tokyonight.lua b/lua/plugins/tokyonight.lua index 6208676..4ff4698 100644 --- a/lua/plugins/tokyonight.lua +++ b/lua/plugins/tokyonight.lua @@ -5,12 +5,12 @@ return { priority = 1000, opts = { style = "night", - transparent = true, + transparent = false, styles = { - sidebars = "transparent", - floats = "transparent", + sidebars = "dark", + floats = "normal", }, - sidebars = { "qf", "NvimTree", "help" }, + sidebars = { "qf", "help", "neo-tree", "Outline" }, }, }, -- Configure LazyVim to load gruvbox