From edaff6d94d877a92043345284c3929dce177ac6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20J=C3=B8rgensen?= Date: Fri, 10 Nov 2023 13:57:40 +0900 Subject: [PATCH 1/8] addded some costum plugins, aswell as adding the lazy-lock to ignore --- .gitignore | 1 + init.lua | 2 +- lua/custom/plugins/autopairs.lua | 17 +++++++++++++++++ lua/custom/plugins/filetree.lua | 15 +++++++++++++++ lua/custom/plugins/tab-bar.lua | 16 ++++++++++++++++ 5 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 lua/custom/plugins/autopairs.lua create mode 100644 lua/custom/plugins/filetree.lua create mode 100644 lua/custom/plugins/tab-bar.lua diff --git a/.gitignore b/.gitignore index d699e1d68cc..ea93edad490 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ tags test.sh .luarc.json nvim +lazy-lock.json diff --git a/init.lua b/init.lua index 748e7f81454..cc9e7cadfd1 100644 --- a/init.lua +++ b/init.lua @@ -229,7 +229,7 @@ require('lazy').setup({ -- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going. -- -- For additional information see: https://github.com/folke/lazy.nvim#-structuring-your-plugins - -- { import = 'custom.plugins' }, + { import = 'custom.plugins' }, }, {}) -- [[ Setting options ]] diff --git a/lua/custom/plugins/autopairs.lua b/lua/custom/plugins/autopairs.lua new file mode 100644 index 00000000000..3f3d9789419 --- /dev/null +++ b/lua/custom/plugins/autopairs.lua @@ -0,0 +1,17 @@ +-- File: lua/custom/plugins/autopairs.lua + +return { + "windwp/nvim-autopairs", + -- Optional dependency + dependencies = { 'hrsh7th/nvim-cmp' }, + config = function() + require("nvim-autopairs").setup {} + -- If you want to automatically add `(` after selecting a function or method + local cmp_autopairs = require('nvim-autopairs.completion.cmp') + local cmp = require('cmp') + cmp.event:on( + 'confirm_done', + cmp_autopairs.on_confirm_done() + ) + end, +} diff --git a/lua/custom/plugins/filetree.lua b/lua/custom/plugins/filetree.lua new file mode 100644 index 00000000000..55580ad2ac2 --- /dev/null +++ b/lua/custom/plugins/filetree.lua @@ -0,0 +1,15 @@ +-- Unless you are still migrating, remove the deprecated commands from v1.x +vim.cmd([[ let g:neo_tree_remove_legacy_commands = 1 ]]) + +return { + "nvim-neo-tree/neo-tree.nvim", + version = "*", + dependencies = { + "nvim-lua/plenary.nvim", + "nvim-tree/nvim-web-devicons", -- not strictly required, but recommended + "MunifTanjim/nui.nvim", + }, + config = function () + require('neo-tree').setup {} + end, +} diff --git a/lua/custom/plugins/tab-bar.lua b/lua/custom/plugins/tab-bar.lua new file mode 100644 index 00000000000..817230212e5 --- /dev/null +++ b/lua/custom/plugins/tab-bar.lua @@ -0,0 +1,16 @@ +return { + {'romgrk/barbar.nvim', + dependencies = { + 'lewis6991/gitsigns.nvim', -- OPTIONAL: for git status + 'nvim-tree/nvim-web-devicons', -- OPTIONAL: for file icons + }, + init = function() vim.g.barbar_auto_setup = false end, + opts = { + -- lazy.nvim will automatically call setup for you. put your options here, anything missing will use the default: + -- animation = true, + -- insert_at_start = true, + -- …etc. + }, + version = '^1.0.0', -- optional: only update when a new 1.x version is released + }, +} From 486c6a0560b70cc84542c94ad10126491e1a90db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20J=C3=B8rgensen?= Date: Fri, 10 Nov 2023 21:37:40 +0900 Subject: [PATCH 2/8] added new colourscheme --- lua/custom/plugins/colourscheme.lua | 58 +++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 lua/custom/plugins/colourscheme.lua diff --git a/lua/custom/plugins/colourscheme.lua b/lua/custom/plugins/colourscheme.lua new file mode 100644 index 00000000000..a5d23b59aea --- /dev/null +++ b/lua/custom/plugins/colourscheme.lua @@ -0,0 +1,58 @@ +return { + { "catppuccin/nvim", + name = "catppuccin", + config = function () + require("catppuccin").setup({ + flavour = "mocha", -- latte, frappe, macchiato, mocha + background = { -- :h background + light = "latte", + dark = "mocha", + }, + transparent_background = false, -- disables setting the background color. + show_end_of_buffer = false, -- shows the '~' characters after the end of buffers + term_colors = false, -- sets terminal colors (e.g. `g:terminal_color_0`) + dim_inactive = { + enabled = false, -- dims the background color of inactive window + shade = "dark", + percentage = 0.15, -- percentage of the shade to apply to the inactive window + }, + no_italic = false, -- Force no italic + no_bold = false, -- Force no bold + no_underline = false, -- Force no underline + styles = { -- Handles the styles of general hi groups (see `:h highlight-args`): + comments = { "italic" }, -- Change the style of comments + conditionals = { "italic" }, + loops = {}, + functions = {}, + keywords = {}, + strings = {}, + variables = {}, + numbers = {}, + booleans = {}, + properties = {}, + types = {}, + operators = {}, + }, + color_overrides = {}, + custom_highlights = {}, + integrations = { + cmp = true, + gitsigns = true, + nvimtree = true, + treesitter = true, + notify = false, + mini = { + enabled = true, + indentscope_color = "", + }, + -- For more plugins integrations please scroll down (https://github.com/catppuccin/nvim#integrations) + }, + }) + -- setup must be called before loading + -- this is the end of the function. + -- so now call sett colorscheme on vim + vim.cmd.colorscheme "catppuccin" + end, + --vim.cmd.colorscheme "catppuccin" + }, +} From 3d18291a7d70e376effc151dbea24e408e23f5da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20J=C3=B8rgensen?= Date: Sat, 11 Nov 2023 14:42:30 +0900 Subject: [PATCH 3/8] added some text highlighting --- lua/custom/plugins/text_highlighting.lua | 72 ++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 lua/custom/plugins/text_highlighting.lua diff --git a/lua/custom/plugins/text_highlighting.lua b/lua/custom/plugins/text_highlighting.lua new file mode 100644 index 00000000000..0e056ec53b8 --- /dev/null +++ b/lua/custom/plugins/text_highlighting.lua @@ -0,0 +1,72 @@ + +return { + "folke/todo-comments.nvim", + dependencies = { "nvim-lua/plenary.nvim" }, + opts = { + -- your configuration comes here + -- or leave it empty to use the default settings + -- refer to the configuration section below + signs = true, -- show icons in the signs column + sign_priority = 8, -- sign priority + -- keywords recognized as todo comments + keywords = { + FIX = { + icon = " ", -- icon used for the sign, and in search results + color = "error", -- can be a hex color, or a named color (see below) + alt = { "FIXME", "BUG", "FIXIT", "ISSUE" }, -- a set of other keywords that all map to this FIX keywords + -- signs = false, -- configure signs for some keywords individually + }, + TODO = { icon = " ", color = "info" }, + HACK = { icon = " ", color = "warning" }, + WARN = { icon = " ", color = "warning", alt = { "WARNING", "XXX" } }, + PERF = { icon = " ", alt = { "OPTIM", "PERFORMANCE", "OPTIMIZE" } }, + NOTE = { icon = " ", color = "hint", alt = { "INFO" } }, + TEST = { icon = "⏲ ", color = "test", alt = { "TESTING", "PASSED", "FAILED" } }, + }, + gui_style = { + fg = "NONE", -- The gui style to use for the fg highlight group. + bg = "BOLD", -- The gui style to use for the bg highlight group. + }, + merge_keywords = true, -- when true, custom keywords will be merged with the defaults + -- highlighting of the line containing the todo comment + -- * before: highlights before the keyword (typically comment characters) + -- * keyword: highlights of the keyword + -- * after: highlights after the keyword (todo text) + highlight = { + multiline = true, -- enable multine todo comments + multiline_pattern = "^.", -- lua pattern to match the next multiline from the start of the matched keyword + multiline_context = 10, -- extra lines that will be re-evaluated when changing a line + before = "", -- "fg" or "bg" or empty + keyword = "wide", -- "fg", "bg", "wide", "wide_bg", "wide_fg" or empty. (wide and wide_bg is the same as bg, but will also highlight surrounding characters, wide_fg acts accordingly but with fg) + after = "fg", -- "fg" or "bg" or empty + pattern = [[.*<(KEYWORDS)\s*:]], -- pattern or table of patterns, used for highlighting (vim regex) + comments_only = true, -- uses treesitter to match keywords in comments only + max_line_len = 400, -- ignore lines longer than this + exclude = {}, -- list of file types to exclude highlighting + }, + -- list of named colors where we try to extract the guifg from the + -- list of highlight groups or use the hex color if hl not found as a fallback + colors = { + error = { "DiagnosticError", "ErrorMsg", "#DC2626" }, + warning = { "DiagnosticWarn", "WarningMsg", "#FBBF24" }, + info = { "DiagnosticInfo", "#2563EB" }, + hint = { "DiagnosticHint", "#10B981" }, + default = { "Identifier", "#7C3AED" }, + test = { "Identifier", "#FF00FF" } + }, + search = { + command = "rg", + args = { + "--color=never", + "--no-heading", + "--with-filename", + "--line-number", + "--column", + }, + -- regex that will be used to match keywords. + -- don't replace the (KEYWORDS) placeholder + pattern = [[\b(KEYWORDS):]], -- ripgrep regex + -- pattern = [[\b(KEYWORDS)\b]], -- match without the extra colon. You'll likely get false positives + }, + } +} From 726be6499ccb0f732d974d3d434f7dcaeeb4590f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20J=C3=B8rgensen?= Date: Fri, 17 Nov 2023 14:19:50 +0900 Subject: [PATCH 4/8] added some more configuration to colourscheme --- lua/custom/plugins/colourscheme.lua | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/lua/custom/plugins/colourscheme.lua b/lua/custom/plugins/colourscheme.lua index a5d23b59aea..fff52052f38 100644 --- a/lua/custom/plugins/colourscheme.lua +++ b/lua/custom/plugins/colourscheme.lua @@ -33,8 +33,27 @@ return { types = {}, operators = {}, }, - color_overrides = {}, - custom_highlights = {}, + color_overrides = { + --all = { + -- text = "#ffffff", + --}, + latte = { + base = "#ff0000", + mantle = "#242424", + crust = "#474747", + }, + frappe = {}, + macchiato = {}, + mocha = {}, + }, + custom_highlights = function(colors) + return { + Comment = { fg = colors.pink }, + TabLineSel = { bg = colors.surface2 }, + CmpBorder = { fg = colors.surface2 }, + Pmenu = { bg = colors.none }, + } + end, integrations = { cmp = true, gitsigns = true, From f5c3ecb240e347b802579b9c2b799e2cc9cae13e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20J=C3=B8rgensen?= Date: Thu, 11 Jan 2024 09:34:21 +0900 Subject: [PATCH 5/8] changed to run on local clangd --- init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init.lua b/init.lua index cc66dd1849d..e65ba38f056 100644 --- a/init.lua +++ b/init.lua @@ -511,7 +511,7 @@ require('mason-lspconfig').setup() -- If you want to override the default filetypes that your language server will attach to you can -- define the property 'filetypes' to the map in question. local servers = { - -- clangd = {}, + clangd = {}, -- gopls = {}, -- pyright = {}, -- rust_analyzer = {}, From aff8577d86de2329f6e451337e4e1b9e85cdc231 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20J=C3=B8rgensen?= Date: Thu, 11 Jan 2024 11:29:36 +0900 Subject: [PATCH 6/8] trying to part things up a bit more --- init.lua | 76 ++++++++------------------------ lua/custom/plugins/indent.lua | 29 ++++++++++++ lua/custom/plugins/lualine.lua | 46 +++++++++++++++++++ lua/custom/plugins/telescope.lua | 20 +++++++++ 4 files changed, 114 insertions(+), 57 deletions(-) create mode 100644 lua/custom/plugins/indent.lua create mode 100644 lua/custom/plugins/lualine.lua create mode 100644 lua/custom/plugins/telescope.lua diff --git a/init.lua b/init.lua index e65ba38f056..1a594fd380c 100644 --- a/init.lua +++ b/init.lua @@ -74,7 +74,7 @@ require('lazy').setup({ 'tpope/vim-rhubarb', -- Detect tabstop and shiftwidth automatically - 'tpope/vim-sleuth', + 'benmi3/vim-sleuth', -- NOTE: This is where your plugins related to LSP can be installed. -- The configuration is done below. Search for lspconfig to find it below. @@ -151,63 +151,8 @@ require('lazy').setup({ end, }, }, - - { - -- Theme inspired by Atom - 'navarasu/onedark.nvim', - priority = 1000, - config = function() - vim.cmd.colorscheme 'onedark' - end, - }, - - { - -- Set lualine as statusline - 'nvim-lualine/lualine.nvim', - -- See `:help lualine.txt` - opts = { - options = { - icons_enabled = false, - theme = 'onedark', - component_separators = '|', - section_separators = '', - }, - }, - }, - - { - -- Add indentation guides even on blank lines - 'lukas-reineke/indent-blankline.nvim', - -- Enable `lukas-reineke/indent-blankline.nvim` - -- See `:help ibl` - main = 'ibl', - opts = {}, - }, - -- "gc" to comment visual regions/lines { 'numToStr/Comment.nvim', opts = {} }, - - -- Fuzzy Finder (files, lsp, etc) - { - 'nvim-telescope/telescope.nvim', - branch = '0.1.x', - dependencies = { - 'nvim-lua/plenary.nvim', - -- Fuzzy Finder Algorithm which requires local dependencies to be built. - -- Only load if `make` is available. Make sure you have the system - -- requirements installed. - { - 'nvim-telescope/telescope-fzf-native.nvim', - -- NOTE: If you are having trouble with this installation, - -- refer to the README for telescope-fzf-native for more instructions. - build = 'make', - cond = function() - return vim.fn.executable 'make' == 1 - end, - }, - }, - }, - { -- Highlight, edit, and navigate code 'nvim-treesitter/nvim-treesitter', @@ -514,7 +459,22 @@ local servers = { clangd = {}, -- gopls = {}, -- pyright = {}, - -- rust_analyzer = {}, + rust_analyzer = { + imports = { + granularity = { + group = "module", + }, + prefix = "self", + }, + cargo = { + buildScripts = { + enable = true, + }, + }, + procMacro = { + enable = true + } + }, -- tsserver = {}, -- html = { filetypes = { 'html', 'twig', 'hbs'} }, @@ -602,5 +562,7 @@ cmp.setup { }, } + + -- The line beneath this is called `modeline`. See `:help modeline` -- vim: ts=2 sts=2 sw=2 et diff --git a/lua/custom/plugins/indent.lua b/lua/custom/plugins/indent.lua new file mode 100644 index 00000000000..033fc5d61c3 --- /dev/null +++ b/lua/custom/plugins/indent.lua @@ -0,0 +1,29 @@ +return { "lukas-reineke/indent-blankline.nvim", + main = "ibl", + init = function () + local highlight = { + "RainbowRed", + "RainbowYellow", + "RainbowBlue", + "RainbowOrange", + "RainbowGreen", + "RainbowViolet", + "RainbowCyan", + } + + local hooks = require "ibl.hooks" + -- create the highlight groups in the highlight setup hook, so they are reset + -- every time the colorscheme changes + hooks.register(hooks.type.HIGHLIGHT_SETUP, function() + vim.api.nvim_set_hl(0, "RainbowRed", { fg = "#E06C75" }) + vim.api.nvim_set_hl(0, "RainbowYellow", { fg = "#E5C07B" }) + vim.api.nvim_set_hl(0, "RainbowBlue", { fg = "#61AFEF" }) + vim.api.nvim_set_hl(0, "RainbowOrange", { fg = "#D19A66" }) + vim.api.nvim_set_hl(0, "RainbowGreen", { fg = "#98C379" }) + vim.api.nvim_set_hl(0, "RainbowViolet", { fg = "#C678DD" }) + vim.api.nvim_set_hl(0, "RainbowCyan", { fg = "#56B6C2" }) + end) + + require("ibl").setup { indent = { highlight = highlight } } + end, + opts = {} } diff --git a/lua/custom/plugins/lualine.lua b/lua/custom/plugins/lualine.lua new file mode 100644 index 00000000000..6f909587b2d --- /dev/null +++ b/lua/custom/plugins/lualine.lua @@ -0,0 +1,46 @@ +return { + 'nvim-lualine/lualine.nvim', + dependencies = { 'nvim-tree/nvim-web-devicons' }, + config = function () + require('lualine').setup { + options = { + icons_enabled = true, + theme = 'auto', + component_separators = { left = '', right = ''}, + section_separators = { left = '', right = ''}, + disabled_filetypes = { + statusline = {}, + winbar = {}, + }, + ignore_focus = {}, + always_divide_middle = true, + globalstatus = false, + refresh = { + statusline = 1000, + tabline = 1000, + winbar = 1000, + } + }, + sections = { + lualine_a = {'mode'}, + lualine_b = {'branch', 'diff', 'diagnostics'}, + lualine_c = {'filename'}, + 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 = {}, + winbar = {}, + inactive_winbar = {}, + extensions = {} + } + end + } diff --git a/lua/custom/plugins/telescope.lua b/lua/custom/plugins/telescope.lua new file mode 100644 index 00000000000..7e5db25cda4 --- /dev/null +++ b/lua/custom/plugins/telescope.lua @@ -0,0 +1,20 @@ +return { + 'nvim-telescope/telescope.nvim', + branch = '0.1.x', + dependencies = { + 'nvim-lua/plenary.nvim', + -- Fuzzy Finder Algorithm which requires local dependencies to be built. + -- Only load if `make` is available. Make sure you have the system + -- requirements installed. + { + 'nvim-telescope/telescope-fzf-native.nvim', + -- NOTE: If you are having trouble with this installation, + -- refer to the README for telescope-fzf-native for more instructions. + build = 'make', + cond = function() + return vim.fn.executable 'make' == 1 + end, + }, + }, + } + From 8e7230b6bf29dff0e08a1c1ef0b83fe08615a9d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20J=C3=B8rgensen?= Date: Sat, 13 Jan 2024 12:23:23 +0900 Subject: [PATCH 7/8] indendt update --- .stylua.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stylua.toml b/.stylua.toml index 139e9397d90..ba0c6e6ad49 100644 --- a/.stylua.toml +++ b/.stylua.toml @@ -1,6 +1,6 @@ column_width = 160 line_endings = "Unix" indent_type = "Spaces" -indent_width = 2 +indent_width = 4 quote_style = "AutoPreferSingle" call_parentheses = "None" From cddd72ed75a32dfcf43eb8a49da331c93a072eb0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20J=C3=B8rgensen?= Date: Thu, 25 Jan 2024 13:03:33 +0900 Subject: [PATCH 8/8] theme update --- lua/custom/plugins/colourscheme.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/custom/plugins/colourscheme.lua b/lua/custom/plugins/colourscheme.lua index fff52052f38..5aa7e8e43f5 100644 --- a/lua/custom/plugins/colourscheme.lua +++ b/lua/custom/plugins/colourscheme.lua @@ -48,7 +48,7 @@ return { }, custom_highlights = function(colors) return { - Comment = { fg = colors.pink }, + Comment = { fg = colors.sky }, TabLineSel = { bg = colors.surface2 }, CmpBorder = { fg = colors.surface2 }, Pmenu = { bg = colors.none },