Compare commits
12 Commits
211cdea5cd
...
main
Author | SHA1 | Date | |
---|---|---|---|
08f3141e55 | |||
9a3cad7676 | |||
3c08b71cfe | |||
b3e4c31aad | |||
bf0c7e74ec | |||
6a3d24579a | |||
97f5c451c7 | |||
ac7e7fc197 | |||
2875a311cf | |||
4c5aaeec97 | |||
5cd1cc63e5 | |||
3fdc493641 |
@@ -10,30 +10,16 @@ else
|
||||
keymap.set("n", "<leader>W", ":lua require('utils').sudo_write()<CR>", opts("sudo write file"))
|
||||
end
|
||||
|
||||
-- Handy VSCode Shortcuts
|
||||
-- Move lines up and down
|
||||
vim.api.nvim_set_keymap("n", "<A-Up>", ":m .-2<CR>==", { noremap = true, silent = true })
|
||||
vim.api.nvim_set_keymap("n", "<A-Down>", ":m .+1<CR>==", { noremap = true, silent = true })
|
||||
vim.api.nvim_set_keymap("n", "<A-k>", "<Esc>:m .-2<CR>", { noremap = true, silent = true })
|
||||
vim.api.nvim_set_keymap("n", "<A-j>", "<Esc>:m .+1<CR>", { noremap = true, silent = true })
|
||||
vim.api.nvim_set_keymap("n", "<A-S-k>", "<Esc>:m .-2<CR>", { noremap = true, silent = true })
|
||||
vim.api.nvim_set_keymap("n", "<A-S-j>", "<Esc>:m .+1<CR>", { noremap = true, silent = true })
|
||||
|
||||
-- Move lines in insert mode
|
||||
vim.api.nvim_set_keymap("i", "<A-Up>", "<Esc>:m .-2<CR>i", { noremap = true, silent = true })
|
||||
vim.api.nvim_set_keymap("i", "<A-Down>", "<Esc>:m .+1<CR>i", { noremap = true, silent = true })
|
||||
vim.api.nvim_set_keymap("i", "<A-k>", "<Esc>:m .-2<CR>i", { noremap = true, silent = true })
|
||||
vim.api.nvim_set_keymap("i", "<A-j>", "<Esc>:m .+1<CR>i", { noremap = true, silent = true })
|
||||
vim.api.nvim_set_keymap("i", "<A-S-k>", "<Esc>:m .-2<CR>i", { noremap = true, silent = true })
|
||||
vim.api.nvim_set_keymap("i", "<A-S-j>", "<Esc>:m .+1<CR>i", { noremap = true, silent = true })
|
||||
|
||||
-- Copy lines up and down in normal mode
|
||||
vim.api.nvim_set_keymap("n", "<C-A-S-Up>", ":t .-1<CR>", { noremap = true, silent = true })
|
||||
vim.api.nvim_set_keymap("n", "<C-A-S-Down>", ":t .-1<CR>", { noremap = true, silent = true })
|
||||
vim.api.nvim_set_keymap("n", "<C-A-S-k>", ":t .-1<CR>", { noremap = true, silent = true })
|
||||
vim.api.nvim_set_keymap("n", "<C-A-S-j>", ":t .<CR>", { noremap = true, silent = true })
|
||||
|
||||
-- Copy lines up and down in insert mode
|
||||
vim.api.nvim_set_keymap("i", "<C-A-S-Up>", "<Esc>:t.-1<CR>i", { noremap = true, silent = true })
|
||||
vim.api.nvim_set_keymap("i", "<C-A-S-Down>", "<Esc>:t.<CR>i", { noremap = true, silent = true })
|
||||
vim.api.nvim_set_keymap("i", "<C-A-S-k>", "<Esc>:t.-1<CR>i", { noremap = true, silent = true })
|
||||
vim.api.nvim_set_keymap("i", "<C-A-S-j>", "<Esc>:t.<CR>i", { noremap = true, silent = true })
|
||||
|
||||
-- Keep selection in visual mode when indenting
|
||||
vim.api.nvim_set_keymap("v", "<", "<gv", { noremap = true, silent = true })
|
||||
@@ -61,10 +47,10 @@ keymap.set("n", "<leader><leader>m", ":MarkdownPreview<CR>", opts("Preview Markd
|
||||
|
||||
-- window navigation
|
||||
keymap.set("n", "<A-h>", "<C-w>h", opts())
|
||||
keymap.set("n", "<A-S-j>", "<C-w>j", opts())
|
||||
keymap.set("n", "<A-S-k>", "<C-w>k", opts())
|
||||
keymap.set("n", "<A-j>", "<C-w>j", opts())
|
||||
keymap.set("n", "<A-k>", "<C-w>k", opts())
|
||||
keymap.set("n", "<A-l>", "<C-w>l", opts())
|
||||
keymap.set("n", "<C-k>", "<C-w>w", opts())
|
||||
keymap.set("n", "<C-S-w>", "<C-w>w", opts())
|
||||
|
||||
-- window resize
|
||||
keymap.set("n", "<A-C-h>", ":vertical resize +2<CR>", opts("Resize horizontally right"))
|
||||
|
@@ -14,6 +14,7 @@ vim.opt.rtp:prepend(lazypath)
|
||||
require("lazy").setup({
|
||||
spec = {
|
||||
{ import = "plugins.nav" },
|
||||
{ import = "plugins.nav.telescope" },
|
||||
{ import = "plugins.lsp" },
|
||||
{ import = "plugins.style" },
|
||||
{ import = "plugins.util" },
|
||||
|
@@ -21,7 +21,14 @@ lsp.config("cmake", {
|
||||
on_attach = opts.on_attach,
|
||||
})
|
||||
|
||||
lsp.config("sourcekit", {
|
||||
capabilities = opts.capabilities,
|
||||
on_attach = opts.on_attach,
|
||||
filetypes = { "swift" }
|
||||
})
|
||||
|
||||
-- ── Enable configs ───────────────────────────────────────────────
|
||||
local enable = vim.lsp.enable
|
||||
enable("clangd")
|
||||
enable("cmake")
|
||||
enable("sourcekit")
|
||||
|
@@ -29,17 +29,18 @@ return {
|
||||
"bashls",
|
||||
"clangd",
|
||||
"cmake",
|
||||
-- "cssls",
|
||||
"cssls",
|
||||
"gopls",
|
||||
"html-lsp",
|
||||
"hyprls",
|
||||
"jdtls",
|
||||
"latexindent",
|
||||
"marksman",
|
||||
-- "lua_ls",
|
||||
-- "pyright",
|
||||
"lua_ls",
|
||||
"pyright",
|
||||
"rust_analyzer",
|
||||
"ruby_lsp",
|
||||
-- "ts_ls",
|
||||
"ts_ls",
|
||||
"vue_ls",
|
||||
"verible",
|
||||
},
|
||||
|
@@ -30,6 +30,8 @@ return {
|
||||
"4",
|
||||
"--bracket-spacing",
|
||||
"true",
|
||||
"--bracket-same-line",
|
||||
"true",
|
||||
"--arrow-parens",
|
||||
"avoid",
|
||||
"--jsx-single-quote",
|
||||
@@ -40,6 +42,8 @@ return {
|
||||
"false",
|
||||
"--single-quote",
|
||||
"true",
|
||||
"--single-attribute-per-line",
|
||||
"true",
|
||||
"--bracket-same-line",
|
||||
"true",
|
||||
"--vue-indent-script-and-style",
|
||||
|
8
nvim/lua/plugins/nav/telescope/frecency.lua
Normal file
8
nvim/lua/plugins/nav/telescope/frecency.lua
Normal file
@@ -0,0 +1,8 @@
|
||||
return {
|
||||
"nvim-telescope/telescope-frecency.nvim",
|
||||
-- install the latest stable version
|
||||
version = "*",
|
||||
config = function()
|
||||
require("telescope").load_extension("frecency")
|
||||
end,
|
||||
}
|
@@ -3,13 +3,21 @@ return {
|
||||
"nvim-telescope/telescope.nvim",
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
{
|
||||
"nvim-telescope/telescope-live-grep-args.nvim",
|
||||
-- This will not install any breaking changes.
|
||||
-- For major updates, this must be adjusted manually.
|
||||
version = "^1.0.0",
|
||||
},
|
||||
},
|
||||
config = function()
|
||||
local builtin = require("telescope.builtin")
|
||||
local actions = require("telescope.actions")
|
||||
local opts = { silent = true }
|
||||
local telescope = require("telescope")
|
||||
local lga_actions = require("telescope-live-grep-args.actions")
|
||||
|
||||
require("telescope").setup({
|
||||
telescope.setup({
|
||||
defaults = {
|
||||
mappings = {
|
||||
i = {
|
||||
@@ -17,16 +25,32 @@ return {
|
||||
["<C-k>"] = actions.move_selection_previous,
|
||||
["<C-q>"] = actions.smart_add_to_qflist,
|
||||
["<C-A-q>"] = actions.smart_send_to_qflist,
|
||||
["<C-Space>"] = lga_actions.quote_prompt(),
|
||||
},
|
||||
},
|
||||
path_display = { "truncate" },
|
||||
},
|
||||
extensions = {
|
||||
frecency = {
|
||||
db_safe_mode = false,
|
||||
matcher = "fuzzy"
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
telescope.load_extension("live_grep_args")
|
||||
|
||||
opts.desc = "telescope find files"
|
||||
vim.keymap.set("n", "<leader>ff", builtin.find_files, opts)
|
||||
|
||||
opts.desc = "telescope live grep"
|
||||
vim.keymap.set("n", "<leader>fg", builtin.live_grep, opts)
|
||||
vim.keymap.set("n", "<leader>flg", builtin.live_grep, opts)
|
||||
|
||||
opts.desc = "telescope live grep args"
|
||||
local function start_live_grep_args()
|
||||
telescope.extensions.live_grep_args.live_grep_args()
|
||||
end
|
||||
vim.keymap.set("n", "<leader>fg", start_live_grep_args, opts)
|
||||
|
||||
opts.desc = "telescope buffers"
|
||||
vim.keymap.set("n", "<leader>fb", builtin.buffers, opts)
|
||||
@@ -57,8 +81,17 @@ return {
|
||||
|
||||
-- Old Files
|
||||
opts.desc = "Show recent files"
|
||||
vim.keymap.set("n", "<leader>fof", ":Telescope oldfiles<CR>", opts)
|
||||
vim.keymap.set("n", "<leader>fr", ":Telescope oldfiles<CR>", opts)
|
||||
vim.keymap.set("n", "<leader>fof", builtin.oldfiles, opts)
|
||||
|
||||
-- Frecency (Old files, but better)
|
||||
local function run_frecency()
|
||||
require("telescope").extensions.frecency.frecency({
|
||||
workspace = "CWD",
|
||||
})
|
||||
end
|
||||
|
||||
opts.desc = "Show recent files (Frecency algorithm)"
|
||||
vim.keymap.set("n", "<leader>fr", run_frecency, opts)
|
||||
|
||||
-- Quickfix Items
|
||||
opts.desc = "Show quickfix items"
|
@@ -58,52 +58,7 @@ return {
|
||||
{ text = "", texthl = "DapStopped", linehl = "DapStopped", numhl = "DapStopped" }
|
||||
)
|
||||
|
||||
dap.configurations.python = {
|
||||
{
|
||||
type = "python",
|
||||
request = "launch",
|
||||
name = "Launch file",
|
||||
|
||||
-- Options below are for debugpy, see https://github.com/microsoft/debugpy/wiki/Debug-configuration-settings for supported options
|
||||
|
||||
program = "${file}", -- This configuration will launch the current file if used.
|
||||
pythonPath = function()
|
||||
local cwd = vim.fn.getcwd()
|
||||
if vim.fn.executable(cwd .. "/venv/bin/python") == 1 then
|
||||
return cwd .. "/venv/bin/python"
|
||||
elseif vim.fn.executable(cwd .. "/.venv/bin/python") == 1 then
|
||||
return cwd .. "/.venv/bin/python"
|
||||
else
|
||||
return "/usr/bin/python"
|
||||
end
|
||||
end,
|
||||
},
|
||||
}
|
||||
|
||||
dap.adapters.python = function(cb, config)
|
||||
if config.request == "attach" then
|
||||
---@diagnostic disable-next-line: undefined-field
|
||||
local port = (config.connect or config).port
|
||||
---@diagnostic disable-next-line: undefined-field
|
||||
local host = (config.connect or config).host or "127.0.0.1"
|
||||
cb({
|
||||
type = "server",
|
||||
port = assert(port, "`connect.port` is required for a python `attach` configuration"),
|
||||
host = host,
|
||||
options = {
|
||||
source_filetype = "python",
|
||||
},
|
||||
})
|
||||
else
|
||||
cb({
|
||||
type = "executable",
|
||||
command = vim.fn.stdpath("data") .. "/mason/packages/debugpy/venv/bin/python",
|
||||
args = { "-m", "debugpy.adapter" },
|
||||
options = {
|
||||
source_filetype = "python",
|
||||
},
|
||||
})
|
||||
end
|
||||
end
|
||||
require("plugins.testing.debuggers.python")
|
||||
require("plugins.testing.debuggers.gdb")
|
||||
end,
|
||||
}
|
||||
|
46
nvim/lua/plugins/testing/debuggers/gdb.lua
Normal file
46
nvim/lua/plugins/testing/debuggers/gdb.lua
Normal file
@@ -0,0 +1,46 @@
|
||||
local dap = require("dap")
|
||||
dap.adapters.gdb = {
|
||||
type = "executable",
|
||||
command = "gdb",
|
||||
args = { "--interpreter=dap", "--eval-command", "set print pretty on" },
|
||||
}
|
||||
|
||||
dap.configurations.c = {
|
||||
{
|
||||
name = "Launch",
|
||||
type = "gdb",
|
||||
request = "launch",
|
||||
program = function()
|
||||
return vim.fn.input("Path to executable: ", vim.fn.getcwd() .. "/", "file")
|
||||
end,
|
||||
args = {}, -- provide arguments if needed
|
||||
cwd = "${workspaceFolder}",
|
||||
stopAtBeginningOfMainSubprogram = false,
|
||||
},
|
||||
{
|
||||
name = "Select and attach to process",
|
||||
type = "gdb",
|
||||
request = "attach",
|
||||
program = function()
|
||||
return vim.fn.input("Path to executable: ", vim.fn.getcwd() .. "/", "file")
|
||||
end,
|
||||
pid = function()
|
||||
local name = vim.fn.input("Executable name (filter): ")
|
||||
return require("dap.utils").pick_process({ filter = name })
|
||||
end,
|
||||
cwd = "${workspaceFolder}",
|
||||
},
|
||||
{
|
||||
name = "Attach to gdbserver :1234",
|
||||
type = "gdb",
|
||||
request = "attach",
|
||||
target = "localhost:1234",
|
||||
program = function()
|
||||
return vim.fn.input("Path to executable: ", vim.fn.getcwd() .. "/", "file")
|
||||
end,
|
||||
cwd = "${workspaceFolder}",
|
||||
},
|
||||
}
|
||||
|
||||
dap.configurations.cpp = dap.configurations.c
|
||||
dap.configurations.rust = dap.configurations.c
|
48
nvim/lua/plugins/testing/debuggers/python.lua
Normal file
48
nvim/lua/plugins/testing/debuggers/python.lua
Normal file
@@ -0,0 +1,48 @@
|
||||
local dap = require("dap")
|
||||
dap.configurations.python = {
|
||||
{
|
||||
type = "python",
|
||||
request = "launch",
|
||||
name = "Launch file",
|
||||
|
||||
-- Options below are for debugpy, see https://github.com/microsoft/debugpy/wiki/Debug-configuration-settings for supported options
|
||||
|
||||
program = "${file}", -- This configuration will launch the current file if used.
|
||||
pythonPath = function()
|
||||
local cwd = vim.fn.getcwd()
|
||||
if vim.fn.executable(cwd .. "/venv/bin/python") == 1 then
|
||||
return cwd .. "/venv/bin/python"
|
||||
elseif vim.fn.executable(cwd .. "/.venv/bin/python") == 1 then
|
||||
return cwd .. "/.venv/bin/python"
|
||||
else
|
||||
return "/usr/bin/python"
|
||||
end
|
||||
end,
|
||||
},
|
||||
}
|
||||
|
||||
dap.adapters.python = function(cb, config)
|
||||
if config.request == "attach" then
|
||||
---@diagnostic disable-next-line: undefined-field
|
||||
local port = (config.connect or config).port
|
||||
---@diagnostic disable-next-line: undefined-field
|
||||
local host = (config.connect or config).host or "127.0.0.1"
|
||||
cb({
|
||||
type = "server",
|
||||
port = assert(port, "`connect.port` is required for a python `attach` configuration"),
|
||||
host = host,
|
||||
options = {
|
||||
source_filetype = "python",
|
||||
},
|
||||
})
|
||||
else
|
||||
cb({
|
||||
type = "executable",
|
||||
command = vim.fn.stdpath("data") .. "/mason/packages/debugpy/venv/bin/python",
|
||||
args = { "-m", "debugpy.adapter" },
|
||||
options = {
|
||||
source_filetype = "python",
|
||||
},
|
||||
})
|
||||
end
|
||||
end
|
@@ -53,6 +53,15 @@
|
||||
},
|
||||
"Important Remarks": {
|
||||
"prefix": "remarks",
|
||||
"body": [
|
||||
"\\begin{remark}[]{$1}",
|
||||
"\t$2",
|
||||
"\\end{remark}"
|
||||
],
|
||||
"description": "Inserts a tcolorbox to provide remarks (green), but here numbered"
|
||||
},
|
||||
"Remark (numbered)": {
|
||||
"prefix": "remark",
|
||||
"body": [
|
||||
"\\begin{remarks}[]{$1}",
|
||||
"\t$2",
|
||||
@@ -87,6 +96,15 @@
|
||||
],
|
||||
"description": "Inserts a tcolorbox to inform about restrictions"
|
||||
},
|
||||
"Intuition": {
|
||||
"prefix": "restrictions",
|
||||
"body": [
|
||||
"\\begin{intuition}[]{$1}",
|
||||
"\t$2",
|
||||
"\\end{intuition}"
|
||||
],
|
||||
"description": "Tcolorbox to highlight sections about intuition"
|
||||
},
|
||||
"Limitations": {
|
||||
"prefix": "limitations",
|
||||
"body": [
|
||||
|
Reference in New Issue
Block a user