Skip to content

Commit 8f14ab2

Browse files
committed
breaking changes for nvim 0.7 stuffz
1 parent bbbaeb1 commit 8f14ab2

19 files changed

Lines changed: 353 additions & 150 deletions

File tree

xdg_config/nvim/after/plugin/completion.lua

Lines changed: 35 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@ cmp.setup {
5353
end,
5454
},
5555

56+
-- ["<tab>"] = false,
57+
["<tab>"] = cmp.config.disable,
58+
5659
-- ["<tab>"] = cmp.mapping {
5760
-- i = cmp.config.disable,
5861
-- c = function(fallback)
@@ -164,38 +167,38 @@ cmp.setup {
164167
},
165168
}
166169

167-
cmp.setup.cmdline("/", {
168-
completion = {
169-
-- Might allow this later, but I don't like it right now really.
170-
-- Although, perhaps if it just triggers w/ @ then we could.
171-
--
172-
-- I will have to come back to this.
173-
autocomplete = false,
174-
},
175-
sources = cmp.config.sources({
176-
{ name = "nvim_lsp_document_symbol" },
177-
}, {
178-
-- { name = "buffer", keyword_length = 5 },
179-
}),
180-
})
181-
182-
cmp.setup.cmdline(":", {
183-
completion = {
184-
autocomplete = false,
185-
},
186-
187-
sources = cmp.config.sources({
188-
{
189-
name = "path",
190-
},
191-
}, {
192-
{
193-
name = "cmdline",
194-
max_item_count = 20,
195-
keyword_length = 4,
196-
},
197-
}),
198-
})
170+
-- cmp.setup.cmdline("/", {
171+
-- completion = {
172+
-- -- Might allow this later, but I don't like it right now really.
173+
-- -- Although, perhaps if it just triggers w/ @ then we could.
174+
-- --
175+
-- -- I will have to come back to this.
176+
-- autocomplete = false,
177+
-- },
178+
-- sources = cmp.config.sources({
179+
-- { name = "nvim_lsp_document_symbol" },
180+
-- }, {
181+
-- -- { name = "buffer", keyword_length = 5 },
182+
-- }),
183+
-- })
184+
185+
-- cmp.setup.cmdline(":", {
186+
-- completion = {
187+
-- autocomplete = false,
188+
-- },
189+
--
190+
-- sources = cmp.config.sources({
191+
-- {
192+
-- name = "path",
193+
-- },
194+
-- }, {
195+
-- {
196+
-- name = "cmdline",
197+
-- max_item_count = 20,
198+
-- keyword_length = 4,
199+
-- },
200+
-- }),
201+
-- })
199202

