From 491ba00fd2207e631f23d17c14d192c6ac3f036b Mon Sep 17 00:00:00 2001 From: slezakIT Date: Fri, 12 Apr 2024 21:37:12 +0200 Subject: [PATCH] redo some code --- init.lua | 12 --- lazy-lock.json | 1 - lua/custom/plugins/barbar.lua | 5 + lua/custom/plugins/neotree.lua | 5 + lua/custom/plugins/scrollbar.lua | 146 +++++++++++++++++++++++++++++- lua/custom/plugins/toggleterm.lua | 12 ++- 6 files changed, 166 insertions(+), 15 deletions(-) diff --git a/init.lua b/init.lua index d5e25d3a..89931819 100644 --- a/init.lua +++ b/init.lua @@ -379,18 +379,6 @@ require('lazy').setup({ vim.keymap.set('n', 'sr', builtin.resume, { desc = '[S]earch [R]esume' }) vim.keymap.set('n', 's.', builtin.oldfiles, { desc = '[S]earch Recent Files ("." for repeat)' }) vim.keymap.set('n', '', builtin.buffers, { desc = '[ ] Find existing buffers' }) - -- Toggleterm Plugin - vim.keymap.set('n', 't', 'ToggleTerm direction="float"', { desc = '[T]oggle [T]erminal' }) - vim.keymap.set('n', 'tt', 'ToggleTerm direction="float"', { desc = '[T]oggle [T]erminal' }) - - -- Barbar Plugin - vim.keymap.set('n', 'tn', 'BufferNext', { desc = '[N]ext Tab' }) - vim.keymap.set('n', 'tp', 'BufferPrevious', { desc = '[P]revious Tab' }) - vim.keymap.set('n', '', 'BufferClose') - vim.keymap.set('n', '', 'BufferPick') - -- Neotree: - vim.keymap.set('n', 'nt', 'Neotree toggle', { desc = '[N]eo[t]ree toggle' }) - vim.keymap.set('n', 'ntr', 'Neotree reveal', { desc = 'N[E]eo[t]ree toggle cu[r]rent' }) -- Slightly advanced example of overriding default behavior and theme vim.keymap.set('n', '/', function() -- You can pass additional configuration to Telescope to change the theme, layout, etc. diff --git a/lazy-lock.json b/lazy-lock.json index 16c81d7a..8d64d45e 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -6,7 +6,6 @@ "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, "cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" }, "conform.nvim": { "branch": "master", "commit": "9d5ba06d6ee7418c674f498634617416d15b6239" }, - "dashboard-nvim": { "branch": "master", "commit": "681300934baf36f6184ca41f0b26aed22056d4ee" }, "fidget.nvim": { "branch": "main", "commit": "1ba38e4cbb24683973e00c2e36f53ae64da38ef5" }, "gitsigns.nvim": { "branch": "main", "commit": "c097cb255096f333e14d341082a84f572b394fa2" }, "gruvbox.nvim": { "branch": "main", "commit": "6e4027ae957cddf7b193adfaec4a8f9e03b4555f" }, diff --git a/lua/custom/plugins/barbar.lua b/lua/custom/plugins/barbar.lua index 52879228..f2a6fd3a 100644 --- a/lua/custom/plugins/barbar.lua +++ b/lua/custom/plugins/barbar.lua @@ -7,6 +7,11 @@ return { }, init = function() vim.g.barbar_auto_setup = false + -- Barbar Plugin + vim.keymap.set('n', 'tn', 'BufferNext', { desc = '[N]ext Tab' }) + vim.keymap.set('n', 'tp', 'BufferPrevious', { desc = '[P]revious Tab' }) + vim.keymap.set('n', '', 'BufferClose') + vim.keymap.set('n', '', 'BufferPick') end, opts = { -- lazy.nvim will automatically call setup for you. put your options here, anything missing will use the default: diff --git a/lua/custom/plugins/neotree.lua b/lua/custom/plugins/neotree.lua index e6bf854f..01fd0bd5 100644 --- a/lua/custom/plugins/neotree.lua +++ b/lua/custom/plugins/neotree.lua @@ -6,6 +6,11 @@ return { 'nvim-tree/nvim-web-devicons', -- not strictly required, but recommended 'MunifTanjim/nui.nvim', }, + init = function() + -- Neotree: + vim.keymap.set('n', 'nt', 'Neotree toggle', { desc = '[N]eo[t]ree toggle' }) + vim.keymap.set('n', 'ntr', 'Neotree reveal', { desc = 'N[E]eo[t]ree toggle cu[r]rent' }) + end, config = function() require('neo-tree').setup { filesystem = { diff --git a/lua/custom/plugins/scrollbar.lua b/lua/custom/plugins/scrollbar.lua index 3cbd8f6d..a59801b3 100644 --- a/lua/custom/plugins/scrollbar.lua +++ b/lua/custom/plugins/scrollbar.lua @@ -1,5 +1,149 @@ return { 'petertriho/nvim-scrollbar', version = '*', - config = true, + config = { + show = true, + show_in_active_only = false, + set_highlights = true, + folds = 1000, -- handle folds, set to number to disable folds if no. of lines in buffer exceeds this + max_lines = false, -- disables if no. of lines in buffer exceeds this + hide_if_all_visible = true, -- Hides everything if all lines are visible + throttle_ms = 100, + handle = { + text = ' ', + blend = 30, -- Integer between 0 and 100. 0 for fully opaque and 100 to full transparent. Defaults to 30. + color = nil, + color_nr = nil, -- cterm + highlight = 'CursorColumn', + hide_if_all_visible = true, -- Hides handle if all lines are visible + }, + marks = { + Cursor = { + text = '•', + priority = 0, + gui = nil, + color = nil, + cterm = nil, + color_nr = nil, -- cterm + highlight = 'Normal', + }, + Search = { + text = { '-', '=' }, + priority = 1, + gui = nil, + color = nil, + cterm = nil, + color_nr = nil, -- cterm + highlight = 'Search', + }, + Error = { + text = { '-', '=' }, + priority = 2, + gui = nil, + color = nil, + cterm = nil, + color_nr = nil, -- cterm + highlight = 'DiagnosticVirtualTextError', + }, + Warn = { + text = { '-', '=' }, + priority = 3, + gui = nil, + color = nil, + cterm = nil, + color_nr = nil, -- cterm + highlight = 'DiagnosticVirtualTextWarn', + }, + Info = { + text = { '-', '=' }, + priority = 4, + gui = nil, + color = nil, + cterm = nil, + color_nr = nil, -- cterm + highlight = 'DiagnosticVirtualTextInfo', + }, + Hint = { + text = { '-', '=' }, + priority = 5, + gui = nil, + color = nil, + cterm = nil, + color_nr = nil, -- cterm + highlight = 'DiagnosticVirtualTextHint', + }, + Misc = { + text = { '-', '=' }, + priority = 6, + gui = nil, + color = nil, + cterm = nil, + color_nr = nil, -- cterm + highlight = 'Normal', + }, + GitAdd = { + text = '┆', + priority = 7, + gui = nil, + color = nil, + cterm = nil, + color_nr = nil, -- cterm + highlight = 'GitSignsAdd', + }, + GitChange = { + text = '┆', + priority = 7, + gui = nil, + color = nil, + cterm = nil, + color_nr = nil, -- cterm + highlight = 'GitSignsChange', + }, + GitDelete = { + text = '▁', + priority = 7, + gui = nil, + color = nil, + cterm = nil, + color_nr = nil, -- cterm + highlight = 'GitSignsDelete', + }, + }, + excluded_buftypes = { + 'terminal', + }, + excluded_filetypes = { + 'cmp_docs', + 'cmp_menu', + 'noice', + 'prompt', + 'TelescopePrompt', + }, + autocmd = { + render = { + 'BufWinEnter', + 'TabEnter', + 'TermEnter', + 'WinEnter', + 'CmdwinLeave', + 'TextChanged', + 'VimResized', + 'WinScrolled', + }, + clear = { + 'BufWinLeave', + 'TabLeave', + 'TermLeave', + 'WinLeave', + }, + }, + handlers = { + cursor = false, + diagnostic = true, + gitsigns = false, -- Requires gitsigns + handle = true, + search = false, -- Requires hlslens + ale = false, -- Requires ALE + }, + }, } diff --git a/lua/custom/plugins/toggleterm.lua b/lua/custom/plugins/toggleterm.lua index 495ec858..0f0f4d3f 100644 --- a/lua/custom/plugins/toggleterm.lua +++ b/lua/custom/plugins/toggleterm.lua @@ -1 +1,11 @@ -return { 'akinsho/toggleterm.nvim', version = '*', config = true } +return { + 'akinsho/toggleterm.nvim', + version = '*', + init = function() + -- Toggleterm Plugin + vim.keymap.set('n', 't', '1ToggleTerm name="floater" direction="float"', { desc = '[T]oggle [T]erminal' }) + vim.keymap.set('n', 'tt', '2ToggleTerm name="horizont" direction="horizontal"', { desc = '[T]oggle [T]erminal' }) + vim.keymap.set('n', 'tl', 'TermSelect', { desc = '[T]oggle [T]erminal' }) + end, + config = true, +}