From bdaba979acff49035aa85d53bbc8f583d191d0b7 Mon Sep 17 00:00:00 2001 From: iofq Date: Tue, 13 Aug 2024 02:50:48 -0500 Subject: [PATCH] add a few plugins like neoclip, markvieww --- flake.lock | 19 ++++++++++++++++++- flake.nix | 11 ++++------- nix/neovim-overlay.nix | 12 +++++------- nvim/after/plugin/color.lua | 18 +++++++++++++++++- nvim/init.lua | 2 +- nvim/plugin/aerial.lua | 9 ++++++--- nvim/plugin/completion.lua | 2 +- nvim/plugin/keymaps.lua | 11 +++++------ nvim/plugin/lsp.lua | 1 - nvim/plugin/lualine.lua | 9 ++++++++- nvim/plugin/mini.lua | 4 +++- nvim/plugin/misc.lua | 6 ++++++ nvim/plugin/telescope.lua | 8 +------- nvim/plugin/treesitter.lua | 4 +--- 14 files changed, 76 insertions(+), 40 deletions(-) diff --git a/flake.lock b/flake.lock index e72b4c6..a379f8a 100644 --- a/flake.lock +++ b/flake.lock @@ -99,11 +99,28 @@ "type": "github" } }, + "render-markdown-nvim": { + "flake": false, + "locked": { + "lastModified": 1723453943, + "narHash": "sha256-fpmR6cqjnRcyJO2rP/8WXbu+mSSH+yblI5yyt/5yL6w=", + "owner": "MeanderingProgrammer", + "repo": "render-markdown.nvim", + "rev": "72688baea4ef0ed605033bf654b54d801b6a5f01", + "type": "github" + }, + "original": { + "owner": "MeanderingProgrammer", + "repo": "render-markdown.nvim", + "type": "github" + } + }, "root": { "inputs": { "flake-utils": "flake-utils", "gen-luarc": "gen-luarc", - "nixpkgs": "nixpkgs_2" + "nixpkgs": "nixpkgs_2", + "render-markdown-nvim": "render-markdown-nvim" } }, "systems": { diff --git a/flake.nix b/flake.nix index 36a10c5..dfe24b7 100644 --- a/flake.nix +++ b/flake.nix @@ -5,13 +5,10 @@ nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; flake-utils.url = "github:numtide/flake-utils"; gen-luarc.url = "github:mrcjkb/nix-gen-luarc-json"; - - # Add bleeding-edge plugins here. - # They can be updated with `nix flake update` (make sure to commit the generated flake.lock) - # wf-nvim = { - # url = "github:Cassin01/wf.nvim"; - # flake = false; - # }; + render-markdown-nvim = { + url = "github:MeanderingProgrammer/render-markdown.nvim"; + flake = false; + }; }; outputs = inputs @ { diff --git a/nix/neovim-overlay.nix b/nix/neovim-overlay.nix index 99a98c7..701f427 100644 --- a/nix/neovim-overlay.nix +++ b/nix/neovim-overlay.nix @@ -3,13 +3,6 @@ with final.pkgs.lib; let pkgs = final; - # Use this to create a plugin from a flake input - # mkNvimPlugin = src: pname: - # pkgs.vimUtils.buildVimPlugin { - # inherit pname src; - # version = src.lastModifiedDate; - # }; - pkgs-wrapNeovim = inputs.nixpkgs.legacyPackages.${pkgs.system}; mkNeovim = pkgs.callPackage ./mkNeovim.nix { inherit pkgs-wrapNeovim; }; @@ -23,17 +16,21 @@ with final.pkgs.lib; let cmp-treesitter cmp_luasnip diffview-nvim + dressing-nvim + everforest eyeliner-nvim friendly-snippets gitsigns-nvim lualine-nvim luasnip + markview-nvim mini-nvim neogen neogit nightfox-nvim nvim-cmp nvim-lspconfig + nvim-neoclip-lua nvim-treesitter-context nvim-treesitter-textobjects (nvim-treesitter.withPlugins(p: with p; [ @@ -66,6 +63,7 @@ with final.pkgs.lib; let nvim-web-devicons oil-nvim rose-pine + scope-nvim telescope-fzf-native-nvim telescope-nvim toggleterm-nvim diff --git a/nvim/after/plugin/color.lua b/nvim/after/plugin/color.lua index 68bb744..aeae73a 100644 --- a/nvim/after/plugin/color.lua +++ b/nvim/after/plugin/color.lua @@ -1,4 +1,20 @@ +vim.keymap.set('n', 'x', '"rd', { remap = true, silent = true }) vim.cmd('colorscheme terafox') +vim.api.nvim_set_hl(0, 'TabLineSel', { ctermbg=none, underline = true}) +vim.api.nvim_set_hl(0, 'TabLine', { ctermbg=none, underline = false}) + vim.keymap.set('n', 'aa', 'AerialToggle!', { desc = 'Toggle Aerial' }) vim.keymap.set('n', 'nb', vim.cmd.DiffviewOpen, { noremap = true, desc = '[g]it [d]iffview open' }) -vim.keymap.set('n', 't', "Trouble diagnostics toggle focus=true filter.buf=0", { noremap = true, desc = 'Trouble diagnostics' }) +vim.keymap.set('n', 'de', "Trouble diagnostics toggle focus=true filter.buf=0", { noremap = true, desc = 'Trouble diagnostics' }) + +vim.api.nvim_set_hl(0, 'EyelinerPrimary', { underline = true }) +vim.api.nvim_set_hl(0, 'EyelinerSecondary', { underline = true }) + +local ts = require("telescope") +ts.load_extension("aerial") +vim.keymap.set( + 'n', + 'fs', + ts.extensions.aerial.aerial, + { noremap = true, silent = true, desc = 'Fuzzy find treesitter objects' } +) diff --git a/nvim/init.lua b/nvim/init.lua index e748f34..39aba7e 100644 --- a/nvim/init.lua +++ b/nvim/init.lua @@ -1,6 +1,7 @@ -- vim settings ++ mini.nvim.basics ---------------------------------------- vim.opt.backspace = 'indent,eol,start' +vim.opt.clipboard = 'unnamedplus' vim.opt.completeopt = 'menuone' vim.opt.expandtab = true -- insert tabs as spaces vim.opt.inccommand = 'split' -- incremental live completion @@ -18,7 +19,6 @@ vim.opt.swapfile = false vim.opt.tabstop = 2 -- 2 space tabs are based vim.opt.updatetime = 250 -- decrease update time vim.opt.virtualedit = 'onemore' - vim.g.fzf_layout = { window = { width = 0.9, height = 0.6 } } -- no highlight floats diff --git a/nvim/plugin/aerial.lua b/nvim/plugin/aerial.lua index 22322fd..4e27aa7 100644 --- a/nvim/plugin/aerial.lua +++ b/nvim/plugin/aerial.lua @@ -4,10 +4,13 @@ end vim.g.did_load_aerial_plugin = true require('aerial').setup { - default_direction = 'left', autojump = true, on_attach = function(bufnr) - vim.keymap.set('n', '{', 'AerialPrev', { buffer = bufnr }) - vim.keymap.set('n', '}', 'AerialNext', { buffer = bufnr }) + vim.keymap.set('n', '[[', 'AerialPrev', { buffer = bufnr }) + vim.keymap.set('n', ']]', 'AerialNext', { buffer = bufnr }) end, + close_autonatic_events = { + unfocus, + switch_buffer, + }, } diff --git a/nvim/plugin/completion.lua b/nvim/plugin/completion.lua index 0b68498..5e3e1b4 100644 --- a/nvim/plugin/completion.lua +++ b/nvim/plugin/completion.lua @@ -18,7 +18,7 @@ cmp.setup { [''] = cmp.mapping.scroll_docs(-4), [''] = cmp.mapping.scroll_docs(4), [''] = cmp.mapping.complete(), - ['q'] = cmp.mapping.abort(), + [''] = cmp.mapping.abort(), [''] = cmp.mapping.confirm { select = true }, -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. }, sources = cmp.config.sources({ diff --git a/nvim/plugin/keymaps.lua b/nvim/plugin/keymaps.lua index 9a5056e..ea6cd6f 100644 --- a/nvim/plugin/keymaps.lua +++ b/nvim/plugin/keymaps.lua @@ -1,13 +1,12 @@ -vim.keymap.set('n', 'gr', 'gT', { noremap = true, silent = true }) +vim.keymap.set('n', 'tt', vim.cmd.tabnext, { silent = true }) +vim.keymap.set('n', 'tr', vim.cmd.tabprev, { silent = true }) +vim.keymap.set('n', 'gt', vim.cmd.bnext, { silent = true }) +vim.keymap.set('n', 'gr', vim.cmd.bprev, { noremap = true, silent = true }) +vim.keymap.set('n', 'gq', vim.cmd.bdelete, { silent = true }) vim.keymap.set('n', 'n', 'nzz', { noremap = true, silent = true }) vim.keymap.set('n', 'N', 'Nzz', { noremap = true, silent = true }) vim.keymap.set('n', '', 'zz') vim.keymap.set('n', '', 'zz') vim.keymap.set('n', '', 'zz') vim.keymap.set('n', '', 'zz') -vim.keymap.set('n', '', 'm0i`0', { noremap = true, silent = true }) vim.keymap.set({ 'v', 'i' }, 'wq', 'l', { noremap = true, silent = true }) -vim.keymap.set({ 'n', 'v', 'i' }, 'qwq', 'lwqa', { noremap = true, silent = true }) -vim.keymap.set({ 'n', 'v' }, 'yy', '"*y', { noremap = true, silent = true, desc = 'Yank to clip' }) -vim.keymap.set({ 'n', 'v' }, 'yp', '"*p', { noremap = true, silent = true, desc = 'Paste from clip' }) -vim.keymap.set({ 'n', 'v' }, 'yd', '"*d', { noremap = true, silent = true, desc = 'Delete to clip' }) diff --git a/nvim/plugin/lsp.lua b/nvim/plugin/lsp.lua index 6156159..765da6b 100644 --- a/nvim/plugin/lsp.lua +++ b/nvim/plugin/lsp.lua @@ -18,7 +18,6 @@ lspconfig.nil_ls.setup { capabilities = capabilities } vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, { desc = 'Prev diagnostic' }) vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { desc = 'Next diagnostic' }) -vim.keymap.set('n', 'de', vim.diagnostic.open_float, { desc = 'Toggle diagnostic' }) vim.diagnostic.config { virtual_text = true, diff --git a/nvim/plugin/lualine.lua b/nvim/plugin/lualine.lua index 7aff49c..257326d 100644 --- a/nvim/plugin/lualine.lua +++ b/nvim/plugin/lualine.lua @@ -6,6 +6,13 @@ vim.g.did_load_lualine_plugin = true vim.schedule(function() require('lualine').setup { globalstatus = true, - extensions = { 'fugitive', 'fzf', 'toggleterm', 'quickfix' }, + extensions = { 'oil', 'trouble', 'aerial', 'fzf', 'toggleterm', 'quickfix' }, + sections = { + lualine_x = {'filetype'} + }, + tabline = { + lualine_a = {'buffers'}, + lualine_z = {'tabs'}, + } } end) diff --git a/nvim/plugin/mini.lua b/nvim/plugin/mini.lua index 39d1729..aedb8c5 100644 --- a/nvim/plugin/mini.lua +++ b/nvim/plugin/mini.lua @@ -54,7 +54,7 @@ require('mini.pairs').setup() vim.cmd([[ hi MiniCursorwordCurrent ctermfg=240 ]]) require('mini.jump2d').setup { - mappings = { start_jumping = 's' }, + mappings = { start_jumping = 'S' }, } indent = require('mini.indentscope') @@ -63,3 +63,5 @@ indent.setup { draw = { delay = 0 }, } indent.gen_animation.none() + +require('mini.icons').setup() diff --git a/nvim/plugin/misc.lua b/nvim/plugin/misc.lua index 9d08c8d..b389bea 100644 --- a/nvim/plugin/misc.lua +++ b/nvim/plugin/misc.lua @@ -13,6 +13,7 @@ require('toggleterm').setup { open_mapping = [[]], direction = 'float', close_on_exit = true, + autochdir = true, } require('which-key').setup { @@ -20,3 +21,8 @@ require('which-key').setup { } require('trouble').setup {} require('eyeliner').setup {} +require('dressing').setup {} +require('markview').setup() +require('scope').setup({}) +require('neoclip').setup({default_register='+'}) +vim.keymap.set('n', 'fp', 'Telescope neoclip', { noremap = true, silent = true, desc = 'Pick clipboard history' }) diff --git a/nvim/plugin/telescope.lua b/nvim/plugin/telescope.lua index 5d332f0..f33f0b3 100644 --- a/nvim/plugin/telescope.lua +++ b/nvim/plugin/telescope.lua @@ -16,7 +16,7 @@ end vim.keymap.set( 'n', - '', + 'fb', telescope.buffers, { noremap = true, silent = true, desc = 'Fuzzy find buffers' } ) @@ -35,12 +35,6 @@ vim.keymap.set( telescope.grep_string, { noremap = true, silent = true, desc = 'Fuzzy find grep current word' } ) -vim.keymap.set( - 'n', - 'fs', - telescope.treesitter, - { noremap = true, silent = true, desc = 'Fuzzy find treesitter objects' } -) vim.keymap.set('n', 'fq', telescope.quickfix, { noremap = true, silent = true, desc = 'Fuzzy find quickfix' }) vim.keymap.set('n', 'f', telescope.resume, { noremap = true, silent = true, desc = 'Fuzzy find resume' }) diff --git a/nvim/plugin/treesitter.lua b/nvim/plugin/treesitter.lua index ab11674..84f43b6 100644 --- a/nvim/plugin/treesitter.lua +++ b/nvim/plugin/treesitter.lua @@ -33,11 +33,9 @@ require('nvim-treesitter.configs').setup { enable = true, set_jumps = true, -- whether to set jumps in the jumplist goto_next_start = { - [']]'] = '@function.outer', [']a'] = '@parameter.inner', }, goto_previous_start = { - ['[['] = '@function.outer', ['[a'] = '@parameter.inner', }, }, @@ -62,6 +60,6 @@ require('nvim-treesitter.configs').setup { } require('treesitter-context').setup { - max_lines = 3, + max_lines = 2, min_window_height = 50 }