From e2780cfe9d11ca89e187fb605bb3413ca75ff4f0 Mon Sep 17 00:00:00 2001 From: Philippe Zwietering Date: Sun, 9 Apr 2023 23:22:45 +0200 Subject: [PATCH 01/18] Initial commit; lsp treesitter telescope undotree formatter colors --- .gitignore | 1 + after/plugin/colors.lua | 10 +++++++ after/plugin/harpoon.lua | 9 ++++++ after/plugin/lsp.lua | 16 +++++++++++ after/plugin/neoformat.lua | 1 + after/plugin/telescope.lua | 6 ++++ after/plugin/treesitter.lua | 21 ++++++++++++++ after/plugin/undotree.lua | 1 + after/plugin/vim-fugitive.lua | 1 + init.lua | 1 + lua/flip/init.lua | 2 ++ lua/flip/packer.lua | 52 +++++++++++++++++++++++++++++++++++ lua/flip/remap.lua | 2 ++ lua/flip/set.lua | 36 ++++++++++++++++++++++++ 14 files changed, 159 insertions(+) create mode 100644 .gitignore create mode 100644 after/plugin/colors.lua create mode 100644 after/plugin/harpoon.lua create mode 100644 after/plugin/lsp.lua create mode 100644 after/plugin/neoformat.lua create mode 100644 after/plugin/telescope.lua create mode 100644 after/plugin/treesitter.lua create mode 100644 after/plugin/undotree.lua create mode 100644 after/plugin/vim-fugitive.lua create mode 100644 init.lua create mode 100644 lua/flip/init.lua create mode 100644 lua/flip/packer.lua create mode 100644 lua/flip/remap.lua create mode 100644 lua/flip/set.lua diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d547881 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +packer_compiled.lua diff --git a/after/plugin/colors.lua b/after/plugin/colors.lua new file mode 100644 index 0000000..ede8c07 --- /dev/null +++ b/after/plugin/colors.lua @@ -0,0 +1,10 @@ +function ColorMyPencils(color) + color = color or "monokai" + vim.cmd.colorscheme(color) + + vim.api.nvim_set_hl(0, "Normal", { bg = "none" }) + vim.api.nvim_set_hl(0, "NormalFloat", { bg = "none" }) + +end + +ColorMyPencils() diff --git a/after/plugin/harpoon.lua b/after/plugin/harpoon.lua new file mode 100644 index 0000000..50033d5 --- /dev/null +++ b/after/plugin/harpoon.lua @@ -0,0 +1,9 @@ +local mark = require("harpoon.mark") +local ui = require("harpoon.ui") + +vim.keymap.set("n", "a", mark.add_file) +vim.keymap.set("n", "", ui.toggle_quick_menu) +vim.keymap.set("n", "", function() ui.nav_file(1) end) +vim.keymap.set("n", "", function() ui.nav_file(2) end) +vim.keymap.set("n", "", function() ui.nav_file(3) end) +vim.keymap.set("n", "", function() ui.nav_file(4) end) diff --git a/after/plugin/lsp.lua b/after/plugin/lsp.lua new file mode 100644 index 0000000..54fca2c --- /dev/null +++ b/after/plugin/lsp.lua @@ -0,0 +1,16 @@ +local lsp = require('lsp-zero').preset({}) + +lsp.ensure_installed({ + 'lua_ls', -- Lua + 'rust_analyzer', -- rust + 'texlab', -- LaTeX + 'clangd', -- C/C++ + 'jedi_language_server', -- Python +}) + +lsp.on_attach(function(client, bufnr) + lsp.default_keymaps({buffer = bufnr}) +end) + + +lsp.setup() diff --git a/after/plugin/neoformat.lua b/after/plugin/neoformat.lua new file mode 100644 index 0000000..2991492 --- /dev/null +++ b/after/plugin/neoformat.lua @@ -0,0 +1 @@ +vim.keymap.set('n', 'f', vim.cmd.Neoformat) diff --git a/after/plugin/telescope.lua b/after/plugin/telescope.lua new file mode 100644 index 0000000..4806008 --- /dev/null +++ b/after/plugin/telescope.lua @@ -0,0 +1,6 @@ +local builtin = require('telescope.builtin') +vim.keymap.set('n', 'pf', builtin.find_files, {}) +vim.keymap.set('n', '', builtin.git_files, {}) +vim.keymap.set('n', 'ps', function() + builtin.grep_string({ search = vim.fn.input("Grep > ") }); +end) diff --git a/after/plugin/treesitter.lua b/after/plugin/treesitter.lua new file mode 100644 index 0000000..351cb00 --- /dev/null +++ b/after/plugin/treesitter.lua @@ -0,0 +1,21 @@ +require'nvim-treesitter.configs'.setup { + -- A list of parser names, or "all" (the five listed parsers should always be installed) + ensure_installed = { "c", "lua", "vim", "vimdoc", "query", "rust", "cpp", "cmake", "latex", "python" }, + + -- Install parsers synchronously (only applied to `ensure_installed`) + sync_install = false, + + -- Automatically install missing parsers when entering buffer + -- Recommendation: set to false if you don't have `tree-sitter` CLI installed locally + auto_install = true, + + highlight = { + enable = true, + + -- Setting this to true will run `:h syntax` and tree-sitter at the same time. + -- Set this to `true` if you depend on 'syntax' being enabled (like for indentation). + -- Using this option may slow down your editor, and you may see some duplicate highlights. + -- Instead of true it can also be a list of languages + additional_vim_regex_highlighting = false, + }, +} diff --git a/after/plugin/undotree.lua b/after/plugin/undotree.lua new file mode 100644 index 0000000..b6b9276 --- /dev/null +++ b/after/plugin/undotree.lua @@ -0,0 +1 @@ +vim.keymap.set("n", "u", vim.cmd.UndotreeToggle) diff --git a/after/plugin/vim-fugitive.lua b/after/plugin/vim-fugitive.lua new file mode 100644 index 0000000..80c9070 --- /dev/null +++ b/after/plugin/vim-fugitive.lua @@ -0,0 +1 @@ +vim.keymap.set("n", "gs", vim.cmd.Git) diff --git a/init.lua b/init.lua new file mode 100644 index 0000000..5f6fb8d --- /dev/null +++ b/init.lua @@ -0,0 +1 @@ +require("flip") diff --git a/lua/flip/init.lua b/lua/flip/init.lua new file mode 100644 index 0000000..c1c1118 --- /dev/null +++ b/lua/flip/init.lua @@ -0,0 +1,2 @@ +require("flip.remap") +require("flip.set") diff --git a/lua/flip/packer.lua b/lua/flip/packer.lua new file mode 100644 index 0000000..a7c1345 --- /dev/null +++ b/lua/flip/packer.lua @@ -0,0 +1,52 @@ +-- This file can be loaded by calling `lua require('plugins')` from your init.vim + +-- Only required if you have packer configured as `opt` +vim.cmd [[packadd packer.nvim]] + +return require('packer').startup(function(use) + -- Packer can manage itself + use 'wbthomason/packer.nvim' + + use { + 'nvim-telescope/telescope.nvim', tag = '0.1.1', + -- or , branch = '0.1.x', + requires = { {'nvim-lua/plenary.nvim'} } + } + + use ({ + 'tanvirtin/monokai.nvim', + as = 'monokai', + config = function() + vim.cmd('colorscheme monokai') + end + }) + + use ('nvim-treesitter/nvim-treesitter', {run = ':TSUpdate'}) + use ('nvim-treesitter/playground') + use ('theprimeagen/harpoon') + use ('mbbill/undotree') + use ('tpope/vim-fugitive') + use ('sbdchd/neoformat') + + use { + 'VonHeikemen/lsp-zero.nvim', + branch = 'v2.x', + requires = { + -- LSP Support + {'neovim/nvim-lspconfig'}, -- Required + { -- Optional + 'williamboman/mason.nvim', + run = function() + pcall(vim.cmd, 'MasonUpdate') + end, + }, + {'williamboman/mason-lspconfig.nvim'}, -- Optional + + -- Autocompletion + {'hrsh7th/nvim-cmp'}, -- Required + {'hrsh7th/cmp-nvim-lsp'}, -- Required + {'L3MON4D3/LuaSnip'}, -- Required + } + } + +end) diff --git a/lua/flip/remap.lua b/lua/flip/remap.lua new file mode 100644 index 0000000..b760350 --- /dev/null +++ b/lua/flip/remap.lua @@ -0,0 +1,2 @@ +vim.g.mapleader = " " +vim.keymap.set("n", "pv", vim.cmd.Ex) diff --git a/lua/flip/set.lua b/lua/flip/set.lua new file mode 100644 index 0000000..a801071 --- /dev/null +++ b/lua/flip/set.lua @@ -0,0 +1,36 @@ +-- Setting line numbers +vim.opt.nu = true +vim.opt.relativenumber = true + +-- Setting tabs correctly +vim.opt.tabstop = 4 +vim.opt.softtabstop = 4 +vim.opt.shiftwidth = 4 +vim.opt.expandtab = true + +vim.opt.smartindent = true + +-- Setting backup / undo stuff +vim.opt.swapfile = false +vim.opt.backup = false +vim.opt.undodir = os.getenv("HOME") .. "/.vim/undodir" +vim.opt.undofile = true + +-- Search highlighting +vim.opt.hlsearch = false +vim.opt.incsearch = true + +-- Colouring +vim.opt.termguicolors = true + +-- Scrolling stuff +vim.opt.scrolloff = 8 +vim.opt.signcolumn = "yes" +vim.opt.isfname:append("@-@") + +-- Update time +vim.opt.updatetime = 50 + +vim.opt.colorcolumn = "120" + +vim.g.mapleader = " " From 256497cbaac713b777d04357b1f67b7a63934e27 Mon Sep 17 00:00:00 2001 From: Philippe Zwietering Date: Thu, 13 Apr 2023 13:43:57 +0200 Subject: [PATCH 02/18] Added vim to lsp global variables in order to remove warnings --- after/plugin/lsp.lua | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/after/plugin/lsp.lua b/after/plugin/lsp.lua index 54fca2c..b2422e1 100644 --- a/after/plugin/lsp.lua +++ b/after/plugin/lsp.lua @@ -8,6 +8,28 @@ lsp.ensure_installed({ 'jedi_language_server', -- Python }) +-- Fix undefined global 'vim' +lsp.configure('lua_ls', { + cmd = { 'lua-language-server' }, + settings = { + Lua = { + runtime = { + version = 'LuaJIT', + path = vim.split(package.path, ';'), + }, + diagnostics = { + globals = { 'vim' }, + }, + workspace = { + library = { + [vim.fn.expand('$VIMRUNTIME/lua')] = true, + [vim.fn.expand('$VIMRUNTIME/lua/vim/lsp')] = true, + }, + }, + }, + }, +}) + lsp.on_attach(function(client, bufnr) lsp.default_keymaps({buffer = bufnr}) end) From 4506255eabdf61680147ad4b7b9f377524cd8b55 Mon Sep 17 00:00:00 2001 From: Philippe Zwietering Date: Thu, 13 Apr 2023 16:58:34 +0200 Subject: [PATCH 03/18] Changed formatting to just use LSP ones and added some remaps --- after/plugin/neoformat.lua | 1 - lua/flip/packer.lua | 4 +++- lua/flip/remap.lua | 12 ++++++++++++ 3 files changed, 15 insertions(+), 2 deletions(-) delete mode 100644 after/plugin/neoformat.lua diff --git a/after/plugin/neoformat.lua b/after/plugin/neoformat.lua deleted file mode 100644 index 2991492..0000000 --- a/after/plugin/neoformat.lua +++ /dev/null @@ -1 +0,0 @@ -vim.keymap.set('n', 'f', vim.cmd.Neoformat) diff --git a/lua/flip/packer.lua b/lua/flip/packer.lua index a7c1345..f0fc2fa 100644 --- a/lua/flip/packer.lua +++ b/lua/flip/packer.lua @@ -13,6 +13,7 @@ return require('packer').startup(function(use) requires = { {'nvim-lua/plenary.nvim'} } } + -- Color stuff use ({ 'tanvirtin/monokai.nvim', as = 'monokai', @@ -21,13 +22,14 @@ return require('packer').startup(function(use) end }) + -- Miscellaneous packages that fit on a line use ('nvim-treesitter/nvim-treesitter', {run = ':TSUpdate'}) use ('nvim-treesitter/playground') use ('theprimeagen/harpoon') use ('mbbill/undotree') use ('tpope/vim-fugitive') - use ('sbdchd/neoformat') + -- LSP stuff use { 'VonHeikemen/lsp-zero.nvim', branch = 'v2.x', diff --git a/lua/flip/remap.lua b/lua/flip/remap.lua index b760350..8c8be4f 100644 --- a/lua/flip/remap.lua +++ b/lua/flip/remap.lua @@ -1,2 +1,14 @@ +-- Leader is space now vim.g.mapleader = " " +-- Project View instead of :Ex vim.keymap.set("n", "pv", vim.cmd.Ex) + +-- Easily move up and down +vim.keymap.set("v", "J", ":m '>+1gv=gv") +vim.keymap.set("v", "K", ":m '<-2gv=gv") + +-- Slide lines below into the current one +vim.keymap.set("n", "J", "mzJ`z") + +-- Auto formatting +vim.keymap.set("n", "f", vim.lsp.buf.format) From 85ebffbfbe0b2916d59c9b7ee4afa05f47f48ad6 Mon Sep 17 00:00:00 2001 From: Philippe Zwietering Date: Thu, 13 Apr 2023 19:23:58 +0200 Subject: [PATCH 04/18] Added icons in sign column --- after/plugin/lsp.lua | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/after/plugin/lsp.lua b/after/plugin/lsp.lua index b2422e1..b3190aa 100644 --- a/after/plugin/lsp.lua +++ b/after/plugin/lsp.lua @@ -30,9 +30,15 @@ lsp.configure('lua_ls', { }, }) -lsp.on_attach(function(client, bufnr) +lsp.on_attach(function(_, bufnr) lsp.default_keymaps({buffer = bufnr}) end) +lsp.set_sign_icons({ + error = '✘', + warn = '▲', + hint = '⚑', + info = '»' +}) lsp.setup() From f21400872f9ef7baab98229105c01652783c9491 Mon Sep 17 00:00:00 2001 From: Philippe Zwietering Date: Tue, 25 Apr 2023 15:39:25 +0200 Subject: [PATCH 05/18] Finally found a freakin colorblind friendly neovim colorscheme --- after/plugin/colors.lua | 2 +- lua/flip/packer.lua | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/after/plugin/colors.lua b/after/plugin/colors.lua index ede8c07..4f0ae84 100644 --- a/after/plugin/colors.lua +++ b/after/plugin/colors.lua @@ -1,5 +1,5 @@ function ColorMyPencils(color) - color = color or "monokai" + color = color or "dichromatic" vim.cmd.colorscheme(color) vim.api.nvim_set_hl(0, "Normal", { bg = "none" }) diff --git a/lua/flip/packer.lua b/lua/flip/packer.lua index f0fc2fa..b75ee65 100644 --- a/lua/flip/packer.lua +++ b/lua/flip/packer.lua @@ -15,10 +15,9 @@ return require('packer').startup(function(use) -- Color stuff use ({ - 'tanvirtin/monokai.nvim', - as = 'monokai', + 'romainl/vim-dichromatic', config = function() - vim.cmd('colorscheme monokai') + vim.cmd('colorscheme dichromatic') end }) From 744f7b8d6eb6333a7bd71fa600851c72401e3cdd Mon Sep 17 00:00:00 2001 From: Philippe Zwietering Date: Thu, 27 Apr 2023 20:43:54 +0200 Subject: [PATCH 06/18] Changed cursor to always be in the middle when scrolling --- lua/flip/set.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/flip/set.lua b/lua/flip/set.lua index a801071..70b044d 100644 --- a/lua/flip/set.lua +++ b/lua/flip/set.lua @@ -24,7 +24,7 @@ vim.opt.incsearch = true vim.opt.termguicolors = true -- Scrolling stuff -vim.opt.scrolloff = 8 +vim.opt.scrolloff = 999 vim.opt.signcolumn = "yes" vim.opt.isfname:append("@-@") From 67c5853235c3500b383e87fc02999daf92352ac1 Mon Sep 17 00:00:00 2001 From: Philippe Zwietering Date: Thu, 11 May 2023 21:56:08 +0200 Subject: [PATCH 07/18] Added html and js lsp and changed the line shifting to just 20 rules instead of staying in the middle forever --- after/plugin/lsp.lua | 2 ++ lua/flip/set.lua | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/after/plugin/lsp.lua b/after/plugin/lsp.lua index b3190aa..8076343 100644 --- a/after/plugin/lsp.lua +++ b/after/plugin/lsp.lua @@ -6,6 +6,8 @@ lsp.ensure_installed({ 'texlab', -- LaTeX 'clangd', -- C/C++ 'jedi_language_server', -- Python + 'html', -- HTML + 'tsserver', -- JavaScript }) -- Fix undefined global 'vim' diff --git a/lua/flip/set.lua b/lua/flip/set.lua index 70b044d..3547a68 100644 --- a/lua/flip/set.lua +++ b/lua/flip/set.lua @@ -24,7 +24,7 @@ vim.opt.incsearch = true vim.opt.termguicolors = true -- Scrolling stuff -vim.opt.scrolloff = 999 +vim.opt.scrolloff = 20 vim.opt.signcolumn = "yes" vim.opt.isfname:append("@-@") From 676756b043b90e86204ca46602461b224b284f33 Mon Sep 17 00:00:00 2001 From: Philippe Zwietering Date: Tue, 3 Oct 2023 20:38:45 +0200 Subject: [PATCH 08/18] Added ocaml lsp --- after/plugin/lsp.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/after/plugin/lsp.lua b/after/plugin/lsp.lua index 8076343..d834988 100644 --- a/after/plugin/lsp.lua +++ b/after/plugin/lsp.lua @@ -8,6 +8,7 @@ lsp.ensure_installed({ 'jedi_language_server', -- Python 'html', -- HTML 'tsserver', -- JavaScript + 'ocamllsp', -- OCaml }) -- Fix undefined global 'vim' From c6cd765b259f52e5de97e3ae01b8fa1dde9c1a32 Mon Sep 17 00:00:00 2001 From: Philippe Zwietering Date: Sat, 20 Apr 2024 11:46:20 +0200 Subject: [PATCH 09/18] Bumped up telsecope version --- lua/flip/init.lua | 1 + lua/flip/packer.lua | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/lua/flip/init.lua b/lua/flip/init.lua index c1c1118..ee282f3 100644 --- a/lua/flip/init.lua +++ b/lua/flip/init.lua @@ -1,2 +1,3 @@ +require("flip.packer") require("flip.remap") require("flip.set") diff --git a/lua/flip/packer.lua b/lua/flip/packer.lua index b75ee65..34559e4 100644 --- a/lua/flip/packer.lua +++ b/lua/flip/packer.lua @@ -8,7 +8,7 @@ return require('packer').startup(function(use) use 'wbthomason/packer.nvim' use { - 'nvim-telescope/telescope.nvim', tag = '0.1.1', + 'nvim-telescope/telescope.nvim', tag = '0.1.6', -- or , branch = '0.1.x', requires = { {'nvim-lua/plenary.nvim'} } } From 590075f2c89c739c2c41e51328bc536d970a4bba Mon Sep 17 00:00:00 2001 From: Philippe Zwietering Date: Mon, 9 Sep 2024 16:39:44 +0200 Subject: [PATCH 10/18] Updated telescope version and added packer --- after/plugin/lsp.lua | 1 - lua/flip/init.lua | 1 + lua/flip/packer.lua | 2 +- 3 files changed, 2 insertions(+), 2 deletions(-) diff --git a/after/plugin/lsp.lua b/after/plugin/lsp.lua index d834988..3ea845f 100644 --- a/after/plugin/lsp.lua +++ b/after/plugin/lsp.lua @@ -7,7 +7,6 @@ lsp.ensure_installed({ 'clangd', -- C/C++ 'jedi_language_server', -- Python 'html', -- HTML - 'tsserver', -- JavaScript 'ocamllsp', -- OCaml }) diff --git a/lua/flip/init.lua b/lua/flip/init.lua index c1c1118..ee282f3 100644 --- a/lua/flip/init.lua +++ b/lua/flip/init.lua @@ -1,2 +1,3 @@ +require("flip.packer") require("flip.remap") require("flip.set") diff --git a/lua/flip/packer.lua b/lua/flip/packer.lua index b75ee65..6c6d314 100644 --- a/lua/flip/packer.lua +++ b/lua/flip/packer.lua @@ -8,7 +8,7 @@ return require('packer').startup(function(use) use 'wbthomason/packer.nvim' use { - 'nvim-telescope/telescope.nvim', tag = '0.1.1', + 'nvim-telescope/telescope.nvim', tag = '0.1.4', -- or , branch = '0.1.x', requires = { {'nvim-lua/plenary.nvim'} } } From 62a5f9c8be06d0647911fbab0821e4a93fb23f4e Mon Sep 17 00:00:00 2001 From: Philippe Zwietering Date: Tue, 10 Sep 2024 09:08:31 +0200 Subject: [PATCH 11/18] Mainly alignment --- after/plugin/colors.lua | 11 ++--- after/plugin/harpoon.lua | 8 ++-- after/plugin/lsp.lua | 24 +++++------ after/plugin/telescope.lua | 2 +- after/plugin/treesitter.lua | 33 +++++++-------- lua/flip/packer.lua | 81 ++++++++++++++++++------------------- lua/flip/set.lua | 1 - 7 files changed, 80 insertions(+), 80 deletions(-) diff --git a/after/plugin/colors.lua b/after/plugin/colors.lua index 4f0ae84..6ed540d 100644 --- a/after/plugin/colors.lua +++ b/after/plugin/colors.lua @@ -1,10 +1,11 @@ function ColorMyPencils(color) - color = color or "dichromatic" - vim.cmd.colorscheme(color) - - vim.api.nvim_set_hl(0, "Normal", { bg = "none" }) - vim.api.nvim_set_hl(0, "NormalFloat", { bg = "none" }) + color = color or "dichromatic" + vim.cmd.colorscheme(color) + vim.api.nvim_set_hl(0, "Normal", { bg = "none" }) + vim.api.nvim_set_hl(0, "NormalFloat", { bg = "none" }) end +vim.keymap.set("n", "c", function() ColorMyPencils() end) + ColorMyPencils() diff --git a/after/plugin/harpoon.lua b/after/plugin/harpoon.lua index 50033d5..bb6834d 100644 --- a/after/plugin/harpoon.lua +++ b/after/plugin/harpoon.lua @@ -3,7 +3,7 @@ local ui = require("harpoon.ui") vim.keymap.set("n", "a", mark.add_file) vim.keymap.set("n", "", ui.toggle_quick_menu) -vim.keymap.set("n", "", function() ui.nav_file(1) end) -vim.keymap.set("n", "", function() ui.nav_file(2) end) -vim.keymap.set("n", "", function() ui.nav_file(3) end) -vim.keymap.set("n", "", function() ui.nav_file(4) end) +vim.keymap.set("n", "1", function() ui.nav_file(1) end) +vim.keymap.set("n", "2", function() ui.nav_file(2) end) +vim.keymap.set("n", "3", function() ui.nav_file(3) end) +vim.keymap.set("n", "4", function() ui.nav_file(4) end) diff --git a/after/plugin/lsp.lua b/after/plugin/lsp.lua index 3ea845f..406078f 100644 --- a/after/plugin/lsp.lua +++ b/after/plugin/lsp.lua @@ -1,13 +1,13 @@ local lsp = require('lsp-zero').preset({}) lsp.ensure_installed({ - 'lua_ls', -- Lua - 'rust_analyzer', -- rust - 'texlab', -- LaTeX - 'clangd', -- C/C++ - 'jedi_language_server', -- Python - 'html', -- HTML - 'ocamllsp', -- OCaml + 'lua_ls', -- Lua + 'rust_analyzer', -- rust + 'texlab', -- LaTeX + 'clangd', -- C/C++ + 'jedi_language_server', -- Python + 'html', -- HTML + 'ocamllsp', -- OCaml }) -- Fix undefined global 'vim' @@ -33,14 +33,14 @@ lsp.configure('lua_ls', { }) lsp.on_attach(function(_, bufnr) - lsp.default_keymaps({buffer = bufnr}) + lsp.default_keymaps({ buffer = bufnr }) end) lsp.set_sign_icons({ - error = '✘', - warn = '▲', - hint = '⚑', - info = '»' + error = '✘', + warn = '▲', + hint = '⚑', + info = '»' }) lsp.setup() diff --git a/after/plugin/telescope.lua b/after/plugin/telescope.lua index 4806008..2b36359 100644 --- a/after/plugin/telescope.lua +++ b/after/plugin/telescope.lua @@ -2,5 +2,5 @@ local builtin = require('telescope.builtin') vim.keymap.set('n', 'pf', builtin.find_files, {}) vim.keymap.set('n', '', builtin.git_files, {}) vim.keymap.set('n', 'ps', function() - builtin.grep_string({ search = vim.fn.input("Grep > ") }); + builtin.grep_string({ search = vim.fn.input("Grep > ") }); end) diff --git a/after/plugin/treesitter.lua b/after/plugin/treesitter.lua index 351cb00..8621d8e 100644 --- a/after/plugin/treesitter.lua +++ b/after/plugin/treesitter.lua @@ -1,21 +1,22 @@ -require'nvim-treesitter.configs'.setup { - -- A list of parser names, or "all" (the five listed parsers should always be installed) - ensure_installed = { "c", "lua", "vim", "vimdoc", "query", "rust", "cpp", "cmake", "latex", "python" }, +require 'nvim-treesitter.configs'.setup { + -- A list of parser names, or "all" (the five listed parsers should always be installed) + ensure_installed = { "c", "lua", "vim", "vimdoc", "query", "rust", "cpp", "cmake", "latex", "python", "groovy", + "ocaml" }, - -- Install parsers synchronously (only applied to `ensure_installed`) - sync_install = false, + -- Install parsers synchronously (only applied to `ensure_installed`) + sync_install = false, - -- Automatically install missing parsers when entering buffer - -- Recommendation: set to false if you don't have `tree-sitter` CLI installed locally - auto_install = true, + -- Automatically install missing parsers when entering buffer + -- Recommendation: set to false if you don't have `tree-sitter` CLI installed locally + auto_install = true, - highlight = { - enable = true, + highlight = { + enable = true, - -- Setting this to true will run `:h syntax` and tree-sitter at the same time. - -- Set this to `true` if you depend on 'syntax' being enabled (like for indentation). - -- Using this option may slow down your editor, and you may see some duplicate highlights. - -- Instead of true it can also be a list of languages - additional_vim_regex_highlighting = false, - }, + -- Setting this to true will run `:h syntax` and tree-sitter at the same time. + -- Set this to `true` if you depend on 'syntax' being enabled (like for indentation). + -- Using this option may slow down your editor, and you may see some duplicate highlights. + -- Instead of true it can also be a list of languages + additional_vim_regex_highlighting = false, + }, } diff --git a/lua/flip/packer.lua b/lua/flip/packer.lua index 34559e4..fae3c28 100644 --- a/lua/flip/packer.lua +++ b/lua/flip/packer.lua @@ -4,50 +4,49 @@ vim.cmd [[packadd packer.nvim]] return require('packer').startup(function(use) - -- Packer can manage itself - use 'wbthomason/packer.nvim' + -- Packer can manage itself + use 'wbthomason/packer.nvim' - use { - 'nvim-telescope/telescope.nvim', tag = '0.1.6', - -- or , branch = '0.1.x', - requires = { {'nvim-lua/plenary.nvim'} } - } + use { + 'nvim-telescope/telescope.nvim', tag = '0.1.6', + -- or , branch = '0.1.x', + requires = { { 'nvim-lua/plenary.nvim' } } + } - -- Color stuff - use ({ - 'romainl/vim-dichromatic', - config = function() - vim.cmd('colorscheme dichromatic') - end - }) + -- Color stuff + use({ + 'romainl/vim-dichromatic', + config = function() + vim.cmd('colorscheme dichromatic') + end + }) - -- Miscellaneous packages that fit on a line - use ('nvim-treesitter/nvim-treesitter', {run = ':TSUpdate'}) - use ('nvim-treesitter/playground') - use ('theprimeagen/harpoon') - use ('mbbill/undotree') - use ('tpope/vim-fugitive') + -- Miscellaneous packages that fit on a line + use('nvim-treesitter/nvim-treesitter', { run = ':TSUpdate' }) + use('nvim-treesitter/playground') + use('theprimeagen/harpoon') + use('mbbill/undotree') + use('tpope/vim-fugitive') - -- LSP stuff - use { - 'VonHeikemen/lsp-zero.nvim', - branch = 'v2.x', - requires = { - -- LSP Support - {'neovim/nvim-lspconfig'}, -- Required - { -- Optional - 'williamboman/mason.nvim', - run = function() - pcall(vim.cmd, 'MasonUpdate') - end, - }, - {'williamboman/mason-lspconfig.nvim'}, -- Optional - - -- Autocompletion - {'hrsh7th/nvim-cmp'}, -- Required - {'hrsh7th/cmp-nvim-lsp'}, -- Required - {'L3MON4D3/LuaSnip'}, -- Required - } - } + -- LSP stuff + use { + 'VonHeikemen/lsp-zero.nvim', + branch = 'v2.x', + requires = { + -- LSP Support + { 'neovim/nvim-lspconfig' }, -- Required + { -- Optional + 'williamboman/mason.nvim', + run = function() + pcall(vim.cmd, 'MasonUpdate') + end, + }, + { 'williamboman/mason-lspconfig.nvim' }, -- Optional + -- Autocompletion + { 'hrsh7th/nvim-cmp' }, -- Required + { 'hrsh7th/cmp-nvim-lsp' }, -- Required + { 'L3MON4D3/LuaSnip' }, -- Required + } + } end) diff --git a/lua/flip/set.lua b/lua/flip/set.lua index 3547a68..c6cab5e 100644 --- a/lua/flip/set.lua +++ b/lua/flip/set.lua @@ -33,4 +33,3 @@ vim.opt.updatetime = 50 vim.opt.colorcolumn = "120" -vim.g.mapleader = " " From 5d49261bf2292ceb1714aacc52fb6e49fe426a59 Mon Sep 17 00:00:00 2001 From: Philippe Zwietering Date: Tue, 10 Sep 2024 11:34:07 +0200 Subject: [PATCH 12/18] Added remaps --- lua/flip/remap.lua | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/lua/flip/remap.lua b/lua/flip/remap.lua index 8c8be4f..570770d 100644 --- a/lua/flip/remap.lua +++ b/lua/flip/remap.lua @@ -12,3 +12,33 @@ vim.keymap.set("n", "J", "mzJ`z") -- Auto formatting vim.keymap.set("n", "f", vim.lsp.buf.format) + +-- Greatest remap ever +-- Delete visual selection to null and paste latest clipboard entry +vim.keymap.set("x", "p", [["_dP]]) + +-- Next greatest remap ever : asbjornHaland +-- Copy selection and line respectively to system clipboard +vim.keymap.set({ "n", "v" }, "y", [["+y]]) +vim.keymap.set("n", "Y", [["+Y]]) + +-- Delete to null +vim.keymap.set({ "n", "v" }, "d", [["_d]]) + +-- Make next and previous a bit smoother +vim.keymap.set("n", "n", "nzzzv") +vim.keymap.set("n", "N", "Nzzzv") + +-- Jump to next and previous error +vim.keymap.set("n", "", "cnextzz") +vim.keymap.set("n", "", "cprevzz") + +-- Jump to next and previous item in location list +vim.keymap.set("n", "k", "lnextzz") +vim.keymap.set("n", "j", "lprevzz") + +-- Substitute word under cursor +vim.keymap.set("n", "s", [[:%s/\<\>//gI]]) + +-- Make current file executable +vim.keymap.set("n", "x", "!chmod +x %", { silent = true }) From 51dfa688478533971862a224f3ef9afef74d5e5d Mon Sep 17 00:00:00 2001 From: Philippe Zwietering Date: Tue, 10 Sep 2024 17:25:08 +0200 Subject: [PATCH 13/18] work in progress, migrating to lazy --- lazy-lock.json | 15 ++++++ lua/flip/init.lua | 2 +- lua/flip/lazy.lua | 31 +++++++++++ lua/flip/packer.lua | 52 ------------------- {after/plugin => lua/plugins}/colors.lua | 0 {after/plugin => lua/plugins}/harpoon.lua | 0 lua/plugins/init.lua | 32 ++++++++++++ {after/plugin => lua/plugins}/lsp.lua | 0 {after/plugin => lua/plugins}/telescope.lua | 0 {after/plugin => lua/plugins}/treesitter.lua | 0 {after/plugin => lua/plugins}/undotree.lua | 0 .../plugin => lua/plugins}/vim-fugitive.lua | 0 12 files changed, 79 insertions(+), 53 deletions(-) create mode 100644 lazy-lock.json create mode 100644 lua/flip/lazy.lua delete mode 100644 lua/flip/packer.lua rename {after/plugin => lua/plugins}/colors.lua (100%) rename {after/plugin => lua/plugins}/harpoon.lua (100%) create mode 100644 lua/plugins/init.lua rename {after/plugin => lua/plugins}/lsp.lua (100%) rename {after/plugin => lua/plugins}/telescope.lua (100%) rename {after/plugin => lua/plugins}/treesitter.lua (100%) rename {after/plugin => lua/plugins}/undotree.lua (100%) rename {after/plugin => lua/plugins}/vim-fugitive.lua (100%) diff --git a/lazy-lock.json b/lazy-lock.json new file mode 100644 index 0000000..9470b8d --- /dev/null +++ b/lazy-lock.json @@ -0,0 +1,15 @@ +{ + "cmp-nvim-lsp": { "branch": "main", "commit": "39e2eda76828d88b773cc27a3f61d2ad782c922d" }, + "harpoon": { "branch": "master", "commit": "1bc17e3e42ea3c46b33c0bbad6a880792692a1b3" }, + "lazy.nvim": { "branch": "main", "commit": "48b52b5cfcf8f88ed0aff8fde573a5cc20b1306d" }, + "lsp-zero.nvim": { "branch": "v4.x", "commit": "9823b3e27deaf9f0152f3bc22f05b54f21e234e8" }, + "nvim-cmp": { "branch": "main", "commit": "ae644feb7b67bf1ce4260c231d1d4300b19c6f30" }, + "nvim-lspconfig": { "branch": "master", "commit": "056f569f71e4b726323b799b9cfacc53653bceb3" }, + "nvim-treesitter": { "branch": "master", "commit": "c436d45eeeeb78e5482cb28b59de1d7a77c93d86" }, + "playground": { "branch": "master", "commit": "ba48c6a62a280eefb7c85725b0915e021a1a0749" }, + "plenary.nvim": { "branch": "master", "commit": "ec289423a1693aeae6cd0d503bac2856af74edaa" }, + "telescope.nvim": { "branch": "master", "commit": "6312868392331c9c0f22725041f1ec2bef57c751" }, + "undotree": { "branch": "master", "commit": "56c684a805fe948936cda0d1b19505b84ad7e065" }, + "vim-dichromatic": { "branch": "master", "commit": "9765a72ce24ddae48afe12c316583a22c82ad812" }, + "vim-fugitive": { "branch": "master", "commit": "d4877e54cef67f5af4f950935b1ade19ed6b7370" } +} diff --git a/lua/flip/init.lua b/lua/flip/init.lua index ee282f3..a3d288f 100644 --- a/lua/flip/init.lua +++ b/lua/flip/init.lua @@ -1,3 +1,3 @@ -require("flip.packer") require("flip.remap") require("flip.set") +require("flip.lazy") diff --git a/lua/flip/lazy.lua b/lua/flip/lazy.lua new file mode 100644 index 0000000..122fb7f --- /dev/null +++ b/lua/flip/lazy.lua @@ -0,0 +1,31 @@ +-- Bootstrap lazy.nvim +local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" +if not (vim.uv or vim.loop).fs_stat(lazypath) then + local lazyrepo = "https://github.com/folke/lazy.nvim.git" + local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath }) + if vim.v.shell_error ~= 0 then + vim.api.nvim_echo({ + { "Failed to clone lazy.nvim:\n", "ErrorMsg" }, + { out, "WarningMsg" }, + { "\nPress any key to exit..." }, + }, true, {}) + vim.fn.getchar() + os.exit(1) + end +end +vim.opt.rtp:prepend(lazypath) + +-- Make sure to setup `mapleader` and `maplocalleader` before +-- loading lazy.nvim so that mappings are correct. This is done by loading the remap before lazy + +-- Setup lazy.nvim +require("lazy").setup({ + spec = { + -- import plugins + { import = "plugins" }, + }, + -- Configure any other settings here. See documentation for details + install = { colorscheme = { "habamax" } }, + -- automatically check for plugin updates + checker = { enabled = true }, +}) diff --git a/lua/flip/packer.lua b/lua/flip/packer.lua deleted file mode 100644 index fae3c28..0000000 --- a/lua/flip/packer.lua +++ /dev/null @@ -1,52 +0,0 @@ --- This file can be loaded by calling `lua require('plugins')` from your init.vim - --- Only required if you have packer configured as `opt` -vim.cmd [[packadd packer.nvim]] - -return require('packer').startup(function(use) - -- Packer can manage itself - use 'wbthomason/packer.nvim' - - use { - 'nvim-telescope/telescope.nvim', tag = '0.1.6', - -- or , branch = '0.1.x', - requires = { { 'nvim-lua/plenary.nvim' } } - } - - -- Color stuff - use({ - 'romainl/vim-dichromatic', - config = function() - vim.cmd('colorscheme dichromatic') - end - }) - - -- Miscellaneous packages that fit on a line - use('nvim-treesitter/nvim-treesitter', { run = ':TSUpdate' }) - use('nvim-treesitter/playground') - use('theprimeagen/harpoon') - use('mbbill/undotree') - use('tpope/vim-fugitive') - - -- LSP stuff - use { - 'VonHeikemen/lsp-zero.nvim', - branch = 'v2.x', - requires = { - -- LSP Support - { 'neovim/nvim-lspconfig' }, -- Required - { -- Optional - 'williamboman/mason.nvim', - run = function() - pcall(vim.cmd, 'MasonUpdate') - end, - }, - { 'williamboman/mason-lspconfig.nvim' }, -- Optional - - -- Autocompletion - { 'hrsh7th/nvim-cmp' }, -- Required - { 'hrsh7th/cmp-nvim-lsp' }, -- Required - { 'L3MON4D3/LuaSnip' }, -- Required - } - } -end) diff --git a/after/plugin/colors.lua b/lua/plugins/colors.lua similarity index 100% rename from after/plugin/colors.lua rename to lua/plugins/colors.lua diff --git a/after/plugin/harpoon.lua b/lua/plugins/harpoon.lua similarity index 100% rename from after/plugin/harpoon.lua rename to lua/plugins/harpoon.lua diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua new file mode 100644 index 0000000..0920b60 --- /dev/null +++ b/lua/plugins/init.lua @@ -0,0 +1,32 @@ +-- Load prerequisites for plugins here + +return { + { + "nvim-lua/plenary.nvim", + name = "plenary" + } +} + +return { + { + "nvim-telescope/telescope.nvim", + tag = "0.1.6", + requires = { + { "nvim-lua/plenary.nvim" } } + }, + { "romainl/vim-dichromatic", config = function() vim.cmd('colorscheme dichromatic') end }, + { + "nvim-treesitter/nvim-treesitter", + build = function() + require("nvim-treesitter.install").update({ with_sync = true })() + end + }, + "nvim-treesitter/playground", + "theprimeagen/harpoon", + "mbbill/undotree", + "tpope/vim-fugitive", + { 'VonHeikemen/lsp-zero.nvim', branch = 'v4.x' }, + { 'neovim/nvim-lspconfig' }, + { 'hrsh7th/cmp-nvim-lsp' }, + { 'hrsh7th/nvim-cmp' }, +} diff --git a/after/plugin/lsp.lua b/lua/plugins/lsp.lua similarity index 100% rename from after/plugin/lsp.lua rename to lua/plugins/lsp.lua diff --git a/after/plugin/telescope.lua b/lua/plugins/telescope.lua similarity index 100% rename from after/plugin/telescope.lua rename to lua/plugins/telescope.lua diff --git a/after/plugin/treesitter.lua b/lua/plugins/treesitter.lua similarity index 100% rename from after/plugin/treesitter.lua rename to lua/plugins/treesitter.lua diff --git a/after/plugin/undotree.lua b/lua/plugins/undotree.lua similarity index 100% rename from after/plugin/undotree.lua rename to lua/plugins/undotree.lua diff --git a/after/plugin/vim-fugitive.lua b/lua/plugins/vim-fugitive.lua similarity index 100% rename from after/plugin/vim-fugitive.lua rename to lua/plugins/vim-fugitive.lua From bedfd083b7159ff22147486775566ba6f39fd97e Mon Sep 17 00:00:00 2001 From: Philippe Zwietering Date: Wed, 11 Sep 2024 13:38:12 +0200 Subject: [PATCH 14/18] All plugins written to lazy instead of packer --- lazy-lock.json | 13 ++-- lua/plugins/colors.lua | 9 ++- lua/plugins/harpoon.lua | 22 ++++-- lua/plugins/init.lua | 23 ------ lua/plugins/lsp.lua | 145 +++++++++++++++++++++++++---------- lua/plugins/telescope.lua | 35 +++++++-- lua/plugins/treesitter.lua | 50 ++++++++---- lua/plugins/undotree.lua | 9 ++- lua/plugins/vim-fugitive.lua | 7 +- 9 files changed, 209 insertions(+), 104 deletions(-) diff --git a/lazy-lock.json b/lazy-lock.json index 9470b8d..0389c2a 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -1,15 +1,18 @@ { + "LuaSnip": { "branch": "master", "commit": "45db5addf8d0a201e1cf247cae4cdce605ad3768" }, "cmp-nvim-lsp": { "branch": "main", "commit": "39e2eda76828d88b773cc27a3f61d2ad782c922d" }, + "dichromatic": { "branch": "master", "commit": "9765a72ce24ddae48afe12c316583a22c82ad812" }, "harpoon": { "branch": "master", "commit": "1bc17e3e42ea3c46b33c0bbad6a880792692a1b3" }, "lazy.nvim": { "branch": "main", "commit": "48b52b5cfcf8f88ed0aff8fde573a5cc20b1306d" }, "lsp-zero.nvim": { "branch": "v4.x", "commit": "9823b3e27deaf9f0152f3bc22f05b54f21e234e8" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "25c11854aa25558ee6c03432edfa0df0217324be" }, + "mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" }, "nvim-cmp": { "branch": "main", "commit": "ae644feb7b67bf1ce4260c231d1d4300b19c6f30" }, - "nvim-lspconfig": { "branch": "master", "commit": "056f569f71e4b726323b799b9cfacc53653bceb3" }, - "nvim-treesitter": { "branch": "master", "commit": "c436d45eeeeb78e5482cb28b59de1d7a77c93d86" }, - "playground": { "branch": "master", "commit": "ba48c6a62a280eefb7c85725b0915e021a1a0749" }, + "nvim-lspconfig": { "branch": "master", "commit": "d88ae6623fef09251e3aa20001bb761686eae730" }, + "nvim-treesitter": { "branch": "master", "commit": "d22166e3d8d375b761c32b303176f3e955560b0c" }, + "plenary": { "branch": "master", "commit": "ec289423a1693aeae6cd0d503bac2856af74edaa" }, "plenary.nvim": { "branch": "master", "commit": "ec289423a1693aeae6cd0d503bac2856af74edaa" }, - "telescope.nvim": { "branch": "master", "commit": "6312868392331c9c0f22725041f1ec2bef57c751" }, + "telescope.nvim": { "branch": "master", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" }, "undotree": { "branch": "master", "commit": "56c684a805fe948936cda0d1b19505b84ad7e065" }, - "vim-dichromatic": { "branch": "master", "commit": "9765a72ce24ddae48afe12c316583a22c82ad812" }, "vim-fugitive": { "branch": "master", "commit": "d4877e54cef67f5af4f950935b1ade19ed6b7370" } } diff --git a/lua/plugins/colors.lua b/lua/plugins/colors.lua index 6ed540d..5d57592 100644 --- a/lua/plugins/colors.lua +++ b/lua/plugins/colors.lua @@ -8,4 +8,11 @@ end vim.keymap.set("n", "c", function() ColorMyPencils() end) -ColorMyPencils() +return { + "romainl/vim-dichromatic", + name = "dichromatic", + lazy = false, + config = function() + ColorMyPencils() + end +} diff --git a/lua/plugins/harpoon.lua b/lua/plugins/harpoon.lua index bb6834d..0ec521e 100644 --- a/lua/plugins/harpoon.lua +++ b/lua/plugins/harpoon.lua @@ -1,9 +1,15 @@ -local mark = require("harpoon.mark") -local ui = require("harpoon.ui") +return { + "theprimeagen/harpoon", -vim.keymap.set("n", "a", mark.add_file) -vim.keymap.set("n", "", ui.toggle_quick_menu) -vim.keymap.set("n", "1", function() ui.nav_file(1) end) -vim.keymap.set("n", "2", function() ui.nav_file(2) end) -vim.keymap.set("n", "3", function() ui.nav_file(3) end) -vim.keymap.set("n", "4", function() ui.nav_file(4) end) + config = function() + local mark = require("harpoon.mark") + local ui = require("harpoon.ui") + + vim.keymap.set("n", "a", mark.add_file) + vim.keymap.set("n", "", ui.toggle_quick_menu) + vim.keymap.set("n", "1", function() ui.nav_file(1) end) + vim.keymap.set("n", "2", function() ui.nav_file(2) end) + vim.keymap.set("n", "3", function() ui.nav_file(3) end) + vim.keymap.set("n", "4", function() ui.nav_file(4) end) + end +} diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua index 0920b60..66eebcb 100644 --- a/lua/plugins/init.lua +++ b/lua/plugins/init.lua @@ -7,26 +7,3 @@ return { } } -return { - { - "nvim-telescope/telescope.nvim", - tag = "0.1.6", - requires = { - { "nvim-lua/plenary.nvim" } } - }, - { "romainl/vim-dichromatic", config = function() vim.cmd('colorscheme dichromatic') end }, - { - "nvim-treesitter/nvim-treesitter", - build = function() - require("nvim-treesitter.install").update({ with_sync = true })() - end - }, - "nvim-treesitter/playground", - "theprimeagen/harpoon", - "mbbill/undotree", - "tpope/vim-fugitive", - { 'VonHeikemen/lsp-zero.nvim', branch = 'v4.x' }, - { 'neovim/nvim-lspconfig' }, - { 'hrsh7th/cmp-nvim-lsp' }, - { 'hrsh7th/nvim-cmp' }, -} diff --git a/lua/plugins/lsp.lua b/lua/plugins/lsp.lua index 406078f..141a5c4 100644 --- a/lua/plugins/lsp.lua +++ b/lua/plugins/lsp.lua @@ -1,46 +1,107 @@ -local lsp = require('lsp-zero').preset({}) - -lsp.ensure_installed({ - 'lua_ls', -- Lua - 'rust_analyzer', -- rust - 'texlab', -- LaTeX - 'clangd', -- C/C++ - 'jedi_language_server', -- Python - 'html', -- HTML - 'ocamllsp', -- OCaml -}) - --- Fix undefined global 'vim' -lsp.configure('lua_ls', { - cmd = { 'lua-language-server' }, - settings = { - Lua = { - runtime = { - version = 'LuaJIT', - path = vim.split(package.path, ';'), - }, - diagnostics = { - globals = { 'vim' }, - }, - workspace = { - library = { - [vim.fn.expand('$VIMRUNTIME/lua')] = true, - [vim.fn.expand('$VIMRUNTIME/lua/vim/lsp')] = true, - }, - }, - }, +return { + { + "VonHeikemen/lsp-zero.nvim", + branch = "v4.x", + lazy = true, + config = false, + }, + { + "williamboman/mason.nvim", + lazy = false, + config = true, }, -}) -lsp.on_attach(function(_, bufnr) - lsp.default_keymaps({ buffer = bufnr }) -end) + -- Autocompletion + { + "hrsh7th/nvim-cmp", + event = "InsertEnter", + dependencies = { + { "L3MON4D3/LuaSnip" }, + }, + config = function() + local cmp = require('cmp') -lsp.set_sign_icons({ - error = '✘', - warn = '▲', - hint = '⚑', - info = '»' -}) + cmp.setup({ + sources = { + { name = "nvim_lsp" }, + }, + mapping = cmp.mapping.preset.insert({ + [''] = cmp.mapping.complete(), + }), + snippet = { + expand = function(args) + vim.snippet.expand(args.body) + end, + }, + }) + end + }, -lsp.setup() + -- LSP + { + "neovim/nvim-lspconfig", + cmd = { 'LspInfo', 'LspInstall', 'LspStart' }, + event = { 'BufReadPre', 'BufNewFile' }, + dependencies = { + { "hrsh7th/cmp-nvim-lsp" }, + { "williamboman/mason.nvim" }, + { "williamboman/mason-lspconfig.nvim" }, + }, + config = function() + local lsp_zero = require('lsp-zero') + + -- lsp_attach is where you enable features that only work + -- if there is a language server active in the file + local lsp_attach = function(client, bufnr) + local opts = { buffer = bufnr } + + vim.keymap.set('n', 'K', 'lua vim.lsp.buf.hover()', opts) + vim.keymap.set('n', 'gd', 'lua vim.lsp.buf.definition()', opts) + vim.keymap.set('n', 'gD', 'lua vim.lsp.buf.declaration()', opts) + vim.keymap.set('n', 'gi', 'lua vim.lsp.buf.implementation()', opts) + vim.keymap.set('n', 'go', 'lua vim.lsp.buf.type_definition()', opts) + vim.keymap.set('n', 'gr', 'lua vim.lsp.buf.references()', opts) + vim.keymap.set('n', 'gs', 'lua vim.lsp.buf.signature_help()', opts) + vim.keymap.set('n', '', 'lua vim.lsp.buf.rename()', opts) + vim.keymap.set({ 'n', 'x' }, '', 'lua vim.lsp.buf.format({async = true})', opts) + vim.keymap.set('n', '', 'lua vim.lsp.buf.code_action()', opts) + end + + lsp_zero.extend_lspconfig({ + sign_text = true, + lsp_attach = lsp_attach, + capabilities = require('cmp_nvim_lsp').default_capabilities() + }) + + require('mason-lspconfig').setup({ + ensure_installed = {}, + handlers = { + function(server_name) + require('lspconfig')[server_name].setup({}) + end, + lua_ls = function() + require('lspconfig').lua_ls.setup({ + settings = { + Lua = { + runtime = { + version = 'LuaJIT', + path = vim.split(package.path, ';'), + }, + diagnostics = { + globals = { 'vim' }, + }, + workspace = { + library = { + [vim.fn.expand('$VIMRUNTIME/lua')] = true, + [vim.fn.expand('$VIMRUNTIME/lua/vim/lsp')] = true, + }, + }, + }, + }, + }) + end, + } + }) + end + } +} diff --git a/lua/plugins/telescope.lua b/lua/plugins/telescope.lua index 2b36359..93b76ac 100644 --- a/lua/plugins/telescope.lua +++ b/lua/plugins/telescope.lua @@ -1,6 +1,29 @@ -local builtin = require('telescope.builtin') -vim.keymap.set('n', 'pf', builtin.find_files, {}) -vim.keymap.set('n', '', builtin.git_files, {}) -vim.keymap.set('n', 'ps', function() - builtin.grep_string({ search = vim.fn.input("Grep > ") }); -end) +return { + "nvim-telescope/telescope.nvim", + + tag = "0.1.8", + + dependencies = { + "nvim-lua/plenary.nvim" + }, + + config = function() + require('telescope').setup({}) + + local builtin = require('telescope.builtin') + vim.keymap.set('n', 'pf', builtin.find_files, {}) + vim.keymap.set('n', '', builtin.git_files, {}) + vim.keymap.set('n', 'pws', function() + local word = vim.fn.expand("") + builtin.grep_string({ search = word }) + end) + vim.keymap.set('n', 'pWs', function() + local word = vim.fn.expand("") + builtin.grep_string({ search = word }) + end) + vim.keymap.set('n', 'ps', function() + builtin.grep_string({ search = vim.fn.input("Grep > ") }) + end) + vim.keymap.set('n', 'vh', builtin.help_tags, {}) + end +} diff --git a/lua/plugins/treesitter.lua b/lua/plugins/treesitter.lua index 8621d8e..97aff1e 100644 --- a/lua/plugins/treesitter.lua +++ b/lua/plugins/treesitter.lua @@ -1,22 +1,38 @@ -require 'nvim-treesitter.configs'.setup { - -- A list of parser names, or "all" (the five listed parsers should always be installed) - ensure_installed = { "c", "lua", "vim", "vimdoc", "query", "rust", "cpp", "cmake", "latex", "python", "groovy", - "ocaml" }, +return { + "nvim-treesitter/nvim-treesitter", + build = function() + require("nvim-treesitter.instal").update({ with_sync = true})() + end, + config = function() + require("nvim-treesitter.configs").setup({ + -- List of parsers + ensure_installed = { + "vimdoc", "vim", "lua", "c", "rust", "cpp", "cmake", "latex", "python", "groovy", "bash", + }, - -- Install parsers synchronously (only applied to `ensure_installed`) - sync_install = false, + sync_install = false, + auto_install = true, - -- Automatically install missing parsers when entering buffer - -- Recommendation: set to false if you don't have `tree-sitter` CLI installed locally - auto_install = true, + indent = { + enable = true + }, - highlight = { - enable = true, + highlight = { + enable = true, + additional_vim_regex_highlighting = { "markdown" }, + }, + }) - -- Setting this to true will run `:h syntax` and tree-sitter at the same time. - -- Set this to `true` if you depend on 'syntax' being enabled (like for indentation). - -- Using this option may slow down your editor, and you may see some duplicate highlights. - -- Instead of true it can also be a list of languages - additional_vim_regex_highlighting = false, - }, + local treesitter_parser_config = require("nvim-treesitter.parsers").get_parser_configs() + treesitter_parser_config.templ = { + install_info = { + url = "https://github.com/vrischmann/tree-sitter-templ.git", + files = { "src/parser.c", "src/scanner.c" }, + branch = "master", + }, + } + + vim .treesitter.language.register("templ", "templ") + end } + diff --git a/lua/plugins/undotree.lua b/lua/plugins/undotree.lua index b6b9276..a33d188 100644 --- a/lua/plugins/undotree.lua +++ b/lua/plugins/undotree.lua @@ -1 +1,8 @@ -vim.keymap.set("n", "u", vim.cmd.UndotreeToggle) +return { + "mbbill/undotree", + + config = function() + vim.keymap.set("n", "u", vim.cmd.UndoTreeToggle) + end +} + diff --git a/lua/plugins/vim-fugitive.lua b/lua/plugins/vim-fugitive.lua index 80c9070..a5b5b04 100644 --- a/lua/plugins/vim-fugitive.lua +++ b/lua/plugins/vim-fugitive.lua @@ -1 +1,6 @@ -vim.keymap.set("n", "gs", vim.cmd.Git) +return { + "tpope/vim-fugitive", + config = function() + vim.keymap.set("n", "gs", vim.cmd.Git) + end +} From 977acb17c5bfab354adf0ecc069a9be46ac4b466 Mon Sep 17 00:00:00 2001 From: Philippe Zwietering Date: Wed, 11 Sep 2024 16:16:59 +0200 Subject: [PATCH 15/18] Fixed lsp --- lazy-lock.json | 9 +- lua/flip/lazy.lua | 8 +- lua/flip/remap.lua | 3 + lua/plugins/init.lua | 1 - lua/plugins/lsp.lua | 197 +++++++++++++++++++------------------ lua/plugins/treesitter.lua | 5 +- lua/plugins/undotree.lua | 1 - 7 files changed, 117 insertions(+), 107 deletions(-) diff --git a/lazy-lock.json b/lazy-lock.json index 0389c2a..827b7f9 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -1,15 +1,20 @@ { "LuaSnip": { "branch": "master", "commit": "45db5addf8d0a201e1cf247cae4cdce605ad3768" }, + "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, + "cmp-cmdline": { "branch": "main", "commit": "d250c63aa13ead745e3a40f61fdd3470efde3923" }, "cmp-nvim-lsp": { "branch": "main", "commit": "39e2eda76828d88b773cc27a3f61d2ad782c922d" }, + "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, + "cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" }, "dichromatic": { "branch": "master", "commit": "9765a72ce24ddae48afe12c316583a22c82ad812" }, + "fidget.nvim": { "branch": "main", "commit": "d855eed8a06531a7e8fd0684889b2943f373c469" }, "harpoon": { "branch": "master", "commit": "1bc17e3e42ea3c46b33c0bbad6a880792692a1b3" }, + "hererocks": { "branch": "master", "commit": "8bd2fcfdd65cfa7535ce39ea372a63b0bdb8e528" }, "lazy.nvim": { "branch": "main", "commit": "48b52b5cfcf8f88ed0aff8fde573a5cc20b1306d" }, - "lsp-zero.nvim": { "branch": "v4.x", "commit": "9823b3e27deaf9f0152f3bc22f05b54f21e234e8" }, "mason-lspconfig.nvim": { "branch": "main", "commit": "25c11854aa25558ee6c03432edfa0df0217324be" }, "mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" }, "nvim-cmp": { "branch": "main", "commit": "ae644feb7b67bf1ce4260c231d1d4300b19c6f30" }, "nvim-lspconfig": { "branch": "master", "commit": "d88ae6623fef09251e3aa20001bb761686eae730" }, - "nvim-treesitter": { "branch": "master", "commit": "d22166e3d8d375b761c32b303176f3e955560b0c" }, + "nvim-treesitter": { "branch": "master", "commit": "b6a6d8997c46dc15682020ce4fddc5a89ee1ac0d" }, "plenary": { "branch": "master", "commit": "ec289423a1693aeae6cd0d503bac2856af74edaa" }, "plenary.nvim": { "branch": "master", "commit": "ec289423a1693aeae6cd0d503bac2856af74edaa" }, "telescope.nvim": { "branch": "master", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" }, diff --git a/lua/flip/lazy.lua b/lua/flip/lazy.lua index 122fb7f..6f520e4 100644 --- a/lua/flip/lazy.lua +++ b/lua/flip/lazy.lua @@ -15,15 +15,11 @@ if not (vim.uv or vim.loop).fs_stat(lazypath) then end vim.opt.rtp:prepend(lazypath) --- Make sure to setup `mapleader` and `maplocalleader` before --- loading lazy.nvim so that mappings are correct. This is done by loading the remap before lazy -- Setup lazy.nvim require("lazy").setup({ - spec = { - -- import plugins - { import = "plugins" }, - }, + spec = "plugins", + change_detection = { notify = false }, -- Configure any other settings here. See documentation for details install = { colorscheme = { "habamax" } }, -- automatically check for plugin updates diff --git a/lua/flip/remap.lua b/lua/flip/remap.lua index 570770d..cf67115 100644 --- a/lua/flip/remap.lua +++ b/lua/flip/remap.lua @@ -13,6 +13,9 @@ vim.keymap.set("n", "J", "mzJ`z") -- Auto formatting vim.keymap.set("n", "f", vim.lsp.buf.format) +-- Display type signature +vim.keymap.set("n", "gs", vim.lsp.buf.signature_help) + -- Greatest remap ever -- Delete visual selection to null and paste latest clipboard entry vim.keymap.set("x", "p", [["_dP]]) diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua index 66eebcb..23a62fe 100644 --- a/lua/plugins/init.lua +++ b/lua/plugins/init.lua @@ -6,4 +6,3 @@ return { name = "plenary" } } - diff --git a/lua/plugins/lsp.lua b/lua/plugins/lsp.lua index 141a5c4..b5b2a11 100644 --- a/lua/plugins/lsp.lua +++ b/lua/plugins/lsp.lua @@ -1,107 +1,116 @@ return { - { - "VonHeikemen/lsp-zero.nvim", - branch = "v4.x", - lazy = true, - config = false, - }, - { + "neovim/nvim-lspconfig", + dependencies = { "williamboman/mason.nvim", - lazy = false, - config = true, - }, - - -- Autocompletion - { + "williamboman/mason-lspconfig.nvim", + "hrsh7th/cmp-nvim-lsp", + "hrsh7th/cmp-buffer", + "hrsh7th/cmp-path", + "hrsh7th/cmp-cmdline", "hrsh7th/nvim-cmp", - event = "InsertEnter", - dependencies = { - { "L3MON4D3/LuaSnip" }, - }, - config = function() - local cmp = require('cmp') - - cmp.setup({ - sources = { - { name = "nvim_lsp" }, - }, - mapping = cmp.mapping.preset.insert({ - [''] = cmp.mapping.complete(), - }), - snippet = { - expand = function(args) - vim.snippet.expand(args.body) - end, - }, - }) - end + "L3MON4D3/LuaSnip", + "saadparwaiz1/cmp_luasnip", + "j-hui/fidget.nvim", }, - -- LSP - { - "neovim/nvim-lspconfig", - cmd = { 'LspInfo', 'LspInstall', 'LspStart' }, - event = { 'BufReadPre', 'BufNewFile' }, - dependencies = { - { "hrsh7th/cmp-nvim-lsp" }, - { "williamboman/mason.nvim" }, - { "williamboman/mason-lspconfig.nvim" }, - }, - config = function() - local lsp_zero = require('lsp-zero') + config = function() + local cmp = require('cmp') + local cmp_lsp = require("cmp_nvim_lsp") + local capabilities = vim.tbl_deep_extend( + "force", + {}, + vim.lsp.protocol.make_client_capabilities(), + cmp_lsp.default_capabilities()) - -- lsp_attach is where you enable features that only work - -- if there is a language server active in the file - local lsp_attach = function(client, bufnr) - local opts = { buffer = bufnr } + require("fidget").setup({}) + require("mason").setup() + require("mason-lspconfig").setup({ + ensure_installed = { + "clangd", + "lua_ls", + "rust_analyzer", + }, + handlers = { + function(server_name) -- default handler (optional) + require("lspconfig")[server_name].setup { + capabilities = capabilities + } + end, - vim.keymap.set('n', 'K', 'lua vim.lsp.buf.hover()', opts) - vim.keymap.set('n', 'gd', 'lua vim.lsp.buf.definition()', opts) - vim.keymap.set('n', 'gD', 'lua vim.lsp.buf.declaration()', opts) - vim.keymap.set('n', 'gi', 'lua vim.lsp.buf.implementation()', opts) - vim.keymap.set('n', 'go', 'lua vim.lsp.buf.type_definition()', opts) - vim.keymap.set('n', 'gr', 'lua vim.lsp.buf.references()', opts) - vim.keymap.set('n', 'gs', 'lua vim.lsp.buf.signature_help()', opts) - vim.keymap.set('n', '', 'lua vim.lsp.buf.rename()', opts) - vim.keymap.set({ 'n', 'x' }, '', 'lua vim.lsp.buf.format({async = true})', opts) - vim.keymap.set('n', '', 'lua vim.lsp.buf.code_action()', opts) - end - - lsp_zero.extend_lspconfig({ - sign_text = true, - lsp_attach = lsp_attach, - capabilities = require('cmp_nvim_lsp').default_capabilities() - }) - - require('mason-lspconfig').setup({ - ensure_installed = {}, - handlers = { - function(server_name) - require('lspconfig')[server_name].setup({}) - end, - lua_ls = function() - require('lspconfig').lua_ls.setup({ + zls = function() + local lspconfig = require("lspconfig") + lspconfig.zls.setup({ + root_dir = lspconfig.util.root_pattern(".git", "build.zig", "zls.json"), settings = { - Lua = { - runtime = { - version = 'LuaJIT', - path = vim.split(package.path, ';'), - }, - diagnostics = { - globals = { 'vim' }, - }, - workspace = { - library = { - [vim.fn.expand('$VIMRUNTIME/lua')] = true, - [vim.fn.expand('$VIMRUNTIME/lua/vim/lsp')] = true, - }, - }, + zls = { + enable_inlay_hints = true, + enable_snippets = true, + warn_style = true, }, }, }) - end, - } + vim.g.zig_fmt_parse_errors = 0 + vim.g.zig_fmt_autosave = 0 + end, + ["lua_ls"] = function() + local lspconfig = require("lspconfig") + lspconfig.lua_ls.setup { + capabilities = capabilities, + settings = { + Lua = { + runtime = { version = "Lua 5.1" }, + diagnostics = { + globals = { "bit", "vim", "it", "describe", "before_each", "after_each" }, + } + } + } + } + end, + } + }) + + local cmp_select = { behavior = cmp.SelectBehavior.Select } + + cmp.setup({ + snippet = { + expand = function(args) + require('luasnip').lsp_expand(args.body) -- For `luasnip` users. + end, + }, + mapping = cmp.mapping.preset.insert({ + [''] = cmp.mapping.select_prev_item(cmp_select), + [''] = cmp.mapping.select_next_item(cmp_select), + [''] = cmp.mapping.confirm({ select = true }), + [""] = cmp.mapping.complete(), + }), + sources = cmp.config.sources({ + { name = 'nvim_lsp' }, + { name = 'luasnip' }, -- For luasnip users. + }, { + { name = 'buffer' }, }) - end - } + }) + + local _border = 'rounded' + + vim.diagnostic.config({ + -- update_in_insert = true, + float = { + focusable = false, + style = "minimal", + border = _border, + source = "always", + header = "", + prefix = "", + }, + }) + + vim.lsp.handlers["textDocument/hover"] = vim.lsp.with( + vim.lsp.handlers.hover, { border = _border } + ) + vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with( + vim.lsp.handlers.signature_help, { border = _border } + ) + require('lspconfig.ui.windows').default_options = { border = _border } + end } diff --git a/lua/plugins/treesitter.lua b/lua/plugins/treesitter.lua index 97aff1e..1283ed5 100644 --- a/lua/plugins/treesitter.lua +++ b/lua/plugins/treesitter.lua @@ -1,7 +1,7 @@ return { "nvim-treesitter/nvim-treesitter", build = function() - require("nvim-treesitter.instal").update({ with_sync = true})() + require("nvim-treesitter.install").update({ with_sync = true })() end, config = function() require("nvim-treesitter.configs").setup({ @@ -32,7 +32,6 @@ return { }, } - vim .treesitter.language.register("templ", "templ") + vim.treesitter.language.register("templ", "templ") end } - diff --git a/lua/plugins/undotree.lua b/lua/plugins/undotree.lua index a33d188..5a3f1c5 100644 --- a/lua/plugins/undotree.lua +++ b/lua/plugins/undotree.lua @@ -5,4 +5,3 @@ return { vim.keymap.set("n", "u", vim.cmd.UndoTreeToggle) end } - From 7397db36062d1c171e6cfbf50889c43cbfc6eb3b Mon Sep 17 00:00:00 2001 From: Philippe Zwietering Date: Mon, 7 Oct 2024 13:15:07 +0200 Subject: [PATCH 16/18] Added lsp remaps --- lazy-lock.json | 14 +++++++------- lua/flip/remap.lua | 24 ++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 7 deletions(-) diff --git a/lazy-lock.json b/lazy-lock.json index 827b7f9..9234273 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -1,5 +1,5 @@ { - "LuaSnip": { "branch": "master", "commit": "45db5addf8d0a201e1cf247cae4cdce605ad3768" }, + "LuaSnip": { "branch": "master", "commit": "e808bee352d1a6fcf902ca1a71cee76e60e24071" }, "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, "cmp-cmdline": { "branch": "main", "commit": "d250c63aa13ead745e3a40f61fdd3470efde3923" }, "cmp-nvim-lsp": { "branch": "main", "commit": "39e2eda76828d88b773cc27a3f61d2ad782c922d" }, @@ -9,15 +9,15 @@ "fidget.nvim": { "branch": "main", "commit": "d855eed8a06531a7e8fd0684889b2943f373c469" }, "harpoon": { "branch": "master", "commit": "1bc17e3e42ea3c46b33c0bbad6a880792692a1b3" }, "hererocks": { "branch": "master", "commit": "8bd2fcfdd65cfa7535ce39ea372a63b0bdb8e528" }, - "lazy.nvim": { "branch": "main", "commit": "48b52b5cfcf8f88ed0aff8fde573a5cc20b1306d" }, + "lazy.nvim": { "branch": "main", "commit": "1159bdccd8910a0fd0914b24d6c3d186689023d9" }, "mason-lspconfig.nvim": { "branch": "main", "commit": "25c11854aa25558ee6c03432edfa0df0217324be" }, "mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" }, "nvim-cmp": { "branch": "main", "commit": "ae644feb7b67bf1ce4260c231d1d4300b19c6f30" }, - "nvim-lspconfig": { "branch": "master", "commit": "d88ae6623fef09251e3aa20001bb761686eae730" }, - "nvim-treesitter": { "branch": "master", "commit": "b6a6d8997c46dc15682020ce4fddc5a89ee1ac0d" }, - "plenary": { "branch": "master", "commit": "ec289423a1693aeae6cd0d503bac2856af74edaa" }, - "plenary.nvim": { "branch": "master", "commit": "ec289423a1693aeae6cd0d503bac2856af74edaa" }, + "nvim-lspconfig": { "branch": "master", "commit": "04680101ff79e99b4e33a4386ec27cbd0d360c75" }, + "nvim-treesitter": { "branch": "master", "commit": "45e0d66246f31306d890b91301993fa1623e79f1" }, + "plenary": { "branch": "master", "commit": "2d9b06177a975543726ce5c73fca176cedbffe9d" }, + "plenary.nvim": { "branch": "master", "commit": "2d9b06177a975543726ce5c73fca176cedbffe9d" }, "telescope.nvim": { "branch": "master", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" }, - "undotree": { "branch": "master", "commit": "56c684a805fe948936cda0d1b19505b84ad7e065" }, + "undotree": { "branch": "master", "commit": "78b5241191852ffa9bb5da5ff2ee033160798c3b" }, "vim-fugitive": { "branch": "master", "commit": "d4877e54cef67f5af4f950935b1ade19ed6b7370" } } diff --git a/lua/flip/remap.lua b/lua/flip/remap.lua index cf67115..ba36398 100644 --- a/lua/flip/remap.lua +++ b/lua/flip/remap.lua @@ -10,12 +10,36 @@ vim.keymap.set("v", "K", ":m '<-2gv=gv") -- Slide lines below into the current one vim.keymap.set("n", "J", "mzJ`z") +--- LSP settings --- +-- Show hover text of symbol +vim.keymap.set("n", "K", vim.lsp.buf.hover) + +-- Go to definition of symbol +vim.keymap.set("n", "gd", vim.lsp.buf.definition) + +-- Go to declaration of symbol +vim.keymap.set("n", "gD", vim.lsp.buf.declaration) + +-- List all implementations for symbol in quickfix window +vim.keymap.set("n", "gi", vim.lsp.buf.implementation) + +-- Go to definition of type of symbol +vim.keymap.set("n", "go", vim.lsp.buf.type_definition) + +-- Go to references of symbol +vim.keymap.set("n", "gr", vim.lsp.buf.references) + +-- Select code action at symbol +vim.keymap.set("n", "ca", vim.lsp.buf.code_action) + -- Auto formatting vim.keymap.set("n", "f", vim.lsp.buf.format) -- Display type signature vim.keymap.set("n", "gs", vim.lsp.buf.signature_help) +--- End of LSP setings --- + -- Greatest remap ever -- Delete visual selection to null and paste latest clipboard entry vim.keymap.set("x", "p", [["_dP]]) From 4db19a82b87afa2175d97032e62bbb184f28399b Mon Sep 17 00:00:00 2001 From: Philippe Zwietering Date: Mon, 4 Nov 2024 09:05:50 +0100 Subject: [PATCH 17/18] Added zig and go to treesitter --- lazy-lock.json | 14 +++++++------- lua/plugins/treesitter.lua | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lazy-lock.json b/lazy-lock.json index 9234273..62205c7 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -1,5 +1,5 @@ { - "LuaSnip": { "branch": "master", "commit": "e808bee352d1a6fcf902ca1a71cee76e60e24071" }, + "LuaSnip": { "branch": "master", "commit": "67c0da98d807bbbcb6e43a446a01407529e1dd10" }, "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, "cmp-cmdline": { "branch": "main", "commit": "d250c63aa13ead745e3a40f61fdd3470efde3923" }, "cmp-nvim-lsp": { "branch": "main", "commit": "39e2eda76828d88b773cc27a3f61d2ad782c922d" }, @@ -8,13 +8,13 @@ "dichromatic": { "branch": "master", "commit": "9765a72ce24ddae48afe12c316583a22c82ad812" }, "fidget.nvim": { "branch": "main", "commit": "d855eed8a06531a7e8fd0684889b2943f373c469" }, "harpoon": { "branch": "master", "commit": "1bc17e3e42ea3c46b33c0bbad6a880792692a1b3" }, - "hererocks": { "branch": "master", "commit": "8bd2fcfdd65cfa7535ce39ea372a63b0bdb8e528" }, - "lazy.nvim": { "branch": "main", "commit": "1159bdccd8910a0fd0914b24d6c3d186689023d9" }, - "mason-lspconfig.nvim": { "branch": "main", "commit": "25c11854aa25558ee6c03432edfa0df0217324be" }, + "hererocks": { "branch": "master", "commit": "c9c5444dea1e07e005484014a8231aa667be30b6" }, + "lazy.nvim": { "branch": "main", "commit": "cf8ecc2c5e4332760431a33534240b0cbc6680ab" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "7446f47b3dfb7df801f31a6f6783c2ad119a6935" }, "mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" }, - "nvim-cmp": { "branch": "main", "commit": "ae644feb7b67bf1ce4260c231d1d4300b19c6f30" }, - "nvim-lspconfig": { "branch": "master", "commit": "04680101ff79e99b4e33a4386ec27cbd0d360c75" }, - "nvim-treesitter": { "branch": "master", "commit": "45e0d66246f31306d890b91301993fa1623e79f1" }, + "nvim-cmp": { "branch": "main", "commit": "29fb4854573355792df9e156cb779f0d31308796" }, + "nvim-lspconfig": { "branch": "master", "commit": "59a6766cbf32c7e4cf3ed685ccad7ffe1dde8c40" }, + "nvim-treesitter": { "branch": "master", "commit": "de70388626b398e9cfbec0ec02a0fab8d0f26648" }, "plenary": { "branch": "master", "commit": "2d9b06177a975543726ce5c73fca176cedbffe9d" }, "plenary.nvim": { "branch": "master", "commit": "2d9b06177a975543726ce5c73fca176cedbffe9d" }, "telescope.nvim": { "branch": "master", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" }, diff --git a/lua/plugins/treesitter.lua b/lua/plugins/treesitter.lua index 1283ed5..cb15dba 100644 --- a/lua/plugins/treesitter.lua +++ b/lua/plugins/treesitter.lua @@ -7,7 +7,7 @@ return { require("nvim-treesitter.configs").setup({ -- List of parsers ensure_installed = { - "vimdoc", "vim", "lua", "c", "rust", "cpp", "cmake", "latex", "python", "groovy", "bash", + "vimdoc", "vim", "lua", "c", "rust", "cpp", "cmake", "latex", "python", "groovy", "bash", "zig", "go", }, sync_install = false, From ca01c1b12dde0a79c911eb393dd229c855f93a0d Mon Sep 17 00:00:00 2001 From: Philippe Zwietering Date: Sun, 25 May 2025 14:48:30 +0200 Subject: [PATCH 18/18] Color scheme aangepast naar andere kleurenblindenvriendelijke setup --- lazy-lock.json | 37 ++++++++++++++++++------------------- lua/plugins/colors.lua | 15 ++++++++++++--- 2 files changed, 30 insertions(+), 22 deletions(-) diff --git a/lazy-lock.json b/lazy-lock.json index 62205c7..d710574 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -1,23 +1,22 @@ { - "LuaSnip": { "branch": "master", "commit": "67c0da98d807bbbcb6e43a446a01407529e1dd10" }, - "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, - "cmp-cmdline": { "branch": "main", "commit": "d250c63aa13ead745e3a40f61fdd3470efde3923" }, - "cmp-nvim-lsp": { "branch": "main", "commit": "39e2eda76828d88b773cc27a3f61d2ad782c922d" }, - "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, - "cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" }, - "dichromatic": { "branch": "master", "commit": "9765a72ce24ddae48afe12c316583a22c82ad812" }, - "fidget.nvim": { "branch": "main", "commit": "d855eed8a06531a7e8fd0684889b2943f373c469" }, + "LuaSnip": { "branch": "master", "commit": "faf3c94a44508cec1b961406d36cc65113ff3b98" }, + "cmp-buffer": { "branch": "main", "commit": "b74fab3656eea9de20a9b8116afa3cfc4ec09657" }, + "cmp-cmdline": { "branch": "main", "commit": "d126061b624e0af6c3a556428712dd4d4194ec6d" }, + "cmp-nvim-lsp": { "branch": "main", "commit": "a8912b88ce488f411177fc8aed358b04dc246d7b" }, + "cmp-path": { "branch": "main", "commit": "c6635aae33a50d6010bf1aa756ac2398a2d54c32" }, + "cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" }, + "fidget.nvim": { "branch": "main", "commit": "d9ba6b7bfe29b3119a610892af67602641da778e" }, "harpoon": { "branch": "master", "commit": "1bc17e3e42ea3c46b33c0bbad6a880792692a1b3" }, - "hererocks": { "branch": "master", "commit": "c9c5444dea1e07e005484014a8231aa667be30b6" }, - "lazy.nvim": { "branch": "main", "commit": "cf8ecc2c5e4332760431a33534240b0cbc6680ab" }, - "mason-lspconfig.nvim": { "branch": "main", "commit": "7446f47b3dfb7df801f31a6f6783c2ad119a6935" }, - "mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" }, - "nvim-cmp": { "branch": "main", "commit": "29fb4854573355792df9e156cb779f0d31308796" }, - "nvim-lspconfig": { "branch": "master", "commit": "59a6766cbf32c7e4cf3ed685ccad7ffe1dde8c40" }, - "nvim-treesitter": { "branch": "master", "commit": "de70388626b398e9cfbec0ec02a0fab8d0f26648" }, - "plenary": { "branch": "master", "commit": "2d9b06177a975543726ce5c73fca176cedbffe9d" }, - "plenary.nvim": { "branch": "master", "commit": "2d9b06177a975543726ce5c73fca176cedbffe9d" }, + "lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "d24b3f1612e53f9d54d866b16bedab51813f2bf1" }, + "mason.nvim": { "branch": "main", "commit": "8024d64e1330b86044fed4c8494ef3dcd483a67c" }, + "nightfox": { "branch": "main", "commit": "ba47d4b4c5ec308718641ba7402c143836f35aa9" }, + "nvim-cmp": { "branch": "main", "commit": "b5311ab3ed9c846b585c0c15b7559be131ec4be9" }, + "nvim-lspconfig": { "branch": "master", "commit": "3ea99227e316c5028f57a4d86a1a7fd01dd876d0" }, + "nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" }, + "plenary": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" }, + "plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" }, "telescope.nvim": { "branch": "master", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" }, - "undotree": { "branch": "master", "commit": "78b5241191852ffa9bb5da5ff2ee033160798c3b" }, - "vim-fugitive": { "branch": "master", "commit": "d4877e54cef67f5af4f950935b1ade19ed6b7370" } + "undotree": { "branch": "master", "commit": "b951b87b46c34356d44aa71886aecf9dd7f5788a" }, + "vim-fugitive": { "branch": "master", "commit": "4a745ea72fa93bb15dd077109afbb3d1809383f2" } } diff --git a/lua/plugins/colors.lua b/lua/plugins/colors.lua index 5d57592..3b44a87 100644 --- a/lua/plugins/colors.lua +++ b/lua/plugins/colors.lua @@ -1,5 +1,5 @@ function ColorMyPencils(color) - color = color or "dichromatic" + color = color or "nightfox" vim.cmd.colorscheme(color) vim.api.nvim_set_hl(0, "Normal", { bg = "none" }) @@ -7,11 +7,20 @@ function ColorMyPencils(color) end vim.keymap.set("n", "c", function() ColorMyPencils() end) +vim.opt.termguicolors = true return { - "romainl/vim-dichromatic", - name = "dichromatic", + "EdenEast/nightfox.nvim", + name = "nightfox", lazy = false, + options = { + colorblind = { + enable = true, + severity = { + protan = 1, + }, + }, + }, config = function() ColorMyPencils() end