update nvim config

This commit is contained in:
mightypanders
2022-05-24 08:56:38 +02:00
parent 522ee244af
commit b2a4bdc5eb
8 changed files with 406 additions and 0 deletions

0
nvim/lua/dap_config.lua Normal file
View File

22
nvim/lua/jester.lua Normal file
View File

@ -0,0 +1,22 @@
require'jester'.setup({
cmd = "yarn run test -t '$result' -- $file", -- run command
identifiers = {"test", "it"}, -- used to identify tests
prepend = {"describe"}, -- prepend describe blocks
expressions = {"call_expression"}, -- tree-sitter object used to scan for tests/describe blocks
path_to_jest_run = './node_modules/jest/bin/jest', -- used to run tests
path_to_jest_debug = './node_modules/jest/bin/jest', -- used for debugging
terminal_cmd = ":vsplit | terminal", -- used to spawn a terminal for running tests, for debugging refer to nvim-dap's config
dap = { -- debug adapter configuration
type = 'node2',
request = 'launch',
cwd = vim.fn.getcwd(),
runtimeArgs = {'--inspect-brk', '$path_to_jest', '--no-coverage', '-t', '$result', '--', '$file'},
args = { '--no-cache' },
sourceMaps = 'inline',
protocol = 'inspector',
skipFiles = {'<node_internals>/**/*.js'},
console = 'integratedTerminal',
port = 9229,
disableOptimisticBPs = true
}
})

89
nvim/lua/lsp_config.lua Normal file
View File

@ -0,0 +1,89 @@
local cmp = require("cmp")
local luasnip = require("luasnip")
local capabilites = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities())
require'lspconfig'.tsserver.setup{
capabilites = capabilites
}
require'lspconfig'.dockerls.setup{
capabilites = capabilites
}
require'lspconfig'.eslint.setup{
capabilites = capabilites
}
require'lspconfig'.gdscript.setup{
capabilites = capabilites
}
require'lspconfig'.gopls.setup{
capabilites = capabilites
}
require'lspconfig'.rust_analyzer.setup{
capabilites = capabilites
}
local has_words_before = function()
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
return col ~= 0 and vim.api.nvim_buf_get_lines(0, line -1, line, true)[1]:sub(col,col):match("%s") == nil
end
cmp.setup({
snippet = {
expand = function(args)
require('luasnip').lsp_expand(args.body) -- For `luasnip` users.
end,
},
mapping = {
['<C-p>'] = cmp.mapping.select_prev_item(),
['<C-p>'] = cmp.mapping.select_next_item(),
['<C-d>'] = cmp.mapping(cmp.mapping.scroll_docs(-4), { 'i', 'c' }),
['<C-f>'] = cmp.mapping(cmp.mapping.scroll_docs(4), { 'i', 'c' }),
['<C-Space>'] = cmp.mapping(cmp.mapping.complete(), { 'i', 'c' }),
['<C-y>'] = cmp.config.disable, -- Specify `cmp.config.disable` if you want to remove the default `<C-y>` mapping.
['<C-e>'] = cmp.mapping({
i = cmp.mapping.abort(),
c = cmp.mapping.close(),
}),
['<CR>'] = cmp.mapping.confirm({ select = true }),
['<Tab>'] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif luasnip.expand_or_jumpable() then
luasnip.expand_or_jump()
elseif has_words_before() then
cmp.complete()
else
fallback()
end
end,{"i","s"}),
['<S-Tab>'] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
elseif luasnip.jumpable(-1) then
luasnip.jump(-1)
else
fallback()
end
end,{"i","s"})
},
sources = cmp.config.sources({
{ name = 'nvim_lsp' },
{ name = 'luasnip' }, -- For luasnip users.
}, {
{ name = 'buffer' },
})
})
cmp.setup.cmdline('/',{
sources = {
{ name = 'buffer' }
}
})
cmp.setup.cmdline(':',{
sources = cmp.config.sources({
{name = 'path'}
},{{name='cmdline'}})
})
require'fzf_lsp'.setup()

66
nvim/lua/nvimtree.lua Normal file
View File

@ -0,0 +1,66 @@
require'nvim-tree'.setup {
renderer ={
indent_markers = {
enable = true,
icons = {
corner = "",
edge = "",
none = " ",
}
}
},
disable_netrw = true,
hijack_netrw = true,
open_on_setup = false,
ignore_ft_on_setup = {},
open_on_tab = false,
hijack_cursor = false,
update_cwd = false,
diagnostics = {
enable = false,
icons = {
hint = "",
info = "",
warning = "",
error = "",
}
},
update_focused_file = {
enable = true,
update_cwd = true,
ignore_list = {}
},
system_open = {
cmd = nil,
args = {}
},
filters = {
dotfiles = false,
custom = {}
},
git={
ignore = false,
enable= true,
timeout=500,
},
actions = {
open_file = {
window_picker = {
exclude = {
filetype = { "notify", "packer", "qf", "diff", "fugitive", "fugitiveblame" },
buftype = { "nofile","terminal","help" }
}
}
}
},
view = {
width = 25,
height = 30,
hide_root_folder = false,
side = 'left',
mappings = {
custom_only = false,
list = {}
}
}
}

View File

@ -0,0 +1,25 @@
require'nvim-treesitter.configs'.setup {
-- One of "all", "maintained" (parsers with maintainers), or a list of languages
ensure_installed = "all",
-- Install languages synchronously (only applied to `ensure_installed`)
sync_install = false,
-- List of parsers to ignore installing
ignore_install = { },
highlight = {
-- `false` will disable the whole extension
enable = true,
-- list of language that will be disabled
disable = { },
-- Setting this to true will run `:h syntax` and tree-sitter at the same time.
-- Set this to `true` if you depend on 'syntax' being enabled (like for indentation).
-- Using this option may slow down your editor, and you may see some duplicate highlights.
-- Instead of true it can also be a list of languages
additional_vim_regex_highlighting = false,
},
}