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('toggleterm_config')
require('virtual_lines_config') require('virtual_lines_config')
require("null-ls_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.termguicolors=true
set.matchpairs:append("<:>") set.matchpairs:append("<:>")
set.completeopt="menuone,noselect,preview" 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("<C-n>",":NvimTreeToggle<cr>")
nmap("<leader>r",":NvimTreeRefresh<cr>") nmap("<leader>r",":NvimTreeRefresh<cr>")
nmap("<leader>n",":NvimTreeToggle<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) require("packer").startup(function(use)
use 'wbthomason/packer.nvim' use("wbthomason/packer.nvim")
use { use({
"williamboman/mason.nvim", "williamboman/mason.nvim",
"williamboman/mason-lspconfig.nvim", "williamboman/mason-lspconfig.nvim",
"neovim/nvim-lspconfig", "neovim/nvim-lspconfig",
"WhoIsSethDaniel/mason-tool-installer.nvim" "WhoIsSethDaniel/mason-tool-installer.nvim",
} })
use 'mfussenegger/nvim-dap' use("mfussenegger/nvim-dap")
use 'jose-elias-alvarez/null-ls.nvim' use("jose-elias-alvarez/null-ls.nvim")
use { use({
'nvim-telescope/telescope.nvim', tag = '0.1.0', "nvim-telescope/telescope.nvim",
requires = { {'nvim-lua/plenary.nvim'} } tag = "0.1.0",
} requires = { { "nvim-lua/plenary.nvim" } },
use 'nvim-lua/lsp-status.nvim' })
use 'jiangmiao/auto-pairs' use("nvim-lua/lsp-status.nvim")
use 'machakann/vim-sandwich' use("jiangmiao/auto-pairs")
use 'machakann/vim-highlightedyank' use("machakann/vim-sandwich")
use 'bling/vim-airline' use("machakann/vim-highlightedyank")
use 'airblade/vim-gitgutter' use("bling/vim-airline")
use 'easymotion/vim-easymotion' use("airblade/vim-gitgutter")
use { use("easymotion/vim-easymotion")
'antoinemadec/FixCursorHold.nvim', use({
'kosayoda/nvim-lightbulb' "antoinemadec/FixCursorHold.nvim",
} "kosayoda/nvim-lightbulb",
use 'hrsh7th/cmp-nvim-lsp' })
use 'hrsh7th/cmp-buffer' use("hrsh7th/cmp-nvim-lsp")
use 'hrsh7th/cmp-path' use("hrsh7th/cmp-buffer")
use 'hrsh7th/nvim-cmp' use("hrsh7th/cmp-path")
use 'hrsh7th/cmp-cmdline' use("hrsh7th/nvim-cmp")
use 'saadparwaiz1/cmp_luasnip' use("hrsh7th/cmp-cmdline")
use 'L3MON4D3/LuaSnip' use("saadparwaiz1/cmp_luasnip")
use 'kyazdani42/nvim-web-devicons' use("L3MON4D3/LuaSnip")
use 'kyazdani42/nvim-tree.lua' use("kyazdani42/nvim-web-devicons")
use 'tpope/vim-fugitive' use("kyazdani42/nvim-tree.lua")
use { use("tpope/vim-fugitive")
'nvim-treesitter/nvim-treesitter', use({
run = function() require('nvim-treesitter.install').update({ with_sync = true }) end, "nvim-treesitter/nvim-treesitter",
} run = function()
use 'folke/tokyonight.nvim' require("nvim-treesitter.install").update({ with_sync = true })
use 'simrat39/rust-tools.nvim' end,
use {"akinsho/toggleterm.nvim", tag = 'v2.*', config = function() })
use("folke/tokyonight.nvim")
use("simrat39/rust-tools.nvim")
use({
"akinsho/toggleterm.nvim",
tag = "v2.*",
config = function()
require("toggleterm").setup() require("toggleterm").setup()
end} end,
use 'https://git.sr.ht/~whynothugo/lsp_lines.nvim' })
use("https://git.sr.ht/~whynothugo/lsp_lines.nvim")
--use 'morhetz/gruvbox' --use 'morhetz/gruvbox'
use({
end) "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({}),
},
},
},
})