From da5c16e736b9dc7b3216e7be7fd63840ded678c1 Mon Sep 17 00:00:00 2001 From: Michael Yockey Date: Fri, 17 May 2024 20:32:56 -0400 Subject: [PATCH] feat: Add Oil and Neotest to Neovim --- nvim/.config/nvim/lazy-lock.json | 13 +++++--- nvim/.config/nvim/lua/yock/plugins/lsp.lua | 3 -- .../.config/nvim/lua/yock/plugins/neotest.lua | 31 +++++++++++++++++++ nvim/.config/nvim/lua/yock/plugins/oil.lua | 12 +++++++ nvim/.config/nvim/lua/yock/plugins/rspec.lua | 23 -------------- nvim/.config/nvim/lua/yock/remap.lua | 2 -- 6 files changed, 51 insertions(+), 33 deletions(-) create mode 100644 nvim/.config/nvim/lua/yock/plugins/neotest.lua create mode 100644 nvim/.config/nvim/lua/yock/plugins/oil.lua delete mode 100644 nvim/.config/nvim/lua/yock/plugins/rspec.lua diff --git a/nvim/.config/nvim/lazy-lock.json b/nvim/.config/nvim/lazy-lock.json index 2ecd6f0..08a51b2 100644 --- a/nvim/.config/nvim/lazy-lock.json +++ b/nvim/.config/nvim/lazy-lock.json @@ -1,4 +1,5 @@ { + "FixCursorHold.nvim": { "branch": "master", "commit": "1900f89dc17c603eec29960f57c00bd9ae696495" }, "LuaSnip": { "branch": "master", "commit": "8f3d3465ba5c7ade0a8adb41eca5736f291a3fa8" }, "cloak.nvim": { "branch": "main", "commit": "6e5bcd50bebc5cdb7cd3a00eb3d97ab7c4cc3b94" }, "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, @@ -11,25 +12,27 @@ "cmp-tmux": { "branch": "main", "commit": "95b1b921802e6f60627b3e76afb9380fddd87f9a" }, "cmp-zsh": { "branch": "main", "commit": "c24db8e58fac9006ec23d93f236749288d00dec9" }, "cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" }, - "friendly-snippets": { "branch": "main", "commit": "ea068f1becd91bcd4591fceb6420d4335e2e14d3" }, + "friendly-snippets": { "branch": "main", "commit": "d5f74ce4dfdd82848f3f4eac65fe6e29ac5df4c2" }, "git-blame.nvim": { "branch": "master", "commit": "ad1d1365c9189d89797fe8d559677d5f55dc2830" }, "gitmoji.nvim": { "branch": "main", "commit": "326ddf01cbf3425566a089126ece7e8bd2560601" }, "harpoon": { "branch": "harpoon2", "commit": "0378a6c428a0bed6a2781d459d7943843f374bce" }, "lazy.nvim": { "branch": "main", "commit": "3f13f080434ac942b150679223d54f5ca91e0d52" }, "lualine.nvim": { "branch": "master", "commit": "0a5a66803c7407767b799067986b4dc3036e1983" }, + "neotest": { "branch": "master", "commit": "5caac5cc235d495a2382bc2980630ef36ac87032" }, + "neotest-rspec": { "branch": "main", "commit": "201f4891b5a0edc2e5f12196f35726f4d4eca410" }, "nvim": { "branch": "main", "commit": "a1439ad7c584efb3d0ce14ccb835967f030450fe" }, "nvim-cmp": { "branch": "main", "commit": "8f3c541407e691af6163e2447f3af1bd6e17f9a3" }, "nvim-dap": { "branch": "master", "commit": "6ae8a14828b0f3bff1721a35a1dfd604b6a933bb" }, "nvim-dap-ruby": { "branch": "main", "commit": "a2248b7b31f6f096b9e847e769afd00060e0aae4" }, "nvim-dap-ui": { "branch": "master", "commit": "5934302d63d1ede12c0b22b6f23518bb183fc972" }, - "nvim-lspconfig": { "branch": "master", "commit": "7133e85c3df14a387da8942c094c7edddcdef309" }, + "nvim-lspconfig": { "branch": "master", "commit": "ae0651d850f8f9313d4db3f96fe24dbf054edeb4" }, "nvim-nio": { "branch": "master", "commit": "7fa5545299fc7a48d5ec74d27f414b862060095f" }, "nvim-surround": { "branch": "main", "commit": "a4e30d33add8a9743b4f518b3a788b3c8e5def71" }, "nvim-tmux-navigation": { "branch": "main", "commit": "4898c98702954439233fdaf764c39636681e2861" }, - "nvim-treesitter": { "branch": "master", "commit": "19f69a5b434470723c32311cdc4d8d0e8db76358" }, - "nvim-web-devicons": { "branch": "master", "commit": "27eac98fd6675d29d0e19d4d0622fd7a3968483a" }, + "nvim-treesitter": { "branch": "master", "commit": "160e5d52c841dc9261c0b2dc6f253bddbcf3d766" }, + "nvim-web-devicons": { "branch": "master", "commit": "794bba734ec95eaff9bb82fbd112473be2087283" }, + "oil.nvim": { "branch": "master", "commit": "f630887cd845a7341bc16488fe8aaecffe3aaa8a" }, "plenary.nvim": { "branch": "master", "commit": "08e301982b9a057110ede7a735dd1b5285eb341f" }, - "rspec.nvim": { "branch": "main", "commit": "c9b9d530707221483ad737ca5329110b8e4b5a23" }, "telescope-fzf-native.nvim": { "branch": "main", "commit": "9ef21b2e6bb6ebeaf349a0781745549bbb870d27" }, "telescope.nvim": { "branch": "master", "commit": "35f94f0ef32d70e3664a703cefbe71bd1456d899" }, "todo-comments.nvim": { "branch": "main", "commit": "a7e39ae9e74f2c8c6dc4eea6d40c3971ae84752d" }, diff --git a/nvim/.config/nvim/lua/yock/plugins/lsp.lua b/nvim/.config/nvim/lua/yock/plugins/lsp.lua index d35ccff..26f1c9c 100644 --- a/nvim/.config/nvim/lua/yock/plugins/lsp.lua +++ b/nvim/.config/nvim/lua/yock/plugins/lsp.lua @@ -46,9 +46,6 @@ return { group = vim.api.nvim_create_augroup('UserLspConfig', {}), callback = function(ev) local client = vim.lsp.get_client_by_id(ev.data.client_id) - if client.server_capabilities.inlayHintProvider then - vim.lsp.inlay_hint.enable(ev.buf, true) - end -- Enable completion triggered by vim.bo[ev.buf].omnifunc = 'v:lua.vim.lsp.omnifunc' diff --git a/nvim/.config/nvim/lua/yock/plugins/neotest.lua b/nvim/.config/nvim/lua/yock/plugins/neotest.lua new file mode 100644 index 0000000..42b464d --- /dev/null +++ b/nvim/.config/nvim/lua/yock/plugins/neotest.lua @@ -0,0 +1,31 @@ +return { + 'nvim-neotest/neotest', + dependencies = { + 'nvim-neotest/nvim-nio', + 'nvim-lua/plenary.nvim', + 'antoinemadec/FixCursorHold.nvim', + 'nvim-treesitter/nvim-treesitter', + 'olimorris/neotest-rspec', + }, + config = function() + local neotest = require('neotest') + local rspec = require('neotest-rspec') + neotest.setup({ + adapters = { + require('neotest-rspec'), + }, + }) + + rspec({ + rspec_cmd = function() + return vim.tbl_flatten({ + 'bin/rspec', + }) + end + }) + + vim.keymap.set('n', 'rn', function() require('neotest').run.run() end, { desc = 'Run nearest test' }) + vim.keymap.set('n', 'rf', function() require('neotest').run.run(vim.fn.expand("%")) end, { desc = 'Run current file tests' }) + vim.keymap.set('n', 'no', function() require('neotest').output.open({ enter = true, auto_close = true }) end, { desc = 'Open Neotest output window' }) + end, +} diff --git a/nvim/.config/nvim/lua/yock/plugins/oil.lua b/nvim/.config/nvim/lua/yock/plugins/oil.lua new file mode 100644 index 0000000..21458d2 --- /dev/null +++ b/nvim/.config/nvim/lua/yock/plugins/oil.lua @@ -0,0 +1,12 @@ +return { + 'stevearc/oil.nvim', + dependencies = { 'nvim-tree/nvim-web-devicons' }, + opts = { + view_options = { + show_hidden = true, + }, + }, + keys = { + { '-', 'Oil', { desc = 'Open parent directory' } }, + }, +} diff --git a/nvim/.config/nvim/lua/yock/plugins/rspec.lua b/nvim/.config/nvim/lua/yock/plugins/rspec.lua deleted file mode 100644 index 5320399..0000000 --- a/nvim/.config/nvim/lua/yock/plugins/rspec.lua +++ /dev/null @@ -1,23 +0,0 @@ -return { - 'mogulla3/rspec.nvim', - opts = { - 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 = {}, - }, - keys = { - { 'rn', 'RSpecNearest', desc = 'Run nearest spec' }, - { 'rf', 'RSpecCurrentFile', desc = 'Run spec file' }, - { 'rr', 'RSpecRerun', desc = 'Run last spec' }, - { 'rF', 'RSpecOnlyFailures', desc = 'Run previously failed specs' }, - { 'rR', 'RSpecShowLastResult', desc = 'Show last result' }, - }, -} diff --git a/nvim/.config/nvim/lua/yock/remap.lua b/nvim/.config/nvim/lua/yock/remap.lua index 28fbaa4..dc351cb 100644 --- a/nvim/.config/nvim/lua/yock/remap.lua +++ b/nvim/.config/nvim/lua/yock/remap.lua @@ -1,5 +1,3 @@ -vim.keymap.set("n", "pv", vim.cmd.Ex, { desc = 'Ex mode' }) - -- Move highlights vim.keymap.set('v', 'J', ":m '>+1gv=gv") vim.keymap.set('v', 'K', ":m '<-2gv=gv")