200203
--[[
201204
" Setup buffer configuration (nvim-lua source only enables in Lua filetype).

xdg_config/nvim/after/plugin/dap.lua

Lines changed: 170 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,176 @@ require("dap-python").setup("python", {
315315
include_configs = true,
316316
})
317317

318+
dap.adapters.lldb = {
319+
type = "executable",
320+
command = "/usr/bin/lldb-vscode-12",
321+
name = "lldb",
322+
}
323+
324+
local extension_path = vim.fn.expand "~/.vscode/extensions/vadimcn.vscode-lldb-1.6.10/"
325+
local codelldb_path = extension_path .. "adapter/codelldb"
326+
local liblldb_path = extension_path .. "lldb/lib/liblldb.so"
327+
328+
-- dap.adapters.rt_lldb = {
329+
-- type = "executable",
330+
-- command = codelldb_path,
331+
-- name = "rt_lldb",
332+
-- }
333+
334+
dap.adapters.rt_lldb = function(callback, _)
335+
local stdout = vim.loop.new_pipe(false)
336+
local stderr = vim.loop.new_pipe(false)
337+
local handle
338+
local pid_or_err
339+
local port
340+
local error_message = ""
341+
342+
local opts = {
343+
stdio = { nil, stdout, stderr },
344+
args = { "--liblldb", liblldb_path },
345+
detached = true,
346+
}
347+
348+
handle, pid_or_err = vim.loop.spawn(codelldb_path, opts, function(code)
349+
stdout:close()
350+
stderr:close()
351+
handle:close()
352+
if code ~= 0 then
353+
print("codelldb exited with code", code)
354+
print("error message", error_message)
355+
end
356+
end)
357+
358+
assert(handle, "Error running codelldb: " .. tostring(pid_or_err))
359+
360+
stdout:read_start(function(err, chunk)
361+
assert(not err, err)
362+
if chunk then
363+
if not port then
364+
local chunks = {}
365+
for substring in chunk:gmatch "%S+" do
366+
table.insert(chunks, substring)
367+
end
368+
port = tonumber(chunks[#chunks])
369+
vim.schedule(function()
370+
callback {
371+
type = "server",
372+
host = "127.0.0.1",
373+
port = port,
374+
}
375+
end)
376+
else
377+
vim.schedule(function()
378+
require("dap.repl").append(chunk)
379+
end)
380+
end
381+
end
382+
end)
383+
stderr:read_start(function(_, chunk)
384+
if chunk then
385+
error_message = error_message .. chunk
386+
387+
vim.schedule(function()
388+
require("dap.repl").append(chunk)
389+
end)
390+
end
391+
end)
392+
end
393+
394+
-- function M.setup_adapter()
395+
-- local dap = require("dap")
396+
-- dap.adapters.rt_lldb = config.options.dap.adapter
397+
-- end
398+
399+
function StartRustServer(args)
400+
args = args or {}
401+
402+
if not pcall(require, "dap") then
403+
vim.notify "nvim-dap not found."
404+
return
405+
end
406+
407+
if not pcall(require, "plenary.job") then
408+
vim.notify "plenary not found."
409+
return
410+
end
411+
412+
local Job = require "plenary.job"
413+
414+
-- local cargo_args = get_cargo_args_from_runnables_args(args)
415+
416+
vim.notify "Compiling a debug build for debugging. This might take some time..."
417+
418+
Job
419+
:new({
420+
command = "cargo",
421+
args = { "build", "--message-format=json" },
422+
cwd = nil,
423+
on_exit = function(j, code)
424+
if code and code > 0 then
425+
vim.notify "An error occured while compiling. Please fix all compilation issues and try again."
426+
end
427+
vim.schedule(function()
428+
for _, value in pairs(j:result()) do
429+
local json = vim.fn.json_decode(value)
430+
if type(json) == "table" and json.executable ~= vim.NIL and json.executable ~= nil then
431+
local dap_config = {
432+
name = "Rust tools debug",
433+
type = "rt_lldb",
434+
request = "launch",
435+
program = json.executable,
436+
args = args.executableArgs or { "lsif", "/home/tjdevries/build/rmpv/" },
437+
cwd = args.workspaceRoot,
438+
stopOnEntry = false,
439+
runInTerminal = false,
440+
}
441+
dap.run(dap_config)
442+
443+
break
444+
end
445+
end
446+
end)
447+
end,
448+
})
449+
:start()
450+
end
451+
452+
dap.configurations.rust = {
453+
{
454+
name = "Launch",
455+
type = "lldb",
456+
request = "launch",
457+
program = function()
458+
return vim.fn.input("Path to executable: ", vim.fn.getcwd() .. "/", "file")
459+
end,
460+
cwd = "${workspaceFolder}",
461+
stopOnEntry = false,
462+
args = {},
463+
464+
-- if you change `runInTerminal` to true, you might need to change the yama/ptrace_scope setting:
465+
--
466+
-- echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope
467+
--
468+
-- Otherwise you might get the following error:
469+
--
470+
-- Error on launch: Failed to attach to the target process
471+
--
472+
-- But you should be aware of the implications:
473+
-- https://www.kernel.org/doc/html/latest/admin-guide/LSM/Yama.html
474+
runInTerminal = false,
475+
},
476+
{
477+
name = "Launch rust-analyzer lsif",
478+
type = "lldb",
479+
request = "launch",
480+
program = "/home/tjdevries/sourcegraph/rust-analyzer.git/monikers-1/target/debug/rust-analyzer",
481+
args = { "lsif", "/home/tjdevries/build/rmpv/" },
482+
cwd = "/home/tjdevries/sourcegraph/rust-analyzer.git/monikers-1/",
483+
stopOnEntry = false,
484+
runInTerminal = false,
485+
},
486+
}
487+
318488
vim.cmd [[nnoremap <silent> <F5> :lua require'dap'.continue()<CR>]]
319489
vim.cmd [[nnoremap <silent> <F1> :lua require'dap'.step_into()<CR>]]
320490
vim.cmd [[nnoremap <silent> <F10> :lua require'dap'.step_over()<CR>]]

xdg_config/nvim/after/plugin/diagnostic.lua

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
local nnoremap = vim.keymap.nnoremap
1+
local nmap = require("tj.keymap").nmap
22

33
vim.diagnostic.config {
44
underline = true,
@@ -24,21 +24,21 @@ local goto_opts = {
2424
float = true,
2525
}
2626

27-
nnoremap {
27+
nmap {
2828
"<space>dn",
2929
function()
3030
vim.diagnostic.goto_next(goto_opts)
3131
end,
3232
}
3333

34-
nnoremap {
34+
nmap {
3535
"<space>dp",
3636
function()
3737
vim.diagnostic.goto_prev(goto_opts)
3838
end,
3939
}
4040

41-
nnoremap {
41+
nmap {
4242
"<space>sl",
4343
function()
4444
vim.diagnostic.open_float(0, {
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
vim.g.dispatch_no_maps = 1
2-
vim.keymap.nnoremap { "m<CR>", "<cmd>Make!<CR>" }
2+
-- vim.keymap.set("n", "m<CR>", "<cmd>Make!<CR>")
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
local nnoremap = vim.keymap.nnoremap
2-
31
-- vim.fn["gina#custom#command#option"]('status', '--opener', 'vsplit')
42
-- nnoremap { '<leader>gs', '<cmd>Gina status<CR>' }
53

@@ -8,18 +6,20 @@ if not ok then
86
return
97
end
108

9+
local nmap = require("tj.keymap").nmap
10+
1111
neogit.setup {
1212
integrations = {
1313
diffview = true,
1414
},
1515
}
1616

17-
nnoremap { "<leader>gs", neogit.open }
18-
nnoremap {
17+
nmap { "<space>vv", ":DiffviewOpen " }
18+
19+
nmap { "<leader>gs", neogit.open }
20+
nmap {
1921
"<leader>gc",
2022
function()
2123
neogit.open { "commit" }
2224
end,
2325
}
24-
25-
nnoremap { "<space>vv", ":DiffviewOpen " }

xdg_config/nvim/after/plugin/harpoon.lua

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
local nnoremap = vim.keymap.nnoremap
1+
local nmap = require("tj.keymap").nmap
22

33
local ok, harpoon = pcall(require, "harpoon")
44
if not ok then
@@ -7,11 +7,11 @@ end
77

88
harpoon.setup {}
99

10-
nnoremap { "<M-h><M-m>", require("harpoon.mark").add_file }
11-
nnoremap { "<M-h><M-l>", require("harpoon.ui").toggle_quick_menu }
10+
nmap { "<M-h><M-m>", require("harpoon.mark").add_file }
11+
nmap { "<M-h><M-l>", require("harpoon.ui").toggle_quick_menu }
1212

1313
for i = 1, 5 do
14-
nnoremap {
14+
nmap {
1515
string.format("<space>%s", i),
1616
function()
1717
require("harpoon.ui").nav_file(i)

0 commit comments

Comments
 (0)