testing, telescope, etc

This commit is contained in:
Markus Dieckmann 2022-08-30 12:43:04 +02:00
parent 18a82b51aa
commit 68fd48afed
7 changed files with 152 additions and 47 deletions

View File

@ -13,3 +13,6 @@ require('cmp_config')
require('toggleterm_config')
require('virtual_lines_config')
require("null-ls_config")
require("telescope_config")
require("nvimtest_config")
require("neotest_config")

View File

@ -23,3 +23,4 @@ set.mouse="nicr"
set.termguicolors=true
set.matchpairs:append("<:>")
set.completeopt="menuone,noselect,preview"
set.expandtab=true

View File

@ -28,3 +28,5 @@ nmap("<leader>b","<cmd>lua require('telescope.builtin').buffers()<cr>")
nmap("<C-n>",":NvimTreeToggle<cr>")
nmap("<leader>r",":NvimTreeRefresh<cr>")
nmap("<leader>n",":NvimTreeToggle<cr>")
nmap("<leader>zn","zf%")

View File

@ -0,0 +1,19 @@
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")({
dap = { justMyCode = false },
}),
require("neotest-plenary"),
require("neotest-vim-test")({
ignore_file_types = { "python", "vim", "lua" },
}),
},
})

View File

@ -0,0 +1,39 @@
require('nvim-test').setup {
run = true, -- run tests (using for debug)
commands_create = true, -- create commands (TestFile, TestLast, ...)
filename_modifier = ":.", -- modify filenames before tests run(:h filename-modifiers)
silent = false, -- less notifications
term = "terminal", -- a terminal to run ("terminal"|"toggleterm")
termOpts = {
direction = "vertical", -- terminal's direction ("horizontal"|"vertical"|"float")
width = 96, -- terminal's width (for vertical|float)
height = 24, -- terminal's height (for horizontal|float)
go_back = false, -- return focus to original window after executing
stopinsert = "auto", -- exit from insert mode (true|false|"auto")
keep_one = true, -- keep only one terminal for testing
},
runners = { -- setup tests runners
cs = "nvim-test.runners.dotnet",
go = "nvim-test.runners.go-test",
haskell = "nvim-test.runners.hspec",
javacriptreact = "nvim-test.runners.jest",
javascript = "nvim-test.runners.jest",
lua = "nvim-test.runners.busted",
python = "nvim-test.runners.pytest",
ruby = "nvim-test.runners.rspec",
rust = "nvim-test.runners.cargo-test",
typescript = "nvim-test.runners.jest",
typescriptreact = "nvim-test.runners.jest",
}
}
require('nvim-test.runners.jest'):setup {
command = "jest", -- a command to run the test runner
args = { "--collectCoverage=false" }, -- default arguments
env = { CUSTOM_VAR = 'value' }, -- custom environment variables
file_pattern = "\\v(__tests__/.*|(spec|test))\\.(js|jsx|coffee|ts|tsx)$", -- determine whether a file is a testfile
find_files = { "{name}.test.{ext}", "{name}.spec.{ext}" }, -- find testfile for a file
filename_modifier = nil, -- modify filename before tests run (:h filename-modifiers)
working_directory = nil, -- set working directory (cwd by default)
}

View File

