work setup
This commit is contained in:
67
nvim/lua/cmp_config.lua
Normal file
67
nvim/lua/cmp_config.lua
Normal file
@ -0,0 +1,67 @@
|
||||
|
||||
local cmp = require("cmp")
|
||||
local luasnip = require("luasnip")
|
||||
|
||||
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'}})
|
||||
})
|
||||
|
@ -0,0 +1,8 @@
|
||||
local dap = require('dap')
|
||||
dap.adapters.node2 = {
|
||||
type = 'executable',
|
||||
command = 'node',
|
||||
args = {os.getenv('HOME') .. '/dev/microsoft/vscode-node-debug2/out/src/nodeDebug.js'},
|
||||
}
|
||||
vim.fn.sign_define('DapBreakpoint', {text='🟥', texthl='', linehl='', numhl=''})
|
||||
vim.fn.sign_define('DapStopped', {text='⭐️', texthl='', linehl='', numhl=''})
|
||||
|
51
nvim/lua/debugHelper.lua
Normal file
51
nvim/lua/debugHelper.lua
Normal file
@ -0,0 +1,51 @@
|
||||
|
||||
local dap = require('dap')
|
||||
|
||||
local function debugJest(testName, filename)
|
||||
print("starting " .. testName .. " in " .. filename)
|
||||
dap.run({
|
||||
type = 'node2',
|
||||
request = 'launch',
|
||||
cwd = vim.fn.getcwd(),
|
||||
runtimeArgs = {'--inspect-brk', '/usr/local/bin/jest', '--no-coverage', '-t', testName, '--', filename},
|
||||
sourceMaps = true,
|
||||
protocol = 'inspector',
|
||||
skipFiles = {'<node_internals>/**/*.js'},
|
||||
console = 'integratedTerminal',
|
||||
port = 9229,
|
||||
})
|
||||
end
|
||||
|
||||
local function attach()
|
||||
print("attaching")
|
||||
dap.run({
|
||||
type = 'node2',
|
||||
request = 'attach',
|
||||
cwd = vim.fn.getcwd(),
|
||||
sourceMaps = true,
|
||||
protocol = 'inspector',
|
||||
skipFiles = {'<node_internals>/**/*.js'},
|
||||
})
|
||||
end
|
||||
|
||||
local function attachToRemote()
|
||||
print("attaching")
|
||||
dap.run({
|
||||
type = 'node2',
|
||||
request = 'attach',
|
||||
address = "127.0.0.1",
|
||||
port = 9229,
|
||||
localRoot = vim.fn.getcwd(),
|
||||
remoteRoot = "/home/vcap/app",
|
||||
sourceMaps = true,
|
||||
protocol = 'inspector',
|
||||
skipFiles = {'<node_internals>/**/*.js'},
|
||||
})
|
||||
end
|
||||
|
||||
return {
|
||||
debugJest = debugJest,
|
||||
attach = attach,
|
||||
attachToRemote = attachToRemote,
|
||||
}
|
||||
|
@ -1,16 +1,19 @@
|
||||
|
||||
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'.jsonls.setup{
|
||||
capabilites = capabilites
|
||||
}
|
||||
require'lspconfig'.dockerls.setup{
|
||||
capabilites = capabilites
|
||||
}
|
||||
require'lspconfig'.eslint.setup{
|
||||
capabilites = capabilites
|
||||
capabilites = capabilites,
|
||||
settings= {
|
||||
run = "onSave"
|
||||
}
|
||||
}
|
||||
require'lspconfig'.gdscript.setup{
|
||||
capabilites = capabilites
|
||||
@ -28,68 +31,5 @@ require'lspconfig'.bashls.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()
|
||||
|
||||
|
@ -10,7 +10,7 @@ require'nvim-tree'.setup {
|
||||
folder_arrow= false
|
||||
},
|
||||
glyphs = {
|
||||
default= "",
|
||||
default= "",
|
||||
symlink= "",
|
||||
git= {
|
||||
unstaged= "✗",
|
||||
@ -45,8 +45,8 @@ require'nvim-tree'.setup {
|
||||
indent_markers = {
|
||||
enable = true,
|
||||
icons = {
|
||||
corner = "└ ",
|
||||
edge = "│ ",
|
||||
corner = "└",
|
||||
edge = "│ ",
|
||||
none = " ",
|
||||
}
|
||||
}
|
||||
@ -57,10 +57,11 @@ require'nvim-tree'.setup {
|
||||
open_on_setup = false,
|
||||
ignore_ft_on_setup = {},
|
||||
open_on_tab = false,
|
||||
hijack_cursor = false,
|
||||
hijack_cursor = true,
|
||||
auto_reload_on_write = true,
|
||||
update_cwd = false,
|
||||
diagnostics = {
|
||||
enable = false,
|
||||
enable = true,
|
||||
icons = {
|
||||
hint = "",
|
||||
info = "",
|
||||
@ -88,6 +89,7 @@ require'nvim-tree'.setup {
|
||||
},
|
||||
actions = {
|
||||
open_file = {
|
||||
resize_window = false,
|
||||
window_picker = {
|
||||
exclude = {
|
||||
filetype = { "notify", "packer", "qf", "diff", "fugitive", "fugitiveblame" },
|
||||
@ -97,8 +99,7 @@ require'nvim-tree'.setup {
|
||||
}
|
||||
},
|
||||
view = {
|
||||
width = 25,
|
||||
height = 30,
|
||||
width = 35,
|
||||
hide_root_folder = false,
|
||||
side = 'left',
|
||||
mappings = {
|
||||
|
9
nvim/lua/todotxt_config.lua
Normal file
9
nvim/lua/todotxt_config.lua
Normal file
@ -0,0 +1,9 @@
|
||||
todo = require('todotxt-nvim')
|
||||
todo.setup({
|
||||
todo_file = '/home/mardie/todotxt/todo.txt',
|
||||
sidebar = {
|
||||
width = 40,
|
||||
position = 'right'
|
||||
}
|
||||
}
|
||||
)
|
11
nvim/lua/toggleterm_config.lua
Normal file
11
nvim/lua/toggleterm_config.lua
Normal file
@ -0,0 +1,11 @@
|
||||
require"toggleterm".setup{
|
||||
open_mapping = [[<c-y>]],
|
||||
hide_numbers = true,
|
||||
direction = 'float',
|
||||
float_opts = {
|
||||
border = 'curved'
|
||||
},
|
||||
winbar = {
|
||||
enabled = false
|
||||
}
|
||||
}
|
9
nvim/lua/virtual_lines_config.lua
Normal file
9
nvim/lua/virtual_lines_config.lua
Normal file
@ -0,0 +1,9 @@
|
||||
lines = require('lsp_lines')
|
||||
lines.setup()
|
||||
vim.diagnostic.config({ virtual_text = false });
|
||||
vim.keymap.set(
|
||||
"",
|
||||
"tl",
|
||||
lines.toggle,
|
||||
{ desc = "Toggle lsp_lines" }
|
||||
);
|
Reference in New Issue
Block a user