From a30bbb718258683cbb1c354610b3087a2bdbd9c2 Mon Sep 17 00:00:00 2001 From: Michael Yockey Date: Sat, 9 Mar 2024 19:46:13 -0500 Subject: [PATCH] feat: mass pckr config --- nvim/.config/nvim/after/plugin/cloal.lua | 27 +++++++++++ nvim/.config/nvim/after/plugin/lsp.lua | 3 +- nvim/.config/nvim/after/plugin/ruby.lua | 20 ++++++++ nvim/.config/nvim/after/plugin/surround.lua | 1 + nvim/.config/nvim/after/plugin/telescope.lua | 49 +++++++++++++++++++- nvim/.config/nvim/lua/yock/pckr.lua | 12 +++-- nvim/.config/nvim/lua/yock/remap.lua | 5 ++ 7 files changed, 111 insertions(+), 6 deletions(-) create mode 100644 nvim/.config/nvim/after/plugin/cloal.lua create mode 100644 nvim/.config/nvim/after/plugin/ruby.lua create mode 100644 nvim/.config/nvim/after/plugin/surround.lua diff --git a/nvim/.config/nvim/after/plugin/cloal.lua b/nvim/.config/nvim/after/plugin/cloal.lua new file mode 100644 index 0000000..995192e --- /dev/null +++ b/nvim/.config/nvim/after/plugin/cloal.lua @@ -0,0 +1,27 @@ +require('cloak').setup({ + enabled = true, + cloak_character = '*', + -- The applied highlight group (colors) on the cloaking, see `:h highlight`. + highlight_group = 'Comment', + -- Applies the length of the replacement characters for all matched + -- patterns, defaults to the length of the matched pattern. + cloak_length = nil, -- Provide a number if you want to hide the true length of the value. + -- Whether it should try every pattern to find the best fit or stop after the first. + try_all_patterns = true, + patterns = { + { + -- Match any file starting with '.env'. + -- This can be a table to match multiple file patterns. + file_pattern = '.env*', + -- Match an equals sign and any character after it. + -- This can also be a table of patterns to cloak, + -- example: cloak_pattern = { ':.+', '-.+' } for yaml files. + cloak_pattern = '=.+', + -- A function, table or string to generate the replacement. + -- The actual replacement will contain the 'cloak_character' + -- where it doesn't cover the original text. + -- If left empty the legacy behavior of keeping the first character is retained. + replace = nil, + }, + }, +}) diff --git a/nvim/.config/nvim/after/plugin/lsp.lua b/nvim/.config/nvim/after/plugin/lsp.lua index 28b30da..b7ea60d 100644 --- a/nvim/.config/nvim/after/plugin/lsp.lua +++ b/nvim/.config/nvim/after/plugin/lsp.lua @@ -6,6 +6,7 @@ mason.setup({}) mason_lspconfig.setup({ ensure_installed = { 'ruby_ls', + 'rubocop', 'tsserver', 'lua_ls', }, @@ -42,7 +43,7 @@ lsp.on_attach(function(_client, bufnr) vim.keymap.set('n', 'vca', function() vim.lsp.buf.code_action() end, opts) vim.keymap.set('n', 'vrr', function() vim.lsp.buf.references() end, opts) vim.keymap.set('n', 'vrn', function() vim.lsp.buf.rename() end, opts) - vim.keymap.set('n', '', function() vim.lsp.buf.signature_help() end, opts) + vim.keymap.set('n', 'vrh', function() vim.lsp.buf.signature_help() end, opts) end) lsp.setup() diff --git a/nvim/.config/nvim/after/plugin/ruby.lua b/nvim/.config/nvim/after/plugin/ruby.lua new file mode 100644 index 0000000..b9e3ed9 --- /dev/null +++ b/nvim/.config/nvim/after/plugin/ruby.lua @@ -0,0 +1,20 @@ +require('rspec').setup({ + allowed_file_format = function(filename) + return vim.endswith(filename, '_spec.rb') + end, + + formatter = 'progress', + focus_on_last_spec_result_window = true, + open_quickfix_when_spec_failed = true, + last_result_path = vim.fn.stdpath('data') .. '/rspec_last_result', + last_failed_result_path = vim.fn.stdpath('data') .. '/rspec_last_failed_result', + jump_command = 'edit', + ignored_dirs_on_jump = {}, +}) + +local opts = { noremap = true, silent = true } +vim.keymap.set("n", "rn", ":RSpecNearest", opts) +vim.keymap.set("n", "rcf", ":RSpecCurrentFile", opts) +vim.keymap.set("n", "rr", ":RSpecRerun", opts) +vim.keymap.set("n", "rof", ":RSpecOnlyFailures", opts) +vim.keymap.set("n", "rslr", ":RSpecShowLastResult", opts) diff --git a/nvim/.config/nvim/after/plugin/surround.lua b/nvim/.config/nvim/after/plugin/surround.lua new file mode 100644 index 0000000..2f76c6a --- /dev/null +++ b/nvim/.config/nvim/after/plugin/surround.lua @@ -0,0 +1 @@ +require('nvim-surround').setup({}) diff --git a/nvim/.config/nvim/after/plugin/telescope.lua b/nvim/.config/nvim/after/plugin/telescope.lua index 4806008..1925519 100644 --- a/nvim/.config/nvim/after/plugin/telescope.lua +++ b/nvim/.config/nvim/after/plugin/telescope.lua @@ -1,6 +1,53 @@ +local telescope = require('telescope') local builtin = require('telescope.builtin') + +-- Borrowed from https://stackoverflow.com/a/76991432/513872 +telescope.setup{ + defaults = { + -- configure to use ripgrep + vimgrep_arguments = { + "rg", + "--follow", -- Follow symbolic links + "--hidden", -- Search for hidden files + "--no-heading", -- Don't group matches by each file + "--with-filename", -- Print the file path with the matched lines + "--line-number", -- Show line numbers + "--column", -- Show column numbers + "--smart-case", -- Smart case search + + -- Exclude some patterns from search + "--glob=!**/.git/*", + "--glob=!**/.idea/*", + "--glob=!**/.vscode/*", + "--glob=!**/build/*", + "--glob=!**/dist/*", + "--glob=!**/yarn.lock", + "--glob=!**/package-lock.json", + }, + }, + pickers = { + find_files = { + hidden = true, + -- needed to exclude some files & dirs from general search + -- when not included or specified in .gitignore + find_command = { + "rg", + "--files", + "--hidden", + "--glob=!**/.git/*", + "--glob=!**/.idea/*", + "--glob=!**/.vscode/*", + "--glob=!**/build/*", + "--glob=!**/dist/*", + "--glob=!**/yarn.lock", + "--glob=!**/package-lock.json", + }, + }, + }, +} + 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/nvim/.config/nvim/lua/yock/pckr.lua b/nvim/.config/nvim/lua/yock/pckr.lua index 7679598..e6b9a37 100644 --- a/nvim/.config/nvim/lua/yock/pckr.lua +++ b/nvim/.config/nvim/lua/yock/pckr.lua @@ -17,10 +17,10 @@ end bootstrap_pckr() require('pckr').add{ - { 'nvim-telescope/telescope.nvim', requires = { 'nvim-lua/plenary.nvim' } }, - { 'kepano/flexoki-neovim' }, + { 'nvim-telescope/telescope.nvim', requires = { 'nvim-lua/plenary.nvim' } }, + 'kepano/flexoki-neovim', { 'nvim-treesitter/nvim-treesitter', run = ':TSUpdate' }, - { 'mbbill/undotree' }, + 'mbbill/undotree', { 'VonHeikemen/lsp-zero.nvim', requires = { @@ -37,5 +37,9 @@ require('pckr').add{ { 'saadparwaiz1/cmp_luasnip' }, }, }, - { 'zbirenbaum/copilot-cmp', requires = { 'github/copilot.lua' } }, + 'f-person/git-blame.nvim', + 'github/copilot.vim', + 'laytan/cloak.nvim', + 'kylechui/nvim-surround', + 'mogulla3/rspec.nvim', } diff --git a/nvim/.config/nvim/lua/yock/remap.lua b/nvim/.config/nvim/lua/yock/remap.lua index df3a20d..8f63e7f 100644 --- a/nvim/.config/nvim/lua/yock/remap.lua +++ b/nvim/.config/nvim/lua/yock/remap.lua @@ -12,3 +12,8 @@ vim.keymap.set('n', 'y', "\"+y") vim.keymap.set('v', 'y', "\"+y") vim.keymap.set('n', 'Y', "\"+Y") +-- Split navigation +vim.keymap.set('n', '', 'h') +vim.keymap.set('n', '', 'j') +vim.keymap.set('n', '', 'k') +vim.keymap.set('n', '', 'l')