From c6af5c0161f47f1dca82d6d76933efdcd5ee575d Mon Sep 17 00:00:00 2001 From: Michael Thomson Date: Tue, 27 Feb 2024 12:00:15 -0500 Subject: [PATCH] added neovim --- hosts/macbook/home.nix | 1 + modules/home-manager/neovim/default.nix | 11 +++ modules/home-manager/neovim/nvim/README.md | 76 +++++++++++++++ modules/home-manager/neovim/nvim/init.lua | 96 +++++++++++++++++++ .../home-manager/neovim/nvim/lua/.luarc.json | 5 + .../neovim/nvim/lua/plugins/autopairs.lua | 5 + .../neovim/nvim/lua/plugins/catppuccin.lua | 19 ++++ .../neovim/nvim/lua/plugins/comment.lua | 7 ++ .../neovim/nvim/lua/plugins/fidget.lua | 10 ++ .../neovim/nvim/lua/plugins/hardtime.lua | 7 ++ .../neovim/nvim/lua/plugins/harpoon.lua | 9 ++ .../neovim/nvim/lua/plugins/hawtkeys.lua | 41 ++++++++ .../neovim/nvim/lua/plugins/leap.lua | 6 ++ .../neovim/nvim/lua/plugins/lsp.lua | 81 ++++++++++++++++ .../neovim/nvim/lua/plugins/luasnip.lua | 12 +++ .../nvim/lua/plugins/nvim-tmux-navigation.lua | 19 ++++ .../nvim/lua/plugins/nvim-ts-autotag.lua | 3 + .../neovim/nvim/lua/plugins/pets.lua | 22 +++++ .../neovim/nvim/lua/plugins/rest.lua | 54 +++++++++++ .../neovim/nvim/lua/plugins/surround.lua | 10 ++ .../nvim/lua/plugins/telescope-fzf-native.lua | 4 + .../neovim/nvim/lua/plugins/telescope.lua | 29 ++++++ .../neovim/nvim/lua/plugins/transparent.lua | 3 + .../neovim/nvim/lua/plugins/treesitter.lua | 79 +++++++++++++++ .../neovim/nvim/lua/plugins/undotree.lua | 6 ++ .../neovim/nvim/lua/plugins/webdevicons.lua | 1 + 26 files changed, 616 insertions(+) create mode 100644 modules/home-manager/neovim/default.nix create mode 100644 modules/home-manager/neovim/nvim/README.md create mode 100644 modules/home-manager/neovim/nvim/init.lua create mode 100644 modules/home-manager/neovim/nvim/lua/.luarc.json create mode 100644 modules/home-manager/neovim/nvim/lua/plugins/autopairs.lua create mode 100644 modules/home-manager/neovim/nvim/lua/plugins/catppuccin.lua create mode 100644 modules/home-manager/neovim/nvim/lua/plugins/comment.lua create mode 100644 modules/home-manager/neovim/nvim/lua/plugins/fidget.lua create mode 100644 modules/home-manager/neovim/nvim/lua/plugins/hardtime.lua create mode 100644 modules/home-manager/neovim/nvim/lua/plugins/harpoon.lua create mode 100644 modules/home-manager/neovim/nvim/lua/plugins/hawtkeys.lua create mode 100644 modules/home-manager/neovim/nvim/lua/plugins/leap.lua create mode 100644 modules/home-manager/neovim/nvim/lua/plugins/lsp.lua create mode 100644 modules/home-manager/neovim/nvim/lua/plugins/luasnip.lua create mode 100644 modules/home-manager/neovim/nvim/lua/plugins/nvim-tmux-navigation.lua create mode 100644 modules/home-manager/neovim/nvim/lua/plugins/nvim-ts-autotag.lua create mode 100644 modules/home-manager/neovim/nvim/lua/plugins/pets.lua create mode 100644 modules/home-manager/neovim/nvim/lua/plugins/rest.lua create mode 100644 modules/home-manager/neovim/nvim/lua/plugins/surround.lua create mode 100644 modules/home-manager/neovim/nvim/lua/plugins/telescope-fzf-native.lua create mode 100644 modules/home-manager/neovim/nvim/lua/plugins/telescope.lua create mode 100644 modules/home-manager/neovim/nvim/lua/plugins/transparent.lua create mode 100644 modules/home-manager/neovim/nvim/lua/plugins/treesitter.lua create mode 100644 modules/home-manager/neovim/nvim/lua/plugins/undotree.lua create mode 100644 modules/home-manager/neovim/nvim/lua/plugins/webdevicons.lua diff --git a/hosts/macbook/home.nix b/hosts/macbook/home.nix index 244d3df..72a6f0c 100644 --- a/hosts/macbook/home.nix +++ b/hosts/macbook/home.nix @@ -2,6 +2,7 @@ { imports = [ + ../../modules/home-manager/neovim ../../modules/home-manager/wezterm ../../modules/home-manager/zsh ]; diff --git a/modules/home-manager/neovim/default.nix b/modules/home-manager/neovim/default.nix new file mode 100644 index 0000000..04ffc2b --- /dev/null +++ b/modules/home-manager/neovim/default.nix @@ -0,0 +1,11 @@ +{ pkgs, config, ... }: + +{ + home.packages = with pkgs; [ + noevim + ]; + home.file.".config/nvim/" = { + source = ./nvim; + recursive = true; + }; +} diff --git a/modules/home-manager/neovim/nvim/README.md b/modules/home-manager/neovim/nvim/README.md new file mode 100644 index 0000000..bfbc84d --- /dev/null +++ b/modules/home-manager/neovim/nvim/README.md @@ -0,0 +1,76 @@ +# My Neovim Config + + + + +![Screenshot 2023-10-19 at 2 16 29 PM](https://github.com/michaelthomson0797/nvim/assets/8810940/170440a7-aadb-4e88-b45e-02e7737a3d28) + + +- [My Neovim Config](#my-neovim-config) + - [Prerequisites](#prerequisites) + - [Installation](#installation) + - [Plugins used](#plugins-used) + - [Basic Keybinds](#basic-keybinds) + - [Project Navigation](#project-navigation) + - [File Navigation](#file-navigation) + - [LSP Commands](#lsp-commands) + + +An okay config + +## Prerequisites +- `neovim` +- `git` +- `fzf` +- `ripgrep` + +## Installation +Clone this folder, or copy all the contents to `~/.config/nvim/` + +## Plugins used +- `lazy.nvim`: Package manager that manages installed plugins +- `lsp-zero`: Basic configurations for providing language server support like autocompletion, intellisense, diagnostics, etc. +- `alpha-nvim`: Splash screen when starting neovim +- `fidget.nvim`: LSP status indicator +- `gitsigns.nvim`: File change indicators in the buffer gutter +- `harpoon`: Project-specific file bookmarking and rapid navigation +- `leap.nvim`: Fast file navigation by jumping to characters in the buffer +- `lspsaga.nvim`: UI replacement for many LSP function (rename, documentation hover, etc.) +- `lualine.nvim`: Status with nice styling +- `mini.nvim`: A collection of utilities + - `mini.comment`: Apply language sensitive comments + - `mini.pairs`: automatically pair parens, quotes, etc. + - `mini.surround`: Quickly add, edit, delete surroundings (parens, quotes, etc.) + - `mini.splitjoin`: quickly split or join a list + - `mini.jump`: enhanced f/F/t/T movement +- `neo-tree.nvim`: File tree explorer and editor +- `noice.nvim`: Fancy UI replacements +- `nvim-ts-autotag`: Automatic pairing of HTML tags in `.html`, `.jsx`, `.tsx` +- `telescope.nvim`: Fuzzy file and text finder +- `toggleterm.nvim`: Quickly toggle integrated terminal on and off +- `nvim-treesitter`: Syntax tree parsing +- `trouble.nvim`: Diagnostics listing +- `undotree`: Show file undo/redo history as a tree and traverse it + +## Basic Keybinds +### Project Navigation +- `fe`: open file explorer +- `ff`: fuzzy find files in project +- `fg`: fuzzy find text in project +- `fg`: fuzzy find text in project + +### File Navigation +- `s{c1}{c2}`: searches the active buffer for the two provided characters and provides prompts to press to instantly navigate to that pair + +### LSP Commands +- `gd`: Go to definition +- `gr`: Go to references +- `rn`: Rename symbol +- `ca`: Code actions +- `ds`: Fuzzy find document symbols +- `ws`: Fuzzy find workspace symbols +- `[d`/`]d`: Jump to next/prev diagnostic +- `K`: Show symbol documentation +- `o`: show outline + + diff --git a/modules/home-manager/neovim/nvim/init.lua b/modules/home-manager/neovim/nvim/init.lua new file mode 100644 index 0000000..dadebf2 --- /dev/null +++ b/modules/home-manager/neovim/nvim/init.lua @@ -0,0 +1,96 @@ +local api = vim.api +local g = vim.g +local opt = vim.opt + +-- Load Lazy +local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" +if not vim.loop.fs_stat(lazypath) then + vim.fn.system({ + "git", + "clone", + "--filter=blob:none", + "https://github.com/folke/lazy.nvim.git", + "--branch=stable", -- latest stable release + lazypath, + }) +end +vim.opt.rtp:prepend(lazypath) + +-- Remap leader and local leader to +api.nvim_set_keymap("", "", "", { noremap = true, silent = true }) +g.mapleader = " " +g.maplocalleader = " " + + +-- Load plugins +require('lazy').setup('plugins') + +vim.cmd 'colorscheme catppuccin-frappe' + +-- Load core settings +opt.termguicolors = true -- Enable colors in terminal +opt.hlsearch = false -- turn off highlight on search +opt.incsearch = true -- Keep incremental highlighting on search +opt.number = true --Make line numbers default +opt.relativenumber = true --Make relative number default +opt.mouse = "a" --Enable mouse mode +opt.breakindent = true --Enable break indent +opt.undofile = true --Save undo history +opt.ignorecase = true --Case insensitive searching unless /C or capital in search +opt.smartcase = true -- Smart case +opt.updatetime = 50 --Decrease update time +opt.signcolumn = "yes" -- Always show sign column +opt.clipboard = "unnamedplus" -- Access system clipboard +opt.laststatus = 3 -- Global status line +opt.swapfile = false +opt.wrap = false + +-- Time in milliseconds to wait for a mapped sequence to complete. +opt.timeoutlen = 300 + +opt.showmode = false -- Do not need to show the mode. We use the statusline instead. +-- opt.scrolloff = 8 -- Lines of context +opt.smartindent = true --Smart indent +opt.expandtab = true +opt.smarttab = true +opt.textwidth = 0 +opt.autoindent = true +opt.shiftwidth = 2 +opt.tabstop = 2 +opt.softtabstop = 2 +opt.splitbelow = true +opt.splitright = true +opt.cursorline = true +opt.guifont = "PragmataPro Mono Liga" + +-- Remappings +vim.keymap.set("v", "J", ":m '>+1gv=gv") +vim.keymap.set("v", "K", ":m '<-2gv=gv") + +vim.keymap.set("n", "", "zz") +vim.keymap.set("n", "", "zz") +vim.keymap.set("n", "n", "nzzzv") +vim.keymap.set("n", "N", "Nzzzv") + +vim.keymap.set("x", "p", [["_dP]]) +vim.keymap.set({"n", "v"}, "y", [["+y]]) +vim.keymap.set("n", "Y", [["+Y]]) +vim.keymap.set({"n", "v"}, "d", [["_d]]) + +vim.keymap.set("n", "Q", "") +vim.keymap.set("n", "", "") + +vim.keymap.set("n", "", "silent !tmux neww tmux-sessionizer") + +vim.keymap.set("n", "J", "mzJ`z") + +vim.keymap.set("n", "fe", "Explore") + +vim.keymap.set("i", "jk", "") + +vim.cmd[[ +augroup highlight_yank +autocmd! +au TextYankPost * silent! lua vim.highlight.on_yank({higroup="Visual", timeout=200}) +augroup END +]] diff --git a/modules/home-manager/neovim/nvim/lua/.luarc.json b/modules/home-manager/neovim/nvim/lua/.luarc.json new file mode 100644 index 0000000..1e1765c --- /dev/null +++ b/modules/home-manager/neovim/nvim/lua/.luarc.json @@ -0,0 +1,5 @@ +{ + "diagnostics.globals": [ + "vim" + ] +} \ No newline at end of file diff --git a/modules/home-manager/neovim/nvim/lua/plugins/autopairs.lua b/modules/home-manager/neovim/nvim/lua/plugins/autopairs.lua new file mode 100644 index 0000000..3a794db --- /dev/null +++ b/modules/home-manager/neovim/nvim/lua/plugins/autopairs.lua @@ -0,0 +1,5 @@ +return { + 'windwp/nvim-autopairs', + event = "InsertEnter", + opts = {} -- this is equalent to setup({}) function +} diff --git a/modules/home-manager/neovim/nvim/lua/plugins/catppuccin.lua b/modules/home-manager/neovim/nvim/lua/plugins/catppuccin.lua new file mode 100644 index 0000000..f6dff5b --- /dev/null +++ b/modules/home-manager/neovim/nvim/lua/plugins/catppuccin.lua @@ -0,0 +1,19 @@ +return { + "catppuccin/nvim", + name = "catppuccin", + priority = 1000, + opts = { + integrations = { + cmp = true, + gitsigns = true, + treesitter = true, + fidget = true, + harpoon = true, + leap = true, + mason = true, + telescope = { + enabled = true, + }, + }, + }, +} diff --git a/modules/home-manager/neovim/nvim/lua/plugins/comment.lua b/modules/home-manager/neovim/nvim/lua/plugins/comment.lua new file mode 100644 index 0000000..e6b597d --- /dev/null +++ b/modules/home-manager/neovim/nvim/lua/plugins/comment.lua @@ -0,0 +1,7 @@ +return { + 'numToStr/Comment.nvim', + opts = { + -- add any options here + }, + lazy = false, +} diff --git a/modules/home-manager/neovim/nvim/lua/plugins/fidget.lua b/modules/home-manager/neovim/nvim/lua/plugins/fidget.lua new file mode 100644 index 0000000..f314638 --- /dev/null +++ b/modules/home-manager/neovim/nvim/lua/plugins/fidget.lua @@ -0,0 +1,10 @@ +return { + 'j-hui/fidget.nvim', + opts = { + notification = { + window = { + winblend = 0, + }, + } + } +} diff --git a/modules/home-manager/neovim/nvim/lua/plugins/hardtime.lua b/modules/home-manager/neovim/nvim/lua/plugins/hardtime.lua new file mode 100644 index 0000000..c40eba8 --- /dev/null +++ b/modules/home-manager/neovim/nvim/lua/plugins/hardtime.lua @@ -0,0 +1,7 @@ +return { + "m4xshen/hardtime.nvim", + dependencies = { "MunifTanjim/nui.nvim", "nvim-lua/plenary.nvim" }, + opts = { + disabled_filetypes = {"qf", "netrw", "NvimTree", "lazy", "mason", "oil", "telescope"} + } +} diff --git a/modules/home-manager/neovim/nvim/lua/plugins/harpoon.lua b/modules/home-manager/neovim/nvim/lua/plugins/harpoon.lua new file mode 100644 index 0000000..b765f9f --- /dev/null +++ b/modules/home-manager/neovim/nvim/lua/plugins/harpoon.lua @@ -0,0 +1,9 @@ +return { + 'theprimeagen/harpoon', + keys = { + { "a", function() require('harpoon.mark').add_file() end }, + { "e", function() require('harpoon.ui').toggle_quick_menu() end }, + { "k", function() require('harpoon.ui').nav_next() end }, + { "j", function() require('harpoon.ui').nav_prev() end }, + } +} diff --git a/modules/home-manager/neovim/nvim/lua/plugins/hawtkeys.lua b/modules/home-manager/neovim/nvim/lua/plugins/hawtkeys.lua new file mode 100644 index 0000000..e1e435f --- /dev/null +++ b/modules/home-manager/neovim/nvim/lua/plugins/hawtkeys.lua @@ -0,0 +1,41 @@ +return { + "tris203/hawtkeys.nvim", + dependencies = { "nvim-lua/plenary.nvim" }, + config = { + leader = " ", -- the key you want to use as the leader, default is space + homerow = 2, -- the row you want to use as the homerow, default is 2 + powerFingers = { 2, 3, 6, 7 }, -- the fingers you want to use as the powerfingers, default is {2,3,6,7} + keyboardLayout = "qwerty", -- the keyboard layout you use, default is qwerty + customMaps = { + --- EG local map = vim.api + --- map.nvim_set_keymap('n', '1', 'echo 1') + { + ["map.nvim_set_keymap"] = { --name of the expression + modeIndex = "1", -- the position of the mode setting + lhsIndex = "2", -- the position of the lhs setting + rhsIndex = "3", -- the position of the rhs setting + optsIndex = "4", -- the position of the index table + method = "dot_index_expression", -- if the function name contains a dot + }, + }, + --- EG local map2 = vim.api.nvim_set_keymap + ["map2"] = { --name of the function + modeIndex = 1, --if you use a custom function with a fixed value, eg normRemap, then this can be a fixed mode eg 'n' + lhsIndex = 2, + rhsIndex = 3, + optsIndex = 4, + method = "function_call", + }, + -- If you use lazy.nvim's keys property to configure keymaps in your plugins + ["lazy"] = { + method = "lazy", + }, + }, + highlights = { -- these are the highlight used in search mode + HawtkeysMatchGreat = { fg = "green", bold = true }, + HawtkeysMatchGood = { fg = "green"}, + HawtkeysMatchOk = { fg = "yellow" }, + HawtkeysMatchBad = { fg = "red" }, + }, + }, +} diff --git a/modules/home-manager/neovim/nvim/lua/plugins/leap.lua b/modules/home-manager/neovim/nvim/lua/plugins/leap.lua new file mode 100644 index 0000000..93c2345 --- /dev/null +++ b/modules/home-manager/neovim/nvim/lua/plugins/leap.lua @@ -0,0 +1,6 @@ +return { + 'ggandor/leap.nvim', + config = function() + require("leap").set_default_keymaps() + end +} diff --git a/modules/home-manager/neovim/nvim/lua/plugins/lsp.lua b/modules/home-manager/neovim/nvim/lua/plugins/lsp.lua new file mode 100644 index 0000000..f303243 --- /dev/null +++ b/modules/home-manager/neovim/nvim/lua/plugins/lsp.lua @@ -0,0 +1,81 @@ +return { + 'VonHeikemen/lsp-zero.nvim', + branch = 'v3.x', + dependencies = { + -- LSP Support + {'neovim/nvim-lspconfig'}, -- Required + {'williamboman/mason.nvim'}, -- Optional + {'williamboman/mason-lspconfig.nvim'}, -- Optional + + -- Autocompletion + {'hrsh7th/nvim-cmp'}, -- Required + {'hrsh7th/cmp-nvim-lsp'}, -- Required + {'L3MON4D3/LuaSnip'}, -- Required + {'saadparwaiz1/cmp_luasnip'}, + {'onsails/lspkind.nvim'} -- Optional + }, + config = function() + local lsp_zero = require('lsp-zero') + + lsp_zero.on_attach(function(client, bufnr) + local opts = {buffer = bufnr, remap = false} + + vim.keymap.set("n", "gd", function() vim.lsp.buf.definition() end, opts) + vim.keymap.set("n", "gr", function() vim.lsp.buf.references() end, opts) + vim.keymap.set("n", "K", function() vim.lsp.buf.hover() end, opts) + vim.keymap.set("n", "ws", function() vim.lsp.buf.workspace_symbol() end, opts) + vim.keymap.set("n", "d", function() vim.diagnostic.open_float() end, opts) + vim.keymap.set("n", "[d", function() vim.diagnostic.goto_next() end, opts) + vim.keymap.set("n", "]d", function() vim.diagnostic.goto_prev() end, opts) + vim.keymap.set("n", "ca", function() vim.lsp.buf.code_action() end, opts) + vim.keymap.set("n", "rn", function() vim.lsp.buf.rename() end, opts) + vim.keymap.set("i", "", function() vim.lsp.buf.signature_help() end, opts) + end) + + -- Mason Config + require('mason').setup({}) + require('mason-lspconfig').setup({ + ensure_installed = {}, + handlers = { + lsp_zero.default_setup, + } + }) + + -- cmp Config + + local cmp = require('cmp') + local cmp_action = require('lsp-zero').cmp_action() + + cmp.setup({ + sources = { + {name = 'path'}, + {name = 'nvim_lsp'}, + {name = 'nvim_lua'}, + {name = 'luasnip'}, + {name = 'cmp_luasnip'}, + {name = 'buffer'}, + {name = 'neorg'} + }, + window = { + completion = cmp.config.window.bordered(), + documentation = cmp.config.window.bordered(), + }, + formatting = { + fields = {'abbr', 'kind', 'menu'}, + format = require('lspkind').cmp_format({ + mode = 'symbol', -- show only symbol annotations + maxwidth = 50, -- prevent the popup from showing more than provided characters + ellipsis_char = '...', -- when popup menu exceed maxwidth, the truncated part would show ellipsis_char instead + }) + }, + mapping = cmp.mapping.preset.insert({ + [''] = cmp.mapping.confirm({select = false}), + -- scroll up and down the documentation window + [''] = cmp.mapping.scroll_docs(-4), + [''] = cmp.mapping.scroll_docs(4), + -- [''] = cmp_action.luasnip_supertab(), + -- [''] = cmp_action.luasnip_shift_supertab(), + }), + }) + end, +} diff --git a/modules/home-manager/neovim/nvim/lua/plugins/luasnip.lua b/modules/home-manager/neovim/nvim/lua/plugins/luasnip.lua new file mode 100644 index 0000000..0a31f6a --- /dev/null +++ b/modules/home-manager/neovim/nvim/lua/plugins/luasnip.lua @@ -0,0 +1,12 @@ +return { + "L3MON4D3/LuaSnip", + dependencies = { "rafamadriz/friendly-snippets" }, + -- follow latest release. + version = "v2.*", -- Replace by the latest released major (first number of latest release) + -- install jsregexp (optional!). + build = "make install_jsregexp", + config = function () + require('luasnip.loaders.from_vscode').lazy_load() + end + +} diff --git a/modules/home-manager/neovim/nvim/lua/plugins/nvim-tmux-navigation.lua b/modules/home-manager/neovim/nvim/lua/plugins/nvim-tmux-navigation.lua new file mode 100644 index 0000000..2b3e238 --- /dev/null +++ b/modules/home-manager/neovim/nvim/lua/plugins/nvim-tmux-navigation.lua @@ -0,0 +1,19 @@ +return { + "christoomey/vim-tmux-navigator", + cmd = { + "TmuxNavigateLeft", + "TmuxNavigateDown", + "TmuxNavigateUp", + "TmuxNavigateRight", + "TmuxNavigatePrevious", + }, + keys = { + { "", "TmuxNavigateLeft" }, + { "", "TmuxNavigateDown" }, + { "", "TmuxNavigateUp" }, + { "", "TmuxNavigateRight" }, + { "", "TmuxNavigatePrevious" }, + }, +} + + diff --git a/modules/home-manager/neovim/nvim/lua/plugins/nvim-ts-autotag.lua b/modules/home-manager/neovim/nvim/lua/plugins/nvim-ts-autotag.lua new file mode 100644 index 0000000..2981246 --- /dev/null +++ b/modules/home-manager/neovim/nvim/lua/plugins/nvim-ts-autotag.lua @@ -0,0 +1,3 @@ +return { + 'windwp/nvim-ts-autotag', +} diff --git a/modules/home-manager/neovim/nvim/lua/plugins/pets.lua b/modules/home-manager/neovim/nvim/lua/plugins/pets.lua new file mode 100644 index 0000000..6468b36 --- /dev/null +++ b/modules/home-manager/neovim/nvim/lua/plugins/pets.lua @@ -0,0 +1,22 @@ +return { + "giusgad/pets.nvim", + dependencies = { "MunifTanjim/nui.nvim", "giusgad/hologram.nvim" }, + config = function () + require("pets").setup({ + row = 1, -- the row (height) to display the pet at (higher row means the pet is lower on the screen), must be 1<=row<=10 + col = 0, -- the column to display the pet at (set to high number to have it stay still on the right side) + speed_multiplier = 1, -- you can make your pet move faster/slower. If slower the animation will have lower fps. + default_pet = "dog", -- the pet to use for the PetNew command + default_style = "brown", -- the style of the pet to use for the PetNew command + random = true, -- whether to use a random pet for the PetNew command, overrides default_pet and default_style + death_animation = true, -- animate the pet's death, set to false to feel less guilt -- currently no animations are available + popup = { -- popup options, try changing these if you see a rectangle around the pets + width = "30%", -- can be a string with percentage like "45%" or a number of columns like 45 + winblend = 100, -- winblend value - see :h 'winblend' - only used if avoid_statusline is false + hl = { Normal = "Normal" }, -- hl is only set if avoid_statusline is true, you can put any hl group instead of "Normal" + avoid_statusline = true, -- if winblend is 100 then the popup is invisible and covers the statusline, if that + -- doesn't work for you then set this to true and the popup will use hl and will be spawned above the statusline (hopefully) + } + }) + end +} diff --git a/modules/home-manager/neovim/nvim/lua/plugins/rest.lua b/modules/home-manager/neovim/nvim/lua/plugins/rest.lua new file mode 100644 index 0000000..ca66ed1 --- /dev/null +++ b/modules/home-manager/neovim/nvim/lua/plugins/rest.lua @@ -0,0 +1,54 @@ +return { + "rest-nvim/rest.nvim", + dependencies = { { "nvim-lua/plenary.nvim" } }, + config = function() + require("rest-nvim").setup({ + -- Open request results in a horizontal split + result_split_horizontal = false, + -- Keep the http file buffer above|left when split horizontal|vertical + result_split_in_place = false, + -- stay in current windows (.http file) or change to results window (default) + stay_in_current_window_after_split = false, + -- Skip SSL verification, useful for unknown certificates + skip_ssl_verification = false, + -- Encode URL before making request + encode_url = true, + -- Highlight request on run + highlight = { + enabled = true, + timeout = 150, + }, + result = { + -- toggle showing URL, HTTP info, headers at top the of result window + show_url = true, + -- show the generated curl command in case you want to launch + -- the same request via the terminal (can be verbose) + show_curl_command = false, + show_http_info = true, + show_headers = true, + -- table of curl `--write-out` variables or false if disabled + -- for more granular control see Statistics Spec + show_statistics = false, + -- executables or functions for formatting response body [optional] + -- set them to false if you want to disable them + formatters = { + json = "jq", + html = function(body) + return vim.fn.system({"tidy", "-i", "-q", "-"}, body) + end + }, + }, + -- Jump to request line on run + jump_to_request = false, + env_file = '.env', + -- for telescope select + env_pattern = "\\.env$", + env_edit_command = "tabedit", + custom_dynamic_variables = {}, + yank_dry_run = true, + search_back = true, + }) + + vim.keymap.set("n", "r", "RestNvim") + end +} diff --git a/modules/home-manager/neovim/nvim/lua/plugins/surround.lua b/modules/home-manager/neovim/nvim/lua/plugins/surround.lua new file mode 100644 index 0000000..3df14c8 --- /dev/null +++ b/modules/home-manager/neovim/nvim/lua/plugins/surround.lua @@ -0,0 +1,10 @@ +return { + "kylechui/nvim-surround", + version = "*", -- Use for stability; omit to use `main` branch for the latest features + event = "VeryLazy", + config = function() + require("nvim-surround").setup({ + -- Configuration here, or leave empty to use defaults + }) + end +} diff --git a/modules/home-manager/neovim/nvim/lua/plugins/telescope-fzf-native.lua b/modules/home-manager/neovim/nvim/lua/plugins/telescope-fzf-native.lua new file mode 100644 index 0000000..35fc72b --- /dev/null +++ b/modules/home-manager/neovim/nvim/lua/plugins/telescope-fzf-native.lua @@ -0,0 +1,4 @@ +return { + 'nvim-telescope/telescope-fzf-native.nvim', + build = 'make' +} diff --git a/modules/home-manager/neovim/nvim/lua/plugins/telescope.lua b/modules/home-manager/neovim/nvim/lua/plugins/telescope.lua new file mode 100644 index 0000000..0a5f7af --- /dev/null +++ b/modules/home-manager/neovim/nvim/lua/plugins/telescope.lua @@ -0,0 +1,29 @@ +return { + { + 'nvim-telescope/telescope-ui-select.nvim' + }, + { + 'nvim-telescope/telescope.nvim', + dependencies = {'nvim-lua/plenary.nvim'}, + lazy = false, + keys = { + { "ff", "Telescope find_files" }, + { "fb", "Telescope buffers" }, + { "fo", "Telescope oldfiles" }, + { "fg", "Telescope live_grep" }, + { "fc", "Telescope commands" } + }, + config = function() + require("telescope").setup { + extensions = { + ["ui-select"] = { + require("telescope.themes").get_dropdown { + } + } + } + } + -- require('telescope').load_extension('fzf') + require("telescope").load_extension("ui-select") + end + } +} diff --git a/modules/home-manager/neovim/nvim/lua/plugins/transparent.lua b/modules/home-manager/neovim/nvim/lua/plugins/transparent.lua new file mode 100644 index 0000000..6934aa6 --- /dev/null +++ b/modules/home-manager/neovim/nvim/lua/plugins/transparent.lua @@ -0,0 +1,3 @@ +return { + 'xiyaowong/transparent.nvim' +} diff --git a/modules/home-manager/neovim/nvim/lua/plugins/treesitter.lua b/modules/home-manager/neovim/nvim/lua/plugins/treesitter.lua new file mode 100644 index 0000000..9cbf29c --- /dev/null +++ b/modules/home-manager/neovim/nvim/lua/plugins/treesitter.lua @@ -0,0 +1,79 @@ +return { + { + 'nvim-treesitter/nvim-treesitter', + config = function() + require('nvim-treesitter.configs').setup({ + -- Install parsers synchronously (only applied to `ensure_installed`) + sync_install = false, + + -- Automatically install missing parsers when entering buffer + auto_install = true, + + -- indent module + indent = { enable = true }, + + -- highlight module + highlight = { enable = true }, + + -- auto close tags in html/jsx/tsx + autotag = { enable = true }, + + incremental_selection = { + enable = true, + keymaps = { + init_selection = '', + scope_incremental = '', + node_incremental = '', + node_decremental = '', + }, + }, + + -- text object selection + textobjects = { + select = { + enable = true, + + -- Automatically jump forward to textobj, similar to targets.vim + lookahead = true, + + keymaps = { + -- You can use the capture groups defined in textobjects.scm + ["af"] = "@function.outer", + ["if"] = "@function.inner", + ["ac"] = "@class.outer", + ["ic"] = "@class.inner", + -- You can also use captures from other query groups like `locals.scm` + ["as"] = { query = "@scope", query_group = "locals", desc = "Select language scope" }, + }, + -- You can choose the select mode (default is charwise 'v') + -- + -- Can also be a function which gets passed a table with the keys + -- * query_string: eg '@function.inner' + -- * method: eg 'v' or 'o' + -- and should return the mode ('v', 'V', or '') or a table + -- mapping query_strings to modes. + selection_modes = { + ['@parameter.outer'] = 'v', -- charwise + ['@function.outer'] = 'V', -- linewise + ['@class.outer'] = '', -- blockwise + }, + -- If you set this to `true` (default is `false`) then any textobject is + -- extended to include preceding or succeeding whitespace. Succeeding + -- whitespace has priority in order to act similarly to eg the built-in + -- `ap`. + -- + -- Can also be a function which gets passed a table with the keys + -- * query_string: eg '@function.inner' + -- * selection_mode: eg 'v' + -- and should return true of false + include_surrounding_whitespace = true, + }, + }, + }) + end + }, + { + 'nvim-treesitter/nvim-treesitter-textobjects' + }, +} + diff --git a/modules/home-manager/neovim/nvim/lua/plugins/undotree.lua b/modules/home-manager/neovim/nvim/lua/plugins/undotree.lua new file mode 100644 index 0000000..e8847d9 --- /dev/null +++ b/modules/home-manager/neovim/nvim/lua/plugins/undotree.lua @@ -0,0 +1,6 @@ +return { + 'mbbill/undotree', + keys = { + { "u", vim.cmd.UndotreeToggle, desc = "Undotree" }, + } +} diff --git a/modules/home-manager/neovim/nvim/lua/plugins/webdevicons.lua b/modules/home-manager/neovim/nvim/lua/plugins/webdevicons.lua new file mode 100644 index 0000000..6fc7b01 --- /dev/null +++ b/modules/home-manager/neovim/nvim/lua/plugins/webdevicons.lua @@ -0,0 +1 @@ +return { 'nvim-tree/nvim-web-devicons' }