From 89e72b6766ac72dfd012b33c81705dc98bc69643 Mon Sep 17 00:00:00 2001 From: Elias Almqvist Date: Wed, 27 Dec 2023 11:13:35 +0100 Subject: [PATCH 1/8] Fixes --- nvim/.config/nvim/lua/evim/packer.lua | 8 ++--- nvim/.config/nvim/plugin/after/lualine.lua | 1 - nvim/.config/nvim/plugin/packer_compiled.lua | 31 +++++++------------- 3 files changed, 14 insertions(+), 26 deletions(-) delete mode 100644 nvim/.config/nvim/plugin/after/lualine.lua diff --git a/nvim/.config/nvim/lua/evim/packer.lua b/nvim/.config/nvim/lua/evim/packer.lua index 44aa6a9..2e06c67 100644 --- a/nvim/.config/nvim/lua/evim/packer.lua +++ b/nvim/.config/nvim/lua/evim/packer.lua @@ -61,10 +61,10 @@ return require("packer").startup(function(use) -- Misc -- use "vimsence/vimsence" use "andweeb/presence.nvim" - use { - "nvim-lualine/lualine.nvim", - requires = { "nvim-tree/nvim-web-devicons", opt = true } - } + -- use { + -- "nvim-lualine/lualine.nvim", + -- requires = { "nvim-tree/nvim-web-devicons", opt = true } + -- } use { "folke/todo-comments.nvim", diff --git a/nvim/.config/nvim/plugin/after/lualine.lua b/nvim/.config/nvim/plugin/after/lualine.lua deleted file mode 100644 index 9814cae..0000000 --- a/nvim/.config/nvim/plugin/after/lualine.lua +++ /dev/null @@ -1 +0,0 @@ -require("lualine").setup() diff --git a/nvim/.config/nvim/plugin/packer_compiled.lua b/nvim/.config/nvim/plugin/packer_compiled.lua index 1e544c5..d9c7099 100644 --- a/nvim/.config/nvim/plugin/packer_compiled.lua +++ b/nvim/.config/nvim/plugin/packer_compiled.lua @@ -49,8 +49,8 @@ local function save_profiles(threshold) end time([[Luarocks path setup]], true) -local package_path_str = "/home/elal/.cache/nvim/packer_hererocks/2.1.1697887905/share/lua/5.1/?.lua;/home/elal/.cache/nvim/packer_hererocks/2.1.1697887905/share/lua/5.1/?/init.lua;/home/elal/.cache/nvim/packer_hererocks/2.1.1697887905/lib/luarocks/rocks-5.1/?.lua;/home/elal/.cache/nvim/packer_hererocks/2.1.1697887905/lib/luarocks/rocks-5.1/?/init.lua" -local install_cpath_pattern = "/home/elal/.cache/nvim/packer_hererocks/2.1.1697887905/lib/lua/5.1/?.so" +local package_path_str = "/home/elal/.cache/nvim/packer_hererocks/2.1.1702233742/share/lua/5.1/?.lua;/home/elal/.cache/nvim/packer_hererocks/2.1.1702233742/share/lua/5.1/?/init.lua;/home/elal/.cache/nvim/packer_hererocks/2.1.1702233742/lib/luarocks/rocks-5.1/?.lua;/home/elal/.cache/nvim/packer_hererocks/2.1.1702233742/lib/luarocks/rocks-5.1/?/init.lua" +local install_cpath_pattern = "/home/elal/.cache/nvim/packer_hererocks/2.1.1702233742/lib/lua/5.1/?.so" if not string.find(package.path, package_path_str, 1, true) then package.path = package.path .. ';' .. package_path_str end @@ -106,11 +106,6 @@ _G.packer_plugins = { path = "/home/elal/.local/share/nvim/site/pack/packer/start/lsp-zero.nvim", url = "https://github.com/VonHeikemen/lsp-zero.nvim" }, - ["lualine.nvim"] = { - loaded = true, - path = "/home/elal/.local/share/nvim/site/pack/packer/start/lualine.nvim", - url = "https://github.com/nvim-lualine/lualine.nvim" - }, ["mason-lspconfig.nvim"] = { loaded = true, path = "/home/elal/.local/share/nvim/site/pack/packer/start/mason-lspconfig.nvim", @@ -152,12 +147,6 @@ _G.packer_plugins = { path = "/home/elal/.local/share/nvim/site/pack/packer/start/nvim-treesitter", url = "https://github.com/nvim-treesitter/nvim-treesitter" }, - ["nvim-web-devicons"] = { - loaded = false, - needs_bufread = false, - path = "/home/elal/.local/share/nvim/site/pack/packer/opt/nvim-web-devicons", - url = "https://github.com/nvim-tree/nvim-web-devicons" - }, ["onedark.nvim"] = { loaded = true, path = "/home/elal/.local/share/nvim/site/pack/packer/start/onedark.nvim", @@ -202,6 +191,14 @@ _G.packer_plugins = { } time([[Defining packer_plugins]], false) +-- Config for: gitsigns.nvim +time([[Config for gitsigns.nvim]], true) +try_loadstring("\27LJ\2\n6\0\0\3\0\3\0\0066\0\0\0'\2\1\0B\0\2\0029\0\2\0B\0\1\1K\0\1\0\nsetup\rgitsigns\frequire\0", "config", "gitsigns.nvim") +time([[Config for gitsigns.nvim]], false) +-- Config for: todo-comments.nvim +time([[Config for todo-comments.nvim]], true) +try_loadstring("\27LJ\2\n?\0\0\3\0\3\0\a6\0\0\0'\2\1\0B\0\2\0029\0\2\0004\2\0\0B\0\2\1K\0\1\0\nsetup\18todo-comments\frequire\0", "config", "todo-comments.nvim") +time([[Config for todo-comments.nvim]], false) -- Config for: Comment.nvim time([[Config for Comment.nvim]], true) try_loadstring("\27LJ\2\n5\0\0\3\0\3\0\0066\0\0\0'\2\1\0B\0\2\0029\0\2\0B\0\1\1K\0\1\0\nsetup\fComment\frequire\0", "config", "Comment.nvim") @@ -210,14 +207,6 @@ time([[Config for Comment.nvim]], false) time([[Config for nvim-autopairs]], true) try_loadstring("\27LJ\2\n@\0\0\3\0\3\0\a6\0\0\0'\2\1\0B\0\2\0029\0\2\0004\2\0\0B\0\2\1K\0\1\0\nsetup\19nvim-autopairs\frequire\0", "config", "nvim-autopairs") time([[Config for nvim-autopairs]], false) --- Config for: todo-comments.nvim -time([[Config for todo-comments.nvim]], true) -try_loadstring("\27LJ\2\n?\0\0\3\0\3\0\a6\0\0\0'\2\1\0B\0\2\0029\0\2\0004\2\0\0B\0\2\1K\0\1\0\nsetup\18todo-comments\frequire\0", "config", "todo-comments.nvim") -time([[Config for todo-comments.nvim]], false) --- Config for: gitsigns.nvim -time([[Config for gitsigns.nvim]], true) -try_loadstring("\27LJ\2\n6\0\0\3\0\3\0\0066\0\0\0'\2\1\0B\0\2\0029\0\2\0B\0\1\1K\0\1\0\nsetup\rgitsigns\frequire\0", "config", "gitsigns.nvim") -time([[Config for gitsigns.nvim]], false) _G._packer.inside_compile = false if _G._packer.needs_bufread == true then From 86c89db6811f16c4bbf6ee2512cf29d8c1aca30f Mon Sep 17 00:00:00 2001 From: Elias Almqvist Date: Thu, 11 Jan 2024 19:55:35 +0100 Subject: [PATCH 2/8] chore: Packer update --- nvim/.config/nvim/plugin/packer_compiled.lua | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/nvim/.config/nvim/plugin/packer_compiled.lua b/nvim/.config/nvim/plugin/packer_compiled.lua index d9c7099..5406eaa 100644 --- a/nvim/.config/nvim/plugin/packer_compiled.lua +++ b/nvim/.config/nvim/plugin/packer_compiled.lua @@ -195,18 +195,18 @@ time([[Defining packer_plugins]], false) time([[Config for gitsigns.nvim]], true) try_loadstring("\27LJ\2\n6\0\0\3\0\3\0\0066\0\0\0'\2\1\0B\0\2\0029\0\2\0B\0\1\1K\0\1\0\nsetup\rgitsigns\frequire\0", "config", "gitsigns.nvim") time([[Config for gitsigns.nvim]], false) --- Config for: todo-comments.nvim -time([[Config for todo-comments.nvim]], true) -try_loadstring("\27LJ\2\n?\0\0\3\0\3\0\a6\0\0\0'\2\1\0B\0\2\0029\0\2\0004\2\0\0B\0\2\1K\0\1\0\nsetup\18todo-comments\frequire\0", "config", "todo-comments.nvim") -time([[Config for todo-comments.nvim]], false) --- Config for: Comment.nvim -time([[Config for Comment.nvim]], true) -try_loadstring("\27LJ\2\n5\0\0\3\0\3\0\0066\0\0\0'\2\1\0B\0\2\0029\0\2\0B\0\1\1K\0\1\0\nsetup\fComment\frequire\0", "config", "Comment.nvim") -time([[Config for Comment.nvim]], false) -- Config for: nvim-autopairs time([[Config for nvim-autopairs]], true) try_loadstring("\27LJ\2\n@\0\0\3\0\3\0\a6\0\0\0'\2\1\0B\0\2\0029\0\2\0004\2\0\0B\0\2\1K\0\1\0\nsetup\19nvim-autopairs\frequire\0", "config", "nvim-autopairs") time([[Config for nvim-autopairs]], false) +-- Config for: Comment.nvim +time([[Config for Comment.nvim]], true) +try_loadstring("\27LJ\2\n5\0\0\3\0\3\0\0066\0\0\0'\2\1\0B\0\2\0029\0\2\0B\0\1\1K\0\1\0\nsetup\fComment\frequire\0", "config", "Comment.nvim") +time([[Config for Comment.nvim]], false) +-- Config for: todo-comments.nvim +time([[Config for todo-comments.nvim]], true) +try_loadstring("\27LJ\2\n?\0\0\3\0\3\0\a6\0\0\0'\2\1\0B\0\2\0029\0\2\0004\2\0\0B\0\2\1K\0\1\0\nsetup\18todo-comments\frequire\0", "config", "todo-comments.nvim") +time([[Config for todo-comments.nvim]], false) _G._packer.inside_compile = false if _G._packer.needs_bufread == true then From ed6ca13394d9ec40edbce26819c60a4e8f7dc1bb Mon Sep 17 00:00:00 2001 From: Elias Almqvist Date: Fri, 19 Jan 2024 20:04:05 +0100 Subject: [PATCH 3/8] Doom Emacs stuff --- doomemacs/.doom.d/config.el | 24 +++++++++++++++++++- doomemacs/.doom.d/packages.el | 3 +++ nvim/.config/nvim/plugin/packer_compiled.lua | 16 ++++++------- 3 files changed, 34 insertions(+), 9 deletions(-) diff --git a/doomemacs/.doom.d/config.el b/doomemacs/.doom.d/config.el index 49804f9..144abb3 100644 --- a/doomemacs/.doom.d/config.el +++ b/doomemacs/.doom.d/config.el @@ -6,7 +6,7 @@ ;; Some functionality uses this to identify you, e.g. GPG configuration, email ;; clients, file templates and snippets. It is optional. -(setq user-full-name "E. Almqvist" +(setq user-full-name "Elias Almqvist" user-mail-address "elalmqvist@gmail.com") ;; Doom exposes five (optional) variables for controlling fonts in Doom: @@ -104,3 +104,25 @@ (global-set-key (kbd "M-g") 'format-all-buffer) + +;; accept completion from copilot and fallback to company +(use-package! copilot + :hook (prog-mode . copilot-mode) + :bind (:map copilot-completion-map + ("" . 'copilot-accept-completion) + ("TAB" . 'copilot-accept-completion) + ("C-TAB" . 'copilot-accept-completion-by-word) + ("C-" . 'copilot-accept-completion-by-word))) + +(after! (evil copilot) + ;; Define the custom function that either accepts the completion or does the default behavior + (defun my/copilot-tab-or-default () + (interactive) + (if (and (bound-and-true-p copilot-mode) + ;; Add any other conditions to check for active copilot suggestions if necessary + ) + (copilot-accept-completion) + (evil-insert 1))) ; Default action to insert a tab. Adjust as needed. + + ;; Bind the custom function to in Evil's insert state + (evil-define-key 'insert 'global (kbd "") 'my/copilot-tab-or-default)) diff --git a/doomemacs/.doom.d/packages.el b/doomemacs/.doom.d/packages.el index 839b83c..b4f1808 100644 --- a/doomemacs/.doom.d/packages.el +++ b/doomemacs/.doom.d/packages.el @@ -48,3 +48,6 @@ ;(unpin! pinned-package another-pinned-package) ;; ...Or *all* packages (NOT RECOMMENDED; will likely break things) ;(unpin! t) + +(package! copilot + :recipe (:host github :repo "zerolfx/copilot.el" :files ("*.el" "dist"))) diff --git a/nvim/.config/nvim/plugin/packer_compiled.lua b/nvim/.config/nvim/plugin/packer_compiled.lua index 5406eaa..d9c7099 100644 --- a/nvim/.config/nvim/plugin/packer_compiled.lua +++ b/nvim/.config/nvim/plugin/packer_compiled.lua @@ -195,18 +195,18 @@ time([[Defining packer_plugins]], false) time([[Config for gitsigns.nvim]], true) try_loadstring("\27LJ\2\n6\0\0\3\0\3\0\0066\0\0\0'\2\1\0B\0\2\0029\0\2\0B\0\1\1K\0\1\0\nsetup\rgitsigns\frequire\0", "config", "gitsigns.nvim") time([[Config for gitsigns.nvim]], false) --- Config for: nvim-autopairs -time([[Config for nvim-autopairs]], true) -try_loadstring("\27LJ\2\n@\0\0\3\0\3\0\a6\0\0\0'\2\1\0B\0\2\0029\0\2\0004\2\0\0B\0\2\1K\0\1\0\nsetup\19nvim-autopairs\frequire\0", "config", "nvim-autopairs") -time([[Config for nvim-autopairs]], false) --- Config for: Comment.nvim -time([[Config for Comment.nvim]], true) -try_loadstring("\27LJ\2\n5\0\0\3\0\3\0\0066\0\0\0'\2\1\0B\0\2\0029\0\2\0B\0\1\1K\0\1\0\nsetup\fComment\frequire\0", "config", "Comment.nvim") -time([[Config for Comment.nvim]], false) -- Config for: todo-comments.nvim time([[Config for todo-comments.nvim]], true) try_loadstring("\27LJ\2\n?\0\0\3\0\3\0\a6\0\0\0'\2\1\0B\0\2\0029\0\2\0004\2\0\0B\0\2\1K\0\1\0\nsetup\18todo-comments\frequire\0", "config", "todo-comments.nvim") time([[Config for todo-comments.nvim]], false) +-- Config for: Comment.nvim +time([[Config for Comment.nvim]], true) +try_loadstring("\27LJ\2\n5\0\0\3\0\3\0\0066\0\0\0'\2\1\0B\0\2\0029\0\2\0B\0\1\1K\0\1\0\nsetup\fComment\frequire\0", "config", "Comment.nvim") +time([[Config for Comment.nvim]], false) +-- Config for: nvim-autopairs +time([[Config for nvim-autopairs]], true) +try_loadstring("\27LJ\2\n@\0\0\3\0\3\0\a6\0\0\0'\2\1\0B\0\2\0029\0\2\0004\2\0\0B\0\2\1K\0\1\0\nsetup\19nvim-autopairs\frequire\0", "config", "nvim-autopairs") +time([[Config for nvim-autopairs]], false) _G._packer.inside_compile = false if _G._packer.needs_bufread == true then From 63d009ea2c7c82b501d943b14496fc3795071557 Mon Sep 17 00:00:00 2001 From: Elias Almqvist Date: Fri, 19 Jan 2024 20:46:36 +0100 Subject: [PATCH 4/8] feat: NvChad config etc --- nvchad/.config/nvim/lua/custom/chadrc.lua | 22 +++++++ .../nvim/lua/custom/configs/conform.lua | 28 ++++++++ .../nvim/lua/custom/configs/lspconfig.lua | 18 +++++ .../nvim/lua/custom/configs/overrides.lua | 59 +++++++++++++++++ nvchad/.config/nvim/lua/custom/highlights.lua | 19 ++++++ nvchad/.config/nvim/lua/custom/init.lua | 7 ++ nvchad/.config/nvim/lua/custom/mappings.lua | 24 +++++++ nvchad/.config/nvim/lua/custom/plugins.lua | 65 +++++++++++++++++++ 8 files changed, 242 insertions(+) create mode 100644 nvchad/.config/nvim/lua/custom/chadrc.lua create mode 100644 nvchad/.config/nvim/lua/custom/configs/conform.lua create mode 100644 nvchad/.config/nvim/lua/custom/configs/lspconfig.lua create mode 100644 nvchad/.config/nvim/lua/custom/configs/overrides.lua create mode 100644 nvchad/.config/nvim/lua/custom/highlights.lua create mode 100644 nvchad/.config/nvim/lua/custom/init.lua create mode 100644 nvchad/.config/nvim/lua/custom/mappings.lua create mode 100644 nvchad/.config/nvim/lua/custom/plugins.lua diff --git a/nvchad/.config/nvim/lua/custom/chadrc.lua b/nvchad/.config/nvim/lua/custom/chadrc.lua new file mode 100644 index 0000000..d628a06 --- /dev/null +++ b/nvchad/.config/nvim/lua/custom/chadrc.lua @@ -0,0 +1,22 @@ +---@type ChadrcConfig +local M = {} + +-- Path to overriding theme and highlights files +local highlights = require "custom.highlights" + +M.ui = { + theme = "onedark", + theme_toggle = { "onedark", "one_light" }, + + hl_override = highlights.override, + hl_add = highlights.add, +} + +M.plugins = "custom.plugins" + +-- check core.mappings for table structure +M.mappings = require "custom.mappings" + + + +return M diff --git a/nvchad/.config/nvim/lua/custom/configs/conform.lua b/nvchad/.config/nvim/lua/custom/configs/conform.lua new file mode 100644 index 0000000..bdb5000 --- /dev/null +++ b/nvchad/.config/nvim/lua/custom/configs/conform.lua @@ -0,0 +1,28 @@ +local options = { + lsp_fallback = true, + + formatters_by_ft = { + -- Divine Intellect Languages + lua = { "stylua" }, + + -- Web Dev shit + javascript = { "prettier" }, + typescript = { "prettier" }, + css = { "prettier" }, + scss = { "prettier" }, + html = { "prettier" }, + + sh = { "shfmt" }, + }, + + -- adding same formatter for multiple filetypes can look too much work for some + -- instead of the above code you could just use a loop! the config is just a table after all! + + -- format_on_save = { + -- -- These options will be passed to conform.format() + -- timeout_ms = 500, + -- lsp_fallback = true, + -- }, +} + +require("conform").setup(options) diff --git a/nvchad/.config/nvim/lua/custom/configs/lspconfig.lua b/nvchad/.config/nvim/lua/custom/configs/lspconfig.lua new file mode 100644 index 0000000..6464a3a --- /dev/null +++ b/nvchad/.config/nvim/lua/custom/configs/lspconfig.lua @@ -0,0 +1,18 @@ +local on_attach = require("plugins.configs.lspconfig").on_attach +local capabilities = require("plugins.configs.lspconfig").capabilities + +local lspconfig = require "lspconfig" + +-- if you just want default config for the servers then put them in a table +local servers = { "html", "cssls", "tsserver", "clangd" } + +for _, lsp in ipairs(servers) do + lspconfig[lsp].setup { + on_attach = on_attach, + capabilities = capabilities, + } +end + +-- +-- lspconfig.pyright.setup { blabla} +-- diff --git a/nvchad/.config/nvim/lua/custom/configs/overrides.lua b/nvchad/.config/nvim/lua/custom/configs/overrides.lua new file mode 100644 index 0000000..c4cd2c7 --- /dev/null +++ b/nvchad/.config/nvim/lua/custom/configs/overrides.lua @@ -0,0 +1,59 @@ +local M = {} + +M.treesitter = { + ensure_installed = { + "vim", + "lua", + "html", + "css", + "javascript", + "typescript", + "tsx", + "c", + "markdown", + "markdown_inline", + }, + indent = { + enable = true, + -- disable = { + -- "python" + -- }, + }, +} + +M.mason = { + ensure_installed = { + -- lua stuff + "lua-language-server", + "stylua", + + -- web dev stuff + "css-lsp", + "html-lsp", + "typescript-language-server", + "deno", + "prettier", + + -- c/cpp stuff + "clangd", + "clang-format", + }, +} + +-- git support in nvimtree +M.nvimtree = { + git = { + enable = true, + }, + + renderer = { + highlight_git = true, + icons = { + show = { + git = true, + }, + }, + }, +} + +return M diff --git a/nvchad/.config/nvim/lua/custom/highlights.lua b/nvchad/.config/nvim/lua/custom/highlights.lua new file mode 100644 index 0000000..ebf2dfb --- /dev/null +++ b/nvchad/.config/nvim/lua/custom/highlights.lua @@ -0,0 +1,19 @@ +-- To find any highlight groups: " Telescope highlights" +-- Each highlight group can take a table with variables fg, bg, bold, italic, etc +-- base30 variable names can also be used as colors + +local M = {} + +---@type Base46HLGroupsList +M.override = { + Comment = { + italic = true, + }, +} + +---@type HLTable +M.add = { + NvimTreeOpenedFolderName = { fg = "green", bold = true }, +} + +return M diff --git a/nvchad/.config/nvim/lua/custom/init.lua b/nvchad/.config/nvim/lua/custom/init.lua new file mode 100644 index 0000000..608a8d9 --- /dev/null +++ b/nvchad/.config/nvim/lua/custom/init.lua @@ -0,0 +1,7 @@ +-- local autocmd = vim.api.nvim_create_autocmd + +-- Auto resize panes when resizing nvim window +-- autocmd("VimResized", { +-- pattern = "*", +-- command = "tabdo wincmd =", +-- }) diff --git a/nvchad/.config/nvim/lua/custom/mappings.lua b/nvchad/.config/nvim/lua/custom/mappings.lua new file mode 100644 index 0000000..b9c8aa6 --- /dev/null +++ b/nvchad/.config/nvim/lua/custom/mappings.lua @@ -0,0 +1,24 @@ +---@type MappingsTable +local M = {} + +M.general = { + n = { + [";"] = { ":", "enter command mode", opts = { nowait = true } }, + + -- format with conform + ["fm"] = { + function() + require("conform").format() + end, + "formatting", + } + + }, + v = { + [">"] = { ">gv", "indent"}, + }, +} + +-- more keybinds! + +return M diff --git a/nvchad/.config/nvim/lua/custom/plugins.lua b/nvchad/.config/nvim/lua/custom/plugins.lua new file mode 100644 index 0000000..9d09d71 --- /dev/null +++ b/nvchad/.config/nvim/lua/custom/plugins.lua @@ -0,0 +1,65 @@ +local overrides = require("custom.configs.overrides") + +---@type NvPluginSpec[] +local plugins = { + + -- Override plugin definition options + + { + "neovim/nvim-lspconfig", + config = function() + require "plugins.configs.lspconfig" + require "custom.configs.lspconfig" + end, -- Override to setup mason-lspconfig + }, + + -- override plugin configs + { + "williamboman/mason.nvim", + opts = overrides.mason + }, + + { + "nvim-treesitter/nvim-treesitter", + opts = overrides.treesitter, + }, + + { + "nvim-tree/nvim-tree.lua", + opts = overrides.nvimtree, + }, + + -- Install a plugin + { + "max397574/better-escape.nvim", + event = "InsertEnter", + config = function() + require("better_escape").setup() + end, + }, + + { + "stevearc/conform.nvim", + -- for users those who want auto-save conform + lazyloading! + -- event = "BufWritePre" + config = function() + require "custom.configs.conform" + end, + }, + + -- To make a plugin not be loaded + -- { + -- "NvChad/nvim-colorizer.lua", + -- enabled = false + -- }, + + -- All NvChad plugins are lazy-loaded by default + -- For a plugin to be loaded, you will need to set either `ft`, `cmd`, `keys`, `event`, or set `lazy = false` + -- If you want a plugin to load on startup, add `lazy = false` to a plugin spec, for example + -- { + -- "mg979/vim-visual-multi", + -- lazy = false, + -- } +} + +return plugins From f0572acb275feb48bccb7f878ca9121af6e048b7 Mon Sep 17 00:00:00 2001 From: Elias Almqvist Date: Fri, 19 Jan 2024 21:08:54 +0100 Subject: [PATCH 5/8] feat: NvChad binds --- .../nvim/lua/custom/configs/conform.lua | 43 +++++++++++-------- nvchad/.config/nvim/lua/custom/mappings.lua | 31 +++++++------ 2 files changed, 42 insertions(+), 32 deletions(-) diff --git a/nvchad/.config/nvim/lua/custom/configs/conform.lua b/nvchad/.config/nvim/lua/custom/configs/conform.lua index bdb5000..17e6f0b 100644 --- a/nvchad/.config/nvim/lua/custom/configs/conform.lua +++ b/nvchad/.config/nvim/lua/custom/configs/conform.lua @@ -1,28 +1,33 @@ local options = { - lsp_fallback = true, + lsp_fallback = true, - formatters_by_ft = { - -- Divine Intellect Languages - lua = { "stylua" }, + formatters_by_ft = { + -- Divine Intellect Languages + lua = { "stylua" }, - -- Web Dev shit - javascript = { "prettier" }, - typescript = { "prettier" }, - css = { "prettier" }, - scss = { "prettier" }, - html = { "prettier" }, + -- Web Dev shit + javascript = { "prettier" }, + typescript = { "prettier" }, + javascriptreact = { "prettier" }, + typescriptreact = { "prettier" }, + css = { "prettier" }, + scss = { "prettier" }, + html = { "prettier" }, - sh = { "shfmt" }, - }, + -- Data Science & AI stuff + python = { "black" }, - -- adding same formatter for multiple filetypes can look too much work for some - -- instead of the above code you could just use a loop! the config is just a table after all! + sh = { "shfmt" }, + }, - -- format_on_save = { - -- -- These options will be passed to conform.format() - -- timeout_ms = 500, - -- lsp_fallback = true, - -- }, + -- adding same formatter for multiple filetypes can look too much work for some + -- instead of the above code you could just use a loop! the config is just a table after all! + + -- format_on_save = { + -- -- These options will be passed to conform.format() + -- timeout_ms = 500, + -- lsp_fallback = true, + -- }, } require("conform").setup(options) diff --git a/nvchad/.config/nvim/lua/custom/mappings.lua b/nvchad/.config/nvim/lua/custom/mappings.lua index b9c8aa6..e23127b 100644 --- a/nvchad/.config/nvim/lua/custom/mappings.lua +++ b/nvchad/.config/nvim/lua/custom/mappings.lua @@ -2,21 +2,26 @@ local M = {} M.general = { - n = { - [";"] = { ":", "enter command mode", opts = { nowait = true } }, + n = { + [";"] = { ":", "enter command mode", opts = { nowait = true } }, - -- format with conform - ["fm"] = { - function() - require("conform").format() - end, - "formatting", - } + -- format with conform + ["fm"] = { + function() + require("conform").format() + end, + "formatting", + }, + }, + v = { + [">"] = { ">gv", "indent" }, + }, - }, - v = { - [">"] = { ">gv", "indent"}, - }, + s = { + -- Move up and down when selected + ["J"] = { ":m '>+1gv=gv" }, + ["K"] = { ":m '<-2gv=gv" }, + }, } -- more keybinds! From 5cf86f505a768bcaad581b9c7e2a62f563e22f99 Mon Sep 17 00:00:00 2001 From: Elias Almqvist Date: Fri, 19 Jan 2024 21:23:43 +0100 Subject: [PATCH 6/8] feat: Copilot for NvChad --- nvchad/.config/nvim/lua/custom/mappings.lua | 10 ++++++++++ nvchad/.config/nvim/lua/custom/plugins.lua | 13 +++++++++++++ 2 files changed, 23 insertions(+) diff --git a/nvchad/.config/nvim/lua/custom/mappings.lua b/nvchad/.config/nvim/lua/custom/mappings.lua index e23127b..d7ac9a8 100644 --- a/nvchad/.config/nvim/lua/custom/mappings.lua +++ b/nvchad/.config/nvim/lua/custom/mappings.lua @@ -22,6 +22,16 @@ M.general = { ["J"] = { ":m '>+1gv=gv" }, ["K"] = { ":m '<-2gv=gv" }, }, + + i = { + [""] = { + function() + vim.fn.feedkeys(vim.fn["copilot#Accept"](), "") + end, + "Copilot Accept", + { replace_keycodes = true, nowait = true, silent = true, expr = true, noremap = true }, + }, + }, } -- more keybinds! diff --git a/nvchad/.config/nvim/lua/custom/plugins.lua b/nvchad/.config/nvim/lua/custom/plugins.lua index 9d09d71..c4eda81 100644 --- a/nvchad/.config/nvim/lua/custom/plugins.lua +++ b/nvchad/.config/nvim/lua/custom/plugins.lua @@ -47,6 +47,19 @@ local plugins = { end, }, + { + "github/copilot.vim", + lazy = false, + config = function() + -- Mapping tab is already used by NvChad + vim.g.copilot_no_tab_map = true; + vim.g.copilot_assume_mapped = true; + vim.g.copilot_tab_fallback = ""; + -- The mapping is set to other key, see custom/lua/mappings + -- or run ch to see copilot mapping section + end + }, + -- To make a plugin not be loaded -- { -- "NvChad/nvim-colorizer.lua", From b7b552bcaaa18a2e4f25a57a735f5e0eadb04917 Mon Sep 17 00:00:00 2001 From: Elias Almqvist Date: Sat, 20 Jan 2024 13:57:22 +0100 Subject: [PATCH 7/8] fix: NvChad selection move up/down --- nvchad/.config/nvim/lua/custom/mappings.lua | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/nvchad/.config/nvim/lua/custom/mappings.lua b/nvchad/.config/nvim/lua/custom/mappings.lua index d7ac9a8..48c32b6 100644 --- a/nvchad/.config/nvim/lua/custom/mappings.lua +++ b/nvchad/.config/nvim/lua/custom/mappings.lua @@ -13,14 +13,13 @@ M.general = { "formatting", }, }, + v = { + -- Indentation [">"] = { ">gv", "indent" }, - }, - - s = { - -- Move up and down when selected - ["J"] = { ":m '>+1gv=gv" }, - ["K"] = { ":m '<-2gv=gv" }, + -- Move selection up/down with K/J + ["J"] = { ":m '>+1gv=gv", "move selection down" }, + ["K"] = { ":m '<-2gv=gv", "move selection up" }, }, i = { From 8cd13bbf26662630ddb6805fd44323224503988a Mon Sep 17 00:00:00 2001 From: Elias Almqvist Date: Mon, 22 Jan 2024 11:58:02 +0100 Subject: [PATCH 8/8] LSP Config update thing --- nvchad/.config/nvim/lua/custom/configs/lspconfig.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nvchad/.config/nvim/lua/custom/configs/lspconfig.lua b/nvchad/.config/nvim/lua/custom/configs/lspconfig.lua index 6464a3a..b823ef1 100644 --- a/nvchad/.config/nvim/lua/custom/configs/lspconfig.lua +++ b/nvchad/.config/nvim/lua/custom/configs/lspconfig.lua @@ -4,7 +4,7 @@ local capabilities = require("plugins.configs.lspconfig").capabilities local lspconfig = require "lspconfig" -- if you just want default config for the servers then put them in a table -local servers = { "html", "cssls", "tsserver", "clangd" } +local servers = { "html", "cssls", "tsserver", "clangd", "ghdl_ls" } for _, lsp in ipairs(servers) do lspconfig[lsp].setup {