From 9a2bca5f6d6793746f983e97c1fd0d01345e5b7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9mie=20SALVI?= Date: Thu, 21 Dec 2023 00:40:03 +0100 Subject: [PATCH] Adding a lot of plugin --- init.lua | 2 +- lua/lazy/plugins/bufferline.lua | 29 ++++++++++++ lua/lazy/plugins/gitsigns.lua | 11 +++++ lua/lazy/plugins/indent-blankline.lua | 11 +++++ lua/lazy/plugins/lualine.lua | 33 +++++++++++++ lua/lazy/plugins/nvim-autopairs.lua | 11 +++++ lua/lazy/plugins/nvim-tree.lua | 61 +++++++++++++++++++++++++ lua/lazy/plugins/nvim-treesitter.lua | 55 ++++++++++++++++++++++ lua/lazy/plugins/rainbow-delimiters.lua | 33 +++++++++++++ lua/lazy/plugins/which-key.lua | 21 +++++++++ nvim_help.sh | 2 +- 11 files changed, 267 insertions(+), 2 deletions(-) create mode 100644 lua/lazy/plugins/bufferline.lua create mode 100644 lua/lazy/plugins/gitsigns.lua create mode 100644 lua/lazy/plugins/indent-blankline.lua create mode 100644 lua/lazy/plugins/lualine.lua create mode 100644 lua/lazy/plugins/nvim-autopairs.lua create mode 100644 lua/lazy/plugins/nvim-tree.lua create mode 100644 lua/lazy/plugins/nvim-treesitter.lua create mode 100644 lua/lazy/plugins/rainbow-delimiters.lua create mode 100644 lua/lazy/plugins/which-key.lua diff --git a/init.lua b/init.lua index 36ed82f..244239c 100644 --- a/init.lua +++ b/init.lua @@ -55,7 +55,7 @@ vim.keymap.set("n", "", ":tabnext") -- Cheatsheet vim.keymap.set("n", "", ":terminal ~/.config/nvim/nvim_help.shi") -- No highlight -vim.keymap.set("n", "nl", ":nohl") +vim.keymap.set("n", "nh", ":nohl") --- Automaticly close brackets --vim.keymap.set ("i", "'", "''") diff --git a/lua/lazy/plugins/bufferline.lua b/lua/lazy/plugins/bufferline.lua new file mode 100644 index 0000000..18a65c3 --- /dev/null +++ b/lua/lazy/plugins/bufferline.lua @@ -0,0 +1,29 @@ +function conf() + --- Ensure plugin is avaiable + local bufferline = require("bufferline"); + + --- Bufferline options + opts = { + options = { + -- mode = "tabs", + separator_style = "slant", + }, + } + + --- Load bufferline + bufferline.setup(opts) + + --- Override keymaps + local km = vim.keymap.set + km("n", "", ":BufferLineCycleNext") + km("n", "", ":BufferLineCyclePrev") + km("n", "", ":BufferLineMoveNext") + km("n", "", ":BufferLineMovePrev") +end + +return { + "akinsho/bufferline.nvim", + version = "*", + dependencies = "nvim-tree/nvim-web-devicons", + config = conf +} diff --git a/lua/lazy/plugins/gitsigns.lua b/lua/lazy/plugins/gitsigns.lua new file mode 100644 index 0000000..1d4f20e --- /dev/null +++ b/lua/lazy/plugins/gitsigns.lua @@ -0,0 +1,11 @@ +function conf() + --- Ensure plugin is avaiable + local gitsigns = require('gitsigns') + + gitsigns.setup() +end + +return { + "lewis6991/gitsigns.nvim", + config = conf +} diff --git a/lua/lazy/plugins/indent-blankline.lua b/lua/lazy/plugins/indent-blankline.lua new file mode 100644 index 0000000..60b744c --- /dev/null +++ b/lua/lazy/plugins/indent-blankline.lua @@ -0,0 +1,11 @@ +function conf() + --- Ensure plugin is avaiable + local ibl = require("ibl") + ibl.setup() +end + + +return { + "lukas-reineke/indent-blankline.nvim", + config = conf, +} diff --git a/lua/lazy/plugins/lualine.lua b/lua/lazy/plugins/lualine.lua new file mode 100644 index 0000000..086dacf --- /dev/null +++ b/lua/lazy/plugins/lualine.lua @@ -0,0 +1,33 @@ +function conf() + --- Ensure plugins are avaiable + local lualine = require("lualine") + local lazy_status = require("lazy.status") + + opts = { + options = { + theme = "onedark", + }, + sections = { + lualine_x = { + { + lazy_status.updates, + cond = lazy_status.has_updates, + color = { fg = "#ff9e64" }, + }, + { "encoding" }, + { "fileformat" }, + { "filetype" }, + }, + }, + } + + lualine.setup(opts) +end + +return { + 'nvim-lualine/lualine.nvim', + dependencies = { + 'nvim-tree/nvim-web-devicons', opt = true + }, + config = conf +} diff --git a/lua/lazy/plugins/nvim-autopairs.lua b/lua/lazy/plugins/nvim-autopairs.lua new file mode 100644 index 0000000..998f0cc --- /dev/null +++ b/lua/lazy/plugins/nvim-autopairs.lua @@ -0,0 +1,11 @@ +function conf() + --- Ensure plugin is avaiable + local nvimautopairs = require("nvim-autopairs") + nvimautopairs.setup() +end + +return { + 'windwp/nvim-autopairs', + event = "InsertEnter", + config = conf +} diff --git a/lua/lazy/plugins/nvim-tree.lua b/lua/lazy/plugins/nvim-tree.lua new file mode 100644 index 0000000..2b28103 --- /dev/null +++ b/lua/lazy/plugins/nvim-tree.lua @@ -0,0 +1,61 @@ +function conf() + --- Ensure nvim-tree is avaiable + local nvimtree = require("nvim-tree") + + --- Unload netrw + vim.g.loaded_netrw = 1 + vim.g.loaded_netrwPlugin = 1 + + --- Nvimtree options + local opts = { + sort = { + -- sorter = "case_sensitive", + }, + view = { + width = 30, + }, + renderer = { + group_empty = true, + indent_markers = { + enable = true, + }, + icons = { + glyphs = { + folder = { + arrow_closed = "", -- arrow when folder is closed + arrow_open = "", -- arrow when folder is open + }, + }, + }, + }, + filters = { + dotfiles = false, + }, + } + + nvimtree.setup(opts) + + --- Override keymap + local wk = require("which-key") + wk.register({ + e = { + name = "NvimTree", -- optional group name + }, + }, { prefix = "" }) + local km = vim.keymap.set + km('n', '', ':NvimTreeFocus') + km('n', 'ee', ':NvimTreeToggle') + km('n', 'ef', ':NvimTreeFindFileToggle') + km('n', 'ec', ':NvimTreeCollapse') + km('n', 'er', ':NvimTreeRefresh') +end + +return { + "nvim-tree/nvim-tree.lua", + version = "*", + lazy = false, + dependencies = { + "nvim-tree/nvim-web-devicons", + }, + config = conf +} diff --git a/lua/lazy/plugins/nvim-treesitter.lua b/lua/lazy/plugins/nvim-treesitter.lua new file mode 100644 index 0000000..92c4866 --- /dev/null +++ b/lua/lazy/plugins/nvim-treesitter.lua @@ -0,0 +1,55 @@ +function conf() + --- Ensure plugin is avaiable + local treesitter = require("nvim-treesitter.configs") + + --- nvim-treesitter options + opts = { + highlight = { + enable = true, + }, + -- enable indentation + autotag = { + enable = true, + }, + ensure_installed = { + "json", + "javascript", + "typescript", + "tsx", + "yaml", + "html", + "css", + "prisma", + "markdown", + "markdown_inline", + "svelte", + "graphql", + "bash", + "lua", + "vim", + "dockerfile", + "gitignore", + "query", + "rst", + "php", + }, + incremental_selection = { + enable = true, + keymaps = { + init_selection = "ss", + node_incremental = false, + scope_incremental = false, + node_decremental = false, + }, + }, + } + + --- Load plugin + treesitter.setup(opts) +end + +return { + "nvim-treesitter/nvim-treesitter", + event = { "BufReadPre", "BufNewFile" }, + config = conf +} diff --git a/lua/lazy/plugins/rainbow-delimiters.lua b/lua/lazy/plugins/rainbow-delimiters.lua new file mode 100644 index 0000000..8c3cb84 --- /dev/null +++ b/lua/lazy/plugins/rainbow-delimiters.lua @@ -0,0 +1,33 @@ +function conf() + local rainbow_delimiters = require 'rainbow-delimiters' + + vim.g.rainbow_delimiters = { + strategy = { + [''] = rainbow_delimiters.strategy['global'], + vim = rainbow_delimiters.strategy['local'], + }, + query = { + [''] = 'rainbow-delimiters', + lua = 'rainbow-blocks', + }, + priority = { + [''] = 110, + lua = 210, + }, + highlight = { + 'RainbowDelimiterYellow', + 'RainbowDelimiterBlue', + 'RainbowDelimiterOrange', + 'RainbowDelimiterGreen', + 'RainbowDelimiterViolet', + 'RainbowDelimiterCyan', + 'RainbowDelimiterRed', + }, + } +end + +return { + "hiphish/rainbow-delimiters.nvim", + event = { "BufReadPre", "BufNewFile" }, + config = conf +} diff --git a/lua/lazy/plugins/which-key.lua b/lua/lazy/plugins/which-key.lua new file mode 100644 index 0000000..456ef1f --- /dev/null +++ b/lua/lazy/plugins/which-key.lua @@ -0,0 +1,21 @@ +function conf () + --- Global options + vim.o.timeout = true + vim.o.timeoutlen = 300 + + --- Override keymap + local km = vim.keymap.set + km('n', '', ':WhichKey', { desc = "Which-key" }) + local wk = require("which-key") + wk.register({ + n = { + name = "nohl", + }, +}, { prefix = "" }) +end + +return { + "folke/which-key.nvim", + event = "VeryLazy", + config = conf, +} diff --git a/nvim_help.sh b/nvim_help.sh index f140b4d..8dd9e32 100755 --- a/nvim_help.sh +++ b/nvim_help.sh @@ -69,7 +69,7 @@ _shortcut "Shift" "tn" "New Table" _shortcut "Leader" "tc" "Close tab" _title "\e[48;5;170m" "No Highlight" -_shortcut "Leader" "hl" "Remove search highlight" +_shortcut "Leader" "nh" "Remove search highlight" _title "\e[48;5;092m" "Normal mode" _shortcut "" "w" "Move by word"