@ -1,48 +1,79 @@
require('packer').startup(function(use)
use 'wbthomason/packer.nvim'
use {
require("packer").startup(function(use)
use("wbthomason/packer.nvim")
use({
"williamboman/mason.nvim",
"williamboman/mason-lspconfig.nvim",
"neovim/nvim-lspconfig",
"WhoIsSethDaniel/mason-tool-installer.nvim"
}
use 'mfussenegger/nvim-dap'
use 'jose-elias-alvarez/null-ls.nvim'
use {
'nvim-telescope/telescope.nvim', tag = '0.1.0',
requires = { {'nvim-lua/plenary.nvim'} }
}
use 'nvim-lua/lsp-status.nvim'
use 'jiangmiao/auto-pairs'
use 'machakann/vim-sandwich'
use 'machakann/vim-highlightedyank'
use 'bling/vim-airline'
use 'airblade/vim-gitgutter'
use 'easymotion/vim-easymotion'
use {
'antoinemadec/FixCursorHold.nvim',
'kosayoda/nvim-lightbulb'
}
use 'hrsh7th/cmp-nvim-lsp'
use 'hrsh7th/cmp-buffer'
use 'hrsh7th/cmp-path'
use 'hrsh7th/nvim-cmp'
use 'hrsh7th/cmp-cmdline'
use 'saadparwaiz1/cmp_luasnip'
use 'L3MON4D3/LuaSnip'
use 'kyazdani42/nvim-web-devicons'
use 'kyazdani42/nvim-tree.lua'
use 'tpope/vim-fugitive'
use {
'nvim-treesitter/nvim-treesitter',
run = function() require('nvim-treesitter.install').update({ with_sync = true }) end,
}
use 'folke/tokyonight.nvim'
use 'simrat39/rust-tools.nvim'
use {"akinsho/toggleterm.nvim", tag = 'v2.*', config = function()
"WhoIsSethDaniel/mason-tool-installer.nvim",
})
use("mfussenegger/nvim-dap")
use("jose-elias-alvarez/null-ls.nvim")
use({
"nvim-telescope/telescope.nvim",
tag = "0.1.0",
requires = { { "nvim-lua/plenary.nvim" } },
})
use("nvim-lua/lsp-status.nvim")
use("jiangmiao/auto-pairs")
use("machakann/vim-sandwich")
use("machakann/vim-highlightedyank")
use("bling/vim-airline")
use("airblade/vim-gitgutter")
use("easymotion/vim-easymotion")
use({
"antoinemadec/FixCursorHold.nvim",
"kosayoda/nvim-lightbulb",
})
use("hrsh7th/cmp-nvim-lsp")
use("hrsh7th/cmp-buffer")
use("hrsh7th/cmp-path")
use("hrsh7th/nvim-cmp")
use("hrsh7th/cmp-cmdline")
use("saadparwaiz1/cmp_luasnip")
use("L3MON4D3/LuaSnip")
use("kyazdani42/nvim-web-devicons")
use("kyazdani42/nvim-tree.lua")
use("tpope/vim-fugitive")
use({
"nvim-treesitter/nvim-treesitter",
run = function()
require("nvim-treesitter.install").update({ with_sync = true })
end,
})
use("folke/tokyonight.nvim")
use("simrat39/rust-tools.nvim")
use({
"akinsho/toggleterm.nvim",
tag = "v2.*",
config = function()
require("toggleterm").setup()
end}
use 'https://git.sr.ht/~whynothugo/lsp_lines.nvim'
end,
})
use("https://git.sr.ht/~whynothugo/lsp_lines.nvim")
--use 'morhetz/gruvbox'
use({
"folke/which-key.nvim",
config = function()
require("which-key").setup({})
end,
})
use("gbrlsnchs/telescope-lsp-handlers.nvim")
use({
"klen/nvim-test",
config = function()
require("nvim-test").setup()
end,
})
use({
"nvim-neotest/neotest",
requires = {
"nvim-lua/plenary.nvim",
"nvim-treesitter/nvim-treesitter",
"antoinemadec/FixCursorHold.nvim",
"haydenmeade/neotest-jest",
"nvim-neotest/neotest-python",
"nvim-neotest/neotest-plenary",
"nvim-neotest/neotest-vim-test",
},
})
end)

View File

@ -0,0 +1,10 @@
require('telescope').load_extension('lsp_handlers')
require('telescope').setup({
extensions = {
lsp_handlers = {
code_action = {
telescope = require('telescope.themes').get_dropdown({}),
},
},
},
})