Merge remote-tracking branch 'refs/remotes/origin/trunk' into trunk

This commit is contained in:
Daniel Yrovas 2022-03-29 12:07:02 +11:00
commit bc4c9964af
Signed by: danielyrovas
GPG key ID: 502473574FB06D96
5 changed files with 272 additions and 0 deletions

View file

@ -0,0 +1,4 @@
vim.cmd([[
inoremap <c-e> <esc>o- [ ]
nnoremap <c-e> <esc>o- [ ]
]])

94
.config/lvim/config.lua Normal file
View file

@ -0,0 +1,94 @@
-- Options
lvim.colorscheme = "tokyonight"
lvim.log.level = "warn"
lvim.format_on_save = true
lvim.builtin.alpha.mode = "startify"
lvim.builtin.nvimtree.show_icons.git = 1
lvim.builtin.lualine.options.globalstatus = true
local o = vim.opt
o.timeoutlen = 300
o.shell = "/bin/sh"
table.insert(lvim.builtin.cmp.sources, {name = "cmdline"} )
table.insert(lvim.builtin.cmp.sources, {name = "cmp_git"} )
table.insert(lvim.builtin.cmp.sources, {name = "digraphs"} )
table.insert(lvim.builtin.cmp.sources, {name = "spell", keyword_length = 3} )
table.insert(lvim.builtin.cmp.sources, {name = "dictionary", keyword_length = 3} )
table.insert(lvim.builtin.cmp.sources, {name = "rg", keyword_length = 3} )
-- Keymappings
lvim.leader = "space"
local delete = function () end
local cmp_status_ok, cmp = pcall (require, 'cmp')
if cmp_status_ok then
lvim.builtin.cmp.formatting.kind_icons.Method = "m "
lvim.builtin.cmp.formatting.kind_icons.Module = ""
lvim.builtin.cmp.formatting.kind_icons.Variable = ""
lvim.builtin.cmp.formatting.kind_icons.Constant = ""
lvim.builtin.cmp.formatting.kind_icons.Interface = ""
lvim.builtin.cmp.formatting.kind_icons.Field = ""
lvim.builtin.cmp.mapping["<C-Space>"] = delete()
lvim.builtin.cmp.mapping["<C-k>"] = delete()
lvim.builtin.cmp.mapping["<C-j>"] = delete()
lvim.builtin.cmp.mapping["<Tab>"] = delete()
lvim.builtin.cmp.mapping["<S-Tab>"] = delete()
lvim.builtin.cmp.mapping["<CR>"] = delete()
lvim.builtin.cmp.mapping["<C-y>"] = cmp.mapping.confirm { select = true}
lvim.builtin.cmp.mapping["<C-d>"] = delete()
lvim.builtin.cmp.mapping["<C-b>"] = cmp.mapping.scroll_docs(-4)
end
lvim.keys.normal_mode["<C-s>"] = ":w<cr>"
lvim.builtin.which_key.mappings["P"] = { "<cmd>Telescope projects<CR>", "Projects" }
lvim.builtin.which_key.mappings["t"] = {
name = "+Trouble",
r = { "<cmd>Trouble lsp_references<cr>", "References" },
f = { "<cmd>Trouble lsp_definitions<cr>", "Definitions" },
d = { "<cmd>Trouble lsp_document_diagnostics<cr>", "Diagnostics" },
q = { "<cmd>Trouble quickfix<cr>", "QuickFix" },
l = { "<cmd>Trouble loclist<cr>", "LocationList" },
w = { "<cmd>Trouble lsp_workspace_diagnostics<cr>", "Diagnostics" },
}
lvim.builtin.which_key.mappings["n"] = {
name = "+Neorg",
s = { ":NeorgStart silent=true<cr>", "Start"},
t = { ":Neorg gtd capture<cr>", "New Task"},
v = { ":Neorg gtd views<cr>", "View Tasks"},
e = { ":Neorg gtd edit<cr>", "Edit Tasks"},
w = { ":Neorg news all<cr>", "Neorg News"},
d = {
name = "+Journal",
t = { ":Neorg journal today<cr>", "Today" },
y = { ":Neorg journal yesterday<cr>", "Yesterday" },
n = { ":Neorg journal tomorrow<cr>", "Tomorrow" },
c = { ":Neorg journal custom", "Custom" },
},
}
-- Plugins
local req = function (module)
require(module)
end
lvim.builtin.notify.active = true
lvim.builtin.terminal.active = true
lvim.builtin.dap.active = true
lvim.plugins = {
{ "folke/tokyonight.nvim",
config = function()
vim.cmd[[colorscheme tokyonight]]
end, },
{ "petertriho/cmp-git" },
{ "uga-rosa/cmp-dictionary" },
{ "dmitmel/cmp-digraphs"},
{ "lukas-reineke/cmp-rg" },
{ "nvim-neorg/neorg", config = req "conf.neorg", },
{ "folke/trouble.nvim", cmd = "TroubleToggle", },
}
require "conf.luasnip"
require "conf.dap"
require "conf.dictionary"

