From 230b003e012334e438a4ebf05b991043877993f8 Mon Sep 17 00:00:00 2001 From: z3rOR0ne Date: Thu, 8 Sep 2022 11:13:23 -0700 Subject: [PATCH] :memo: Got nvim ready for testing --- nvim/lua/config.lua | 28 ++++++++++++++++++++++------ nvim/lua/packages.lua | 2 +- updates.txt | 1 - 3 files changed, 23 insertions(+), 8 deletions(-) diff --git a/nvim/lua/config.lua b/nvim/lua/config.lua index e3e68d7f..eeb1a12d 100644 --- a/nvim/lua/config.lua +++ b/nvim/lua/config.lua @@ -14,10 +14,7 @@ require('nvim-autopairs').setup{} require('gitsigns').setup() -- nvim-treesiter configuration: -- setup with all defaults require'nvim-treesitter.configs'.setup{ - ensure_installed = {"bash", "c", "c_sharp", "cmake", "cpp", "css", "dockerfile", "go", "html", "http", "java", "javascript", "json", "json5", "jsonc", "lua", "make", "perl", "php", "pug", "python", "regex", "ruby", "toml", "tsx", "typescript", "rust", "vim", "vue", "wgsl", "yaml",}, - highlight = { enable = 'true' } -} - + ensure_installed = {"bash", "c", "c_sharp", "cmake", "cpp", "css", "dockerfile", "go", "html", "http", "java", "javascript", "json", "json5", "jsonc", "lua", "make", "perl", "php", "pug", "python", "regex", "ruby", "toml", "tsx", "typescript", "rust", "vim", "vue", "wgsl", "yaml",}, highlight = { enable = 'true' } } -- To enable basic vim folding methods/expressions: -- -- vim.opt.foldmethod = "expr" @@ -96,7 +93,7 @@ local on_attach = function(client) require'completion'.on_attach(client) end --- Enable quick-lint-js +-- Enable quick-lint-js lsp require('lspconfig/quick_lint_js').setup {} -- Enable use of ripgrep @@ -119,7 +116,7 @@ vim.lsp.handlers['textDocument/publishDiagnostics'] = vim.lsp.with( } ) --- Enable rust-analyzer +-- Enable rust-analyzer lsp lspconfig.rust_analyzer.setup({ on_attach=on_attach, settings = { @@ -150,6 +147,24 @@ for _, lsp in ipairs(servers) do } end +-- neotest setup +require('neotest').setup({ + adapters = { + require('neotest-jest')({ + jestCommand = "npm test --", + jestConfigFile = "custom.jest.config.ts", + env = { CI = true }, + cwd = function(path) + return vim.fn.getcwd() + end, + }), + require('neotest-python'), + require('neotest-rust') + } +}) + +require('neotest').run.run() + -- Nvim_Tree configuration: -- setup with all defaults -- each of these are documented in `:help nvim-tree.OPTION_NAME` require'nvim-tree'.setup { -- BEGIN_DEFAULT_OPTS @@ -378,5 +393,6 @@ vim.cmd[[hi! NonText ctermbg=NONE guibg=NONE]] -- never create swap files vim.cmd[[set noswapfile]] + -- do not close the markdown preview tab when switching to other buffers -- vim.g.mkdp_auto_close = 0 diff --git a/nvim/lua/packages.lua b/nvim/lua/packages.lua index 5c3a5b6d..8b7872ef 100644 --- a/nvim/lua/packages.lua +++ b/nvim/lua/packages.lua @@ -49,11 +49,11 @@ require('packer').startup(function() use 'windwp/nvim-autopairs' use 'simeji/winresizer' use '907th/vim-auto-save' - use 'David-Kunz/jester' -- for unit tests using jest use 'rinx/nvim-ripgrep' use 'sbdchd/neoformat' -- general formatter for various languages use 'rhysd/vim-clang-format' -- formatter for c and c++ use { 'sindrets/diffview.nvim', requires = 'nvim-lua/plenary.nvim' } use 'arrufat/vala.vim' -- for vala programming language use 'chemzqm/neovim' + use {'nvim-neotest/neotest', requires = { 'nvim-lua/plenary.nvim', 'nvim-treesitter/nvim-treesitter', 'antoinemadec/FixCursorHold.nvim', 'haydenmeade/neotest-jest', 'nvim-neotest/neotest-python', 'rouge8/neotest-rust' }} end) diff --git a/updates.txt b/updates.txt index 256ce899..f81daa0e 100644 --- a/updates.txt +++ b/updates.txt @@ -37,5 +37,4 @@ make sure to install all of the test files (jest should already be set up, but y doas npm install -g jest pip install pytest -cargo install rstest