diff --git a/nvim/init.lua b/nvim/init.lua index 4f800c5..a3c1b5c 100644 --- a/nvim/init.lua +++ b/nvim/init.lua @@ -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") diff --git a/nvim/lua/globals_opts.lua b/nvim/lua/globals_opts.lua index 5627cbf..78f8043 100644 --- a/nvim/lua/globals_opts.lua +++ b/nvim/lua/globals_opts.lua @@ -23,3 +23,4 @@ set.mouse="nicr" set.termguicolors=true set.matchpairs:append("<:>") set.completeopt="menuone,noselect,preview" +set.expandtab=true diff --git a/nvim/lua/keymap.lua b/nvim/lua/keymap.lua index 935c71f..a3ac307 100644 --- a/nvim/lua/keymap.lua +++ b/nvim/lua/keymap.lua @@ -28,3 +28,5 @@ nmap("b","lua require('telescope.builtin').buffers()") nmap("",":NvimTreeToggle") nmap("r",":NvimTreeRefresh") nmap("n",":NvimTreeToggle") + +nmap("zn","zf%") diff --git a/nvim/lua/neotest_config.lua b/nvim/lua/neotest_config.lua new file mode 100644 index 0000000..102a64c --- /dev/null +++ b/nvim/lua/neotest_config.lua @@ -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" }, + }), + }, +}) diff --git a/nvim/lua/nvimtest_config.lua b/nvim/lua/nvimtest_config.lua new file mode 100644 index 0000000..24f852a --- /dev/null +++ b/nvim/lua/nvimtest_config.lua @@ -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) + } diff --git a/nvim/lua/plugins.lua b/nvim/lua/plugins.lua index 8fb21e8..871b3ac 100644 --- a/nvim/lua/plugins.lua +++ b/nvim/lua/plugins.lua @@ -1,48 +1,79 @@ -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() +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() require("toggleterm").setup() - end} - use 'https://git.sr.ht/~whynothugo/lsp_lines.nvim' - --use 'morhetz/gruvbox' - - end) + 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) diff --git a/nvim/lua/telescope_config.lua b/nvim/lua/telescope_config.lua new file mode 100644 index 0000000..ed8d51b --- /dev/null +++ b/nvim/lua/telescope_config.lua @@ -0,0 +1,10 @@ +require('telescope').load_extension('lsp_handlers') +require('telescope').setup({ + extensions = { + lsp_handlers = { + code_action = { + telescope = require('telescope.themes').get_dropdown({}), + }, + }, + }, +})