View file

@ -0,0 +1,51 @@
local status_ok, dap = pcall(require, 'dap')
if not status_ok then
return
end
dap.adapters.lldb = {
type = 'executable',
command = '/usr/bin/lldb-vscode', -- adjust as needed
name = "lldb"
}
dap.configurations.cpp = {
{
name = "Launch",
type = "lldb",
request = "launch",
program = function()
return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file')
end,
cwd = '${workspaceFolder}',
stopOnEntry = false,
args = {},
-- 💀
-- if you change `runInTerminal` to true, you might need to change the yama/ptrace_scope setting:
--
-- echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope
--
-- Otherwise you might get the following error:
--
-- Error on launch: Failed to attach to the target process
--
-- But you should be aware of the implications:
-- https://www.kernel.org/doc/html/latest/admin-guide/LSM/Yama.html
runInTerminal = false,
-- 💀
-- If you use `runInTerminal = true` and resize the terminal window,
-- lldb-vscode will receive a `SIGWINCH` signal which can cause problems
-- To avoid that uncomment the following option
-- See https://github.com/mfussenegger/nvim-dap/issues/236#issuecomment-1066306073
postRunCommands = {'process handle -p true -s false -n false SIGWINCH'}
},
}
-- If you want to use this for rust and c, add something like this:
dap.configurations.c = dap.configurations.cpp
dap.configurations.rust = dap.configurations.cpp

View file

@ -0,0 +1,89 @@
local status_ok, ls = pcall(require, "luasnip")
if not status_ok then
return
end
local types = require "luasnip.util.types"
ls.config.set_config {
history = true,
updateevents = "TextChanged,TextChangedI",
enable_autosnippets = true,
ext_opts = {
[types.choiceNode] = {
active = {
virt_text = {{"", "Error"}}
}
},
[types.insertNode] = {
active = {
virt_text = {{"|", "Ok"}}
}
}
},
}
local snippet = ls.s
local i = ls.insert_node
local t = ls.text_node
-- local types = require "luasnip.util.types"
-- local f = ls.function_node
-- local c = ls.choice_node
-- local rep = require('luasnip.extras').rep
-- local fmt = require('luasnip.extras.fmt').fmt
local opts = { silent = true }
local map = vim.keymap.set
map({"i", "s"}, "<c-k>", function()
if ls.expand_or_jumpable() then
ls.expand_or_jump()
end
end, opts )
map({"i", "s"}, "<c-j>", function()
if ls.jumpable(-1) then
ls.jump(-1)
end
end, opts )
map({"i",}, "<c-l>", function()
if ls.choice_active() then
ls.change_choice(1)
end
end, opts )
map("n", "<leader><leader>s", "<cmd>source ~/.config/lvim/luasnip.lua<CR>" , opts)
local shortcut = function(val)
if type(val) == "string" then
return { t { val }, i(0) }
end
if type(val) == "table" then
for k, v in ipairs(val) do
if type(v) == "string" then
val[k] = t { v }
end
end
end
return val
end
local make = function(tbl)
local result = {}
for k, v in pairs(tbl) do
table.insert(result, (snippet({ trig = k, desc = v.desc }, shortcut(v))))
end
return result
end
local snippets = {}
snippets.all = {}
for _, ft_path in ipairs(vim.api.nvim_get_runtime_file("snips/*.lua", true)) do
local ft = vim.fn.fnamemodify(ft_path, ":t:r")
snippets[ft] = make(loadfile(ft_path)())
end
ls.snippets = snippets

View file

@ -0,0 +1,34 @@
local status_ok, neorg = pcall(require, 'neorg')
if not status_ok then
vim.notify 'Neorg did not load'
return
end
neorg.setup {
load = {
["core.defaults"] = {},
["core.norg.journal"] = {
config = {
workspace = "notes"
}
},
["core.norg.dirman"] = {
config = {
workspaces = {
notes = "~/Documents/notes",
},
autochdir = true,
index = "index.norg",
}
},
["core.gtd.base"] = {
config = {
workspace = "notes",
}
},
["core.gtd.ui"] = {},
["core.norg.concealer"] = {},
-- ["core.norg.completion"] = { config = { 'nvim-cmp'}},
-- ["core.integrations.nvim-cmp"] = {},
}
}