From 3d0d89284f4fe75e95569531462b3d79a5ecdbfa Mon Sep 17 00:00:00 2001 From: Zacharias-Brohn Date: Wed, 10 Dec 2025 22:46:54 +0100 Subject: [PATCH] test --- .prettierrc | 24 ++-- init.lua | 2 + lua/config/features/neo-tree/init.lua | 118 ++++++++++++++++++ .../sources/filesystem/components.lua | 86 +++++++++++++ lua/config/githubtheme.lua | 44 +++++++ lua/config/lspconfig.lua | 64 +--------- lua/config/scrollbar.lua | 6 + lua/mappings.lua | 73 ++++++++--- lua/plugins/colorschemes.lua | 19 ++- lua/plugins/init.lua | 6 + lua/plugins/neoformat.vim | 4 - 11 files changed, 351 insertions(+), 95 deletions(-) create mode 100644 lua/config/features/neo-tree/init.lua create mode 100644 lua/config/features/neo-tree/sources/filesystem/components.lua create mode 100644 lua/config/githubtheme.lua create mode 100644 lua/config/scrollbar.lua diff --git a/.prettierrc b/.prettierrc index 3e0813d..ed7a96e 100644 --- a/.prettierrc +++ b/.prettierrc @@ -1,14 +1,14 @@ { - "trailingComma": "es5", - "tabWidth": 4, - "semi": false, - "singleQuote": true, - "overrides": [ - { - "files": ".prettierrc", - "options": { - "parser": "json" - } - } - ] + "trailingComma": "es5", + "tabWidth": 4, + "semi": false, + "singleQuote": false, + "overrides": [ + { + "files": ".prettierrc", + "options": { + "parser": "json" + } + } + ] } diff --git a/init.lua b/init.lua index 6578a64..091ae7b 100644 --- a/init.lua +++ b/init.lua @@ -39,3 +39,5 @@ vim.filetype.add { [".*/uwsm/env.*"] = "zsh", }, } + +vim.cmd "colorscheme monokai-pro-octagon" diff --git a/lua/config/features/neo-tree/init.lua b/lua/config/features/neo-tree/init.lua new file mode 100644 index 0000000..2e79f97 --- /dev/null +++ b/lua/config/features/neo-tree/init.lua @@ -0,0 +1,118 @@ +local opts = { + close_if_last_window = true, -- Close Neo-tree if it is the last window left in the tab + popup_border_style = Util.ui.borderchars("thick", "tl-t-tr-r-br-b-bl-l"), + sources = { + "filesystem", + "buffers", + "git_status", + "diagnostics", + -- "document_symbols", + }, + source_selector = { + winbar = true, -- toggle to show selector on winbar + content_layout = "center", + tabs_layout = "equal", + show_separator_on_edge = true, + sources = { + { source = "filesystem", display_name = "󰉓" }, + { source = "buffers", display_name = "󰈙" }, + { source = "git_status", display_name = "" }, + -- { source = "document_symbols", display_name = "o" }, + { source = "diagnostics", display_name = "󰒡" }, + }, + }, + default_component_configs = { + indent = { + indent_size = 2, + padding = 1, -- extra padding on left hand side + -- indent guides + with_markers = true, + indent_marker = "│", + last_indent_marker = "└", + -- expander config, needed for nesting files + with_expanders = true, -- if nil and file nesting is enabled, will enable expanders + expander_collapsed = "", + expander_expanded = "", + expander_highlight = "NeoTreeExpander", + }, + icon = { + folder_closed = "", + folder_open = "", + folder_empty = "", + folder_empty_open = "", + -- The next two settings are only a fallback, if you use nvim-web-devicons and configure default icons there + -- then these will never be used. + default = " ", + }, + modified = { symbol = "" }, + git_status = { symbols = Icon.git }, + diagnostics = { symbols = Icon.diagnostics }, + }, + window = { + width = 40, + mappings = { + ["<1-LeftMouse>"] = "open", + ["l"] = "open", + [""] = "none", + ["P"] = { "toggle_preview", config = { use_float = false } }, + }, + }, + filesystem = { + window = { + mappings = { + ["H"] = "navigate_up", + [""] = "toggle_hidden", + ["."] = "set_root", + ["/"] = "fuzzy_finder", + ["f"] = "filter_on_submit", + [""] = "clear_filter", + ["a"] = { "add", config = { show_path = "relative" } }, -- "none", "relative", "absolute" + }, + }, + filtered_items = { + hide_dotfiles = false, + hide_gitignored = false, + }, + follow_current_file = { + enabled = true, + }, -- This will find and focus the file in the active buffer every + -- time the current file is changed while the tree is open. + group_empty_dirs = true, -- when true, empty folders will be grouped together + }, + async_directory_scan = "always", +} + +opts.filesystem.components = + require "config.features.neo-tree.sources.filesystem.components" +local function hideCursor() + vim.cmd [[ + setlocal guicursor=n:block-Cursor + setlocal foldcolumn=0 + hi Cursor blend=100 + ]] +end +local function showCursor() + vim.cmd [[ + setlocal guicursor=n-v-c-sm:block,i-ci-ve:ver25,r-cr-o:hor20 + hi Cursor blend=0 + ]] +end + +local neotree_group = Util.augroup "neo-tree_hide_cursor" + +vim.api.nvim_create_autocmd({ "WinEnter", "BufEnter", "InsertEnter" }, { + group = neotree_group, + callback = function() + local action = vim.bo.filetype == "neo-tree" and hideCursor + or showCursor + action() + end, +}) +vim.api.nvim_create_autocmd({ "WinLeave", "BufLeave", "InsertEnter" }, { + group = neotree_group, + callback = function() + showCursor() + end, +}) + +return opts diff --git a/lua/config/features/neo-tree/sources/filesystem/components.lua b/lua/config/features/neo-tree/sources/filesystem/components.lua new file mode 100644 index 0000000..c22c068 --- /dev/null +++ b/lua/config/features/neo-tree/sources/filesystem/components.lua @@ -0,0 +1,86 @@ +local M = {} + +function M.name(config, node, state) + local common = require "neo-tree.sources.common.components" + local highlights = require "neo-tree.ui.highlights" + + local highlight = config.highlight or highlights.FILE_NAME + local text = node.name + if node.type == "directory" then + highlight = highlights.DIRECTORY_NAME + if config.trailing_slash and text ~= "/" then + text = text .. "/" + end + end + + if node:get_depth() == 1 and node.type ~= "message" then + highlight = highlights.ROOT_NAME + text = vim.fn.fnamemodify(text, ":p:h:t") + text = string.upper(text) + else + local filtered_by = common.filtered_by(config, node, state) + highlight = filtered_by.highlight or highlight + if config.use_git_status_colors then + local git_status = state.components.git_status({}, node, state) + if git_status and git_status.highlight then + highlight = git_status.highlight + end + end + end + + if type(config.right_padding) == "number" then + if config.right_padding > 0 then + text = text .. string.rep(" ", config.right_padding) + end + else + text = text .. " " + end + + return { + text = text, + highlight = highlight, + } +end + +function M.icon(config, node, state) + local common = require "neo-tree.sources.common.components" + local highlights = require "neo-tree.ui.highlights" + + local icon = config.default or " " + local highlight = config.highlight or highlights.FILE_ICON + if node.type == "directory" then + highlight = highlights.DIRECTORY_ICON + if node.loaded and not node:has_children() then + icon = not node.empty_expanded and config.folder_empty + or config.folder_empty_open + elseif node:is_expanded() then + icon = config.folder_open or "-" + else + icon = config.folder_closed or "+" + end + elseif node.type == "file" or node.type == "terminal" then + local success, web_devicons = pcall(require, "nvim-web-devicons") + if success then + local devicon, hl = web_devicons.get_icon(node.name, node.ext) + icon = devicon or icon + highlight = hl or highlight + end + end + + local filtered_by = common.filtered_by(config, node, state) + + -- Don't render icon in root folder + if node:get_depth() == 1 then + return { + text = nil, + highlight = highlight, + } + end + + return { + text = icon .. " ", + highlight = filtered_by.highlight or highlight, + } +end + +return M diff --git a/lua/config/githubtheme.lua b/lua/config/githubtheme.lua new file mode 100644 index 0000000..1692e4c --- /dev/null +++ b/lua/config/githubtheme.lua @@ -0,0 +1,44 @@ +local palettes = {} + +require("github-theme").setup { + options = { + compile_path = vim.fn.stdpath "cache" .. "/github-theme", + compile_file_suffix = "_compiled", + hide_end_of_buffer = true, + hide_nc_statusline = true, + transparent = false, + terminal_colors = true, + dim_inactive = false, + module_default = true, + styles = { + comments = "italic", + functions = "NONE", + keywords = "NONE", + variables = "NONE", + conditionals = "NONE", + constants = "NONE", + numbers = "NONE", + operators = "NONE", + strings = "NONE", + types = "NONE", + }, + inverse = { + match_paren = false, + visual = false, + search = false, + }, + darken = { + floats = true, + sidebars = { + enable = true, + list = {}, + }, + }, + modules = {}, + }, + palettes = {}, + specs = {}, + groups = {}, +} + +vim.cmd "colorscheme github_dark" diff --git a/lua/config/lspconfig.lua b/lua/config/lspconfig.lua index bfba1d9..8efedca 100644 --- a/lua/config/lspconfig.lua +++ b/lua/config/lspconfig.lua @@ -92,67 +92,7 @@ require("mason-lspconfig").setup { }, } --- cmp.setup { --- preselect = 'None', --- formatting = { --- fields = { 'kind', 'abbr' }, --- format = function(entry, vim_item) --- vim_item.kind = cmp_kinds[vim_item.kind] or '' --- if entry.completion_item.detail then --- vim_item.menu = entry.completion_item.detail --- end --- return vim_item --- end, --- }, --- completion = { completeopt = "menu,menuone" }, --- snippet = { --- expand = function(args) --- require("luasnip").lsp_expand(args.body) --- end, --- }, --- --- mapping = { --- [""] = cmp.mapping.select_prev_item(), --- [""] = cmp.mapping.select_next_item(), --- [""] = cmp.mapping.scroll_docs(-4), --- [""] = cmp.mapping.scroll_docs(4), --- [""] = cmp.mapping.complete(), --- [""] = cmp.mapping.close(), --- [""] = cmp.mapping.confirm { --- behavior = cmp.ConfirmBehavior.Insert, --- select = true, --- }, --- [""] = cmp.mapping(function(fallback) --- if cmp.visible() then --- cmp.select_next_item() --- elseif require("luasnip").expand_or_jumpable() then --- require("luasnip").expand_or_jump() --- else --- fallback() --- end --- end, { "i", "s" }), --- [""] = cmp.mapping(function(fallback) --- if cmp.visible() then --- cmp.select_prev_item() --- elseif require("luasnip").jumpable(-1) then --- require("luasnip").jump(-1) --- else --- fallback() --- end --- end, { "i", "s" }), --- }, --- --- sources = cmp.config.sources({ --- { name = "path" }, --- { name = "nvim_lsp" }, --- { name = "luasnip" }, --- { name = "buffer" }, --- { name = "nvim_lua" }, --- }), --- } - vim.diagnostic.config { - -- update_in_insert = true, virtual_text = false, virtual_lines = false, signs = true, @@ -264,6 +204,10 @@ local flat_servers = flatten_to_array(servers) for _, server in ipairs(flat_servers) do lspconfig(server, { on_attach = function(client, bufnr) + if client.name == "typos_lsp" then + return + end + require("workspace-diagnostics").populate_workspace_diagnostics( client, bufnr diff --git a/lua/config/scrollbar.lua b/lua/config/scrollbar.lua new file mode 100644 index 0000000..e36082e --- /dev/null +++ b/lua/config/scrollbar.lua @@ -0,0 +1,6 @@ +-- local colors = require("monokai-pro.octagon.colors").setup() + +require("scrollbar").setup { + handle = {}, + marks = {}, +} diff --git a/lua/mappings.lua b/lua/mappings.lua index 3604e35..5cb820e 100644 --- a/lua/mappings.lua +++ b/lua/mappings.lua @@ -10,10 +10,25 @@ map("v", "", ":m '<-2gv=gv", { desc = "Move selected text up" }) map("v", "", ":m '>+1gv=gv", { desc = "Move selected text down" }) -- Alt + Arrow Key to change buffer -map("n", "", "KittyNavigateLeft", { desc = "Move to left split" }) -map("n", "", "KittyNavigateDown", { desc = "Move to bottom split" }) +map( + "n", + "", + "KittyNavigateLeft", + { desc = "Move to left split" } +) +map( + "n", + "", + "KittyNavigateDown", + { desc = "Move to bottom split" } +) map("n", "", "KittyNavigateUp", { desc = "Move to top split" }) -map("n", "", "KittyNavigateRight", { desc = "Move to right split" }) +map( + "n", + "", + "KittyNavigateRight", + { desc = "Move to right split" } +) -- Copilot Chat buffer map("n", "", vim.cmd.CopilotChatToggle) @@ -21,12 +36,29 @@ map("i", "", vim.cmd.CopilotChatToggle) map("v", "", vim.cmd.CopilotChatToggle) -- Explorer and Undotree -map('n', 'e', function() Snacks.explorer() end) -map('n', 'u', require('undotree').toggle, { noremap = true, silent = true }) +map("n", "e", function() + Snacks.explorer() +end) +map( + "n", + "u", + require("undotree").toggle, + { noremap = true, silent = true } +) -- Telescope grep -map("n", "g", require("telescope.builtin").live_grep, {desc = "Telescope grep" }) -map("n", "f", require("telescope.builtin").find_files, {desc = "Telescope find files" }) +map( + "n", + "g", + require("telescope.builtin").live_grep, + { desc = "Telescope grep" } +) +map( + "n", + "f", + require("telescope.builtin").find_files, + { desc = "Telescope find files" } +) map("n", "", ":bdelete") -- map("n", "", ":BufferRestore") @@ -44,35 +76,44 @@ map("n", "zig", "LspRestart") map("x", "p", [["_dP]]) -- next greatest remap ever : asbjornHaland -map({"n", "v"}, "y", [["+y]]) +map({ "n", "v" }, "y", [["+y]]) map("n", "Y", [["+Y]]) -map({"n", "v"}, "d", "\"_d") +map({ "n", "v" }, "d", '"_d') -- This is going to get me cancelled map("i", "", "") -map("n", "mr", "CellularAutomaton make_it_rain"); +map("n", "mr", "CellularAutomaton make_it_rain") map("n", "", function() - vim.cmd("so") + vim.cmd "so" end) map("n", "", "ChatGPT") -map("n", "fm", "TailwindConcealToggle", { desc = "Toggle Tailwind Conceal" }) +map( + "n", + "fm", + "TailwindConcealToggle", + { desc = "Toggle Tailwind Conceal" } +) -- Terminal -map("n", "", function() Snacks.terminal.toggle() end, { desc = "Toggle Terminal" }) +map("n", "", function() + Snacks.terminal.toggle() +end, { desc = "Toggle Terminal" }) -- Gitbrowse -map("n", "gb", function() Snacks.gitbrowse.open() end ) +map("n", "gb", function() + Snacks.gitbrowse.open() +end) -- Actions Previewer -map({"n", "v"}, "ap", require("actions-preview").code_actions) +map({ "n", "v" }, "ap", require("actions-preview").code_actions) map("n", "K", require("pretty_hover").hover) -- winbar -local dbar_api = require("dropbar.api") +local dbar_api = require "dropbar.api" map("n", "b", dbar_api.pick) diff --git a/lua/plugins/colorschemes.lua b/lua/plugins/colorschemes.lua index a653893..3977389 100644 --- a/lua/plugins/colorschemes.lua +++ b/lua/plugins/colorschemes.lua @@ -3,7 +3,7 @@ return { "olimorris/onedarkpro.nvim", priority = 1000, config = function() - require("config.themelight") + require "config.themelight" end, }, { @@ -12,7 +12,7 @@ return { { "loctvl842/monokai-pro.nvim", config = function() - require("config.monokaipro") + require "config.monokaipro" end, }, { @@ -42,5 +42,18 @@ return { "projekt0n/github-nvim-theme", lazy = false, priority = 1000, - } + config = function() + require "config.githubtheme" + end, + }, + { + "alexmozaidze/palenight.nvim", + }, + { + "Yazeed1s/minimal.nvim", + init = function() + vim.g.minimal_italic_comments = true + vim.g.minimal_italic_keywords = true + end, + }, } diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua index 80c59e9..8547ae8 100644 --- a/lua/plugins/init.lua +++ b/lua/plugins/init.lua @@ -290,4 +290,10 @@ return { ) end, }, + { + "petertriho/nvim-scrollbar", + config = function() + require "config.scrollbar" + end, + }, } diff --git a/lua/plugins/neoformat.vim b/lua/plugins/neoformat.vim index e75b126..1709702 100644 --- a/lua/plugins/neoformat.vim +++ b/lua/plugins/neoformat.vim @@ -8,7 +8,3 @@ let g:neoformat_enabled_lua = ['stylua'] let g:neoformat_enabled_rust = ['rustfmt'] let g:neoformat_enabled_cpp = ['uncrustify'] let g:neoformat_enabled_markdown = ['prettier'] - -let g:neoformat_basic_format_align = 1 -let g:neoformat_basic_format_retab = 1 -let g:neoformat_basic_format_trim = 1