Update 03.09.2023

Changed file structure (again);
Added some plugings
and more
This commit is contained in:
Kristofers Solo
2023-09-03 18:07:40 +03:00
parent 39d3cbc3cf
commit f1b78f5303
47 changed files with 976 additions and 2744 deletions

View File

@@ -0,0 +1,35 @@
if not pcall(require, "cheatsheet") then
return
end
local ctactions = require("cheatsheet.telescope.actions")
require("cheatsheet").setup({
-- Whether to show bundled cheatsheets
-- For generic cheatsheets like default, unicode, nerd-fonts, etc
bundled_cheatsheets = {
enabled = { "default", "unicode", "regex", "markdown", "lua" },
disabled = { "nerd-fonts" },
},
-- bundled_cheatsheets = true,
-- For plugin specific cheatsheets
bundled_plugin_cheatsheets = {
enabled = {},
disabled = {},
},
-- bundled_plugin_cheatsheets = true,
-- For bundled plugin cheatsheets, do not show a sheet if you
-- don't have the plugin installed (searches runtimepath for
-- same directory name)
include_only_installed_plugins = true,
-- Key mappings bound inside the telescope window
telescope_mappings = {
["<CR>"] = require("cheatsheet.telescope.actions").select_or_fill_commandline,
["<A-CR>"] = require("cheatsheet.telescope.actions").select_or_execute,
["<C-Y>"] = require("cheatsheet.telescope.actions").copy_cheat_value,
["<C-E>"] = require("cheatsheet.telescope.actions").edit_user_cheatsheet,
},
})

View File

@@ -3,18 +3,66 @@ if not pcall(require, "cmake-tools") then
end
require("cmake-tools").setup({
cmake_command = "cmake",
cmake_build_directory = "target/build/",
cmake_build_directory_prefix = "cmake_build_", -- when cmake_build_directory is "", this option will be activated
cmake_generate_options = { "-D", "CMAKE_EXPORT_COMPILE_COMMANDS=1" },
cmake_soft_link_compile_commands = true, -- if softlink compile commands json file
cmake_build_options = {},
cmake_console_size = 15, -- cmake output window height
cmake_console_position = "belowright", -- "belowright", "aboveleft", ...
cmake_show_console = "always", -- "always", "only_on_error"
cmake_dap_configuration = { name = "cpp", type = "codelldb", request = "launch" }, -- dap configuration, optional
cmake_command = "cmake", -- this is used to specify cmake command path
cmake_regenerate_on_save = true, -- auto generate when save CMakeLists.txt
cmake_generate_options = { "-DCMAKE_EXPORT_COMPILE_COMMANDS=1" }, -- this will be passed when invoke `CMakeGenerate`
cmake_build_options = {}, -- this will be passed when invoke `CMakeBuild`
cmake_build_directory = "target/build/", -- this is used to specify generate directory for cmake
cmake_build_directory_prefix = "cmake_build_", -- when cmake_build_directory is set to "", this option will be activated
cmake_soft_link_compile_commands = true, -- this will automatically make a soft link from compile commands file to project root dir
cmake_compile_commands_from_lsp = false, -- this will automatically set compile commands file location using lsp, to use it, please set `cmake_soft_link_compile_commands` to false
cmake_kits_path = nil, -- this is used to specify global cmake kits path, see CMakeKits for detailed usage
cmake_variants_message = {
short = { show = true },
long = { show = true, max_length = 40 },
short = { show = true }, -- whether to show short message
long = { show = true, max_length = 40 }, -- whether to show long message
},
cmake_dap_configuration = { -- debug settings for cmake
name = "cpp",
type = "codelldb",
request = "launch",
stopOnEntry = false,
runInTerminal = true,
console = "integratedTerminal",
},
cmake_executor = { -- executor to use
name = "quickfix", -- name of the executor
opts = {}, -- the options the executor will get, possible values depend on the executor type. See `default_opts` for possible values.
default_opts = { -- a list of default and possible values for executors
quickfix = {
show = "only_on_error", -- "always", "only_on_error"
position = "belowright", -- "bottom", "top"
size = 15,
},
overseer = {
new_task_opts = {}, -- options to pass into the `overseer.new_task` command
on_new_task = function(task) end, -- a function that gets overseer.Task when it is created, before calling `task:start`
},
terminal = {}, -- terminal executor uses the values in cmake_terminal
},
},
cmake_terminal = {
name = "terminal",
opts = {
name = "Main Terminal",
prefix_name = "[CMakeTools]: ", -- This must be included and must be unique, otherwise the terminals will not work. Do not use a simple spacebar " ", or any generic name
split_direction = "vertical", -- "horizontal", "vertical"
split_size = 50,
-- Window handling
single_terminal_per_instance = true, -- Single viewport, multiple windows
single_terminal_per_tab = true, -- Single viewport per tab
keep_terminal_static_location = true, -- Static location of the viewport if avialable
-- Running Tasks
start_insert_in_launch_task = false, -- If you want to enter terminal with :startinsert upon using :CMakeRun
start_insert_in_other_tasks = false, -- If you want to enter terminal with :startinsert upon launching all other cmake tasks in the terminal. Generally set as false
focus_on_main_terminal = false, -- Focus on cmake terminal when cmake task is launched. Only used if executor is terminal.
focus_on_launch_terminal = false, -- Focus on cmake launch terminal when executable target in launched.
},
},
cmake_notifications = {
enabled = true, -- show cmake execution progress in nvim-notify
spinner = { "", "", "", "", "", "", "", "", "", "" }, -- icons used for progress display
refresh_rate_ms = 100, -- how often to iterate icons
},
})

View File

@@ -37,8 +37,7 @@ lsp.on_attach(function(_, bufnr)
nmap("gr", require("telescope.builtin").lsp_references, "[G]oto [R]eferences")
nmap("gI", vim.lsp.buf.implementation, "[G]oto [I]mplementation")
nmap("K", vim.lsp.buf.hover, "Hover Documentation")
nmap("<C-k>", vim.lsp.buf.signature_help, "Signature Documentation")
nmap("<C-K>", vim.lsp.buf.signature_help, "Signature Documentation")
nmap("gD", vim.lsp.buf.declaration, "[G]oto [D]eclaration")
end)
@@ -119,6 +118,9 @@ lsp.configure("texlab", {
},
})
if not pcall(require, "neodev") then
return
end
require("neodev").setup()
require("lspconfig").lua_ls.setup(lsp.nvim_lua_ls({
settings = {
@@ -158,6 +160,9 @@ require("lspconfig").lua_ls.setup(lsp.nvim_lua_ls({
lsp.setup()
if not pcall(require, "null-ls") then
return
end
local null_ls = require("null-ls")
-- https://github.com/jose-elias-alvarez/null-ls.nvim/tree/main/lua/null-ls/builtins/diagnostics
local formatting = null_ls.builtins.formatting
@@ -213,6 +218,7 @@ require("mason-null-ls").setup({
"usort",
"yamlfmt",
"rustywind",
"letexindent",
},
automatic_installation = true,
handlers = {

View File

@@ -73,126 +73,3 @@ ls.config.set_config({
},
},
})
local get_year = function()
return os.date("%Y")
end
local get_date = function()
return os.date("%d.%m.%Y")
end
local same = function(index)
return f(function(arg)
return arg[1]
end, { index })
end
ls.add_snippets(nil, {
all = {},
rust = {
s(
"modtest",
fmt(
[[
#[cfg(test)]
mod tests {{
{}
{}
}}
]],
{
c(1, { t(" use super::*;"), t("") }),
i(0),
}
)
),
},
python = {},
cpp = {
s(
"auth",
fmt(
[[
// Copyright {}
// Author - Kristiāns Francis Cagulis, kc22015
// {}
// Created: {}
]],
{
get_year(),
i(1),
get_date(),
}
)
),
s(
"fn",
fmt(
[[
// {};
// Funkcija {}({}) -
// {}
{} {{
}}
]],
{
same(1),
f(function(function_name)
if not function_name[1][1] then
function_name[1][1] = ""
end
local words = {}
for word in function_name[1][1]:gmatch("%w+") do
table.insert(words, word)
end
return words[2] or ""
end, { 1 }),
i(2),
i(0),
i(1),
}
)
),
s(
"templ",
fmt(
[[
template <class {}>
{}({}){{
{}
}}
]],
{
c(1, { t("T"), t("T1, class T2") }),
i(2),
i(3),
i(0),
}
)
),
},
norg = {
s(
"meta",
fmt(
[[
@document.meta
title: {}
author: {}
categories: {}
@end
]],
{
i(1),
c(2, {
t("Kristofers Solo"),
t("Kristiāns Francis Cagulis, kc22015"),
t("Kristiāns Francis Cagulis"),
}),
i(0),
}
)
),
},
})

135
after/plugin/oil.lua Normal file
View File

@@ -0,0 +1,135 @@
if not pcall(require, "oil") then
return
end
local nmap = require("solo.mappings").nmap
nmap("-", vim.cmd.Oil, "Open parent directory")
require("oil").setup({
-- Oil will take over directory buffers (e.g. `vim .` or `:e src/`)
-- Set to false if you still want to use netrw.
default_file_explorer = true,
-- Id is automatically added at the beginning, and name at the end
-- See :help oil-columns
columns = {
"icon",
-- "permissions",
"size",
-- "mtime",
},
-- Buffer-local options to use for oil buffers
buf_options = {
buflisted = false,
bufhidden = "hide",
},
-- Window-local options to use for oil buffers
win_options = {
wrap = false,
signcolumn = "no",
cursorcolumn = false,
foldcolumn = "0",
spell = false,
list = false,
conceallevel = 3,
concealcursor = "n",
},
-- Restore window options to previous values when leaving an oil buffer
restore_win_options = true,
-- Skip the confirmation popup for simple operations
skip_confirm_for_simple_edits = false,
-- Deleted files will be removed with the trash_command (below).
delete_to_trash = true,
-- Change this to customize the command used when deleting to trash
trash_command = "trash-put",
-- Selecting a new/moved/renamed file or directory will prompt you to save changes first
prompt_save_on_select_new_entry = true,
-- Keymaps in oil buffer. Can be any value that `vim.keymap.set` accepts OR a table of keymap
-- options with a `callback` (e.g. { callback = function() ... end, desc = "", nowait = true })
-- Additionally, if it is a string that matches "actions.<name>",
-- it will use the mapping at require("oil.actions").<name>
-- Set to `false` to remove a keymap
-- See :help oil-actions for a list of all available actions
keymaps = {
["g?"] = "actions.show_help",
["<CR>"] = "actions.select",
["<leader>v"] = "actions.select_vsplit",
["<leader>h"] = "actions.select_split",
["<leader>t"] = "actions.select_tab",
["<leader>p"] = "actions.preview",
["<C-c>"] = "actions.close",
["<C-r>"] = "actions.refresh",
["Y"] = "actions.copy_entry_path",
["-"] = "actions.parent",
["_"] = "actions.open_cwd",
["`"] = "actions.cd",
["~"] = "actions.tcd",
["."] = "actions.toggle_hidden",
},
-- Set to false to disable all of the above keymaps
use_default_keymaps = false,
view_options = {
-- Show files and directories that start with "."
show_hidden = true,
-- This function defines what is considered a "hidden" file
is_hidden_file = function(name, bufnr)
return vim.startswith(name, ".")
end,
-- This function defines what will never be shown, even when `show_hidden` is set
is_always_hidden = function(name, bufnr)
return false
end,
},
-- Configuration for the floating window in oil.open_float
float = {
-- Padding around the floating window
padding = 2,
max_width = 0,
max_height = 0,
border = "rounded",
win_options = {
winblend = 10,
},
-- This is the config that will be passed to nvim_open_win.
-- Change values here to customize the layout
override = function(conf)
return conf
end,
},
-- Configuration for the actions floating preview window
preview = {
-- Width dimensions can be integers or a float between 0 and 1 (e.g. 0.4 for 40%)
-- min_width and max_width can be a single value or a list of mixed integer/float types.
-- max_width = {100, 0.8} means "the lesser of 100 columns or 80% of total"
max_width = 0.9,
-- min_width = {40, 0.4} means "the greater of 40 columns or 40% of total"
min_width = { 40, 0.4 },
-- optionally define an integer/float for the exact width of the preview window
width = nil,
-- Height dimensions can be integers or a float between 0 and 1 (e.g. 0.4 for 40%)
-- min_height and max_height can be a single value or a list of mixed integer/float types.
-- max_height = {80, 0.9} means "the lesser of 80 columns or 90% of total"
max_height = 0.9,
-- min_height = {5, 0.1} means "the greater of 5 columns or 10% of total"
min_height = { 5, 0.1 },
-- optionally define an integer/float for the exact height of the preview window
height = nil,
border = "rounded",
win_options = {
winblend = 0,
},
},
-- Configuration for the floating progress window
progress = {
max_width = 0.9,
min_width = { 40, 0.4 },
width = nil,
max_height = { 10, 0.9 },
min_height = { 5, 0.1 },
height = nil,
border = "rounded",
minimized_border = "none",
win_options = {
winblend = 0,
},
},
})

View File

@@ -1,12 +0,0 @@
if not pcall(require, "project_nvim") then
return
end
require("project_nvim").setup({
detection_methods = { "lsp", "pattern" }, -- NOTE: lsp detection will get annoying with multiple langs in one project
-- detection_methods = { "pattern" },
-- patterns used to detect root dir, when **"pattern"** is in detection_methods
patterns = { ".git", "package.json", ".venv", "Cargo.toml", "requirements.txt", "CMakeLists.txt" },
})
local telescope = require("telescope")
telescope.load_extension("projects")

50
after/plugin/runner.lua Normal file
View File

@@ -0,0 +1,50 @@
if not pcall(require, "runner") then
return
end
local runner = require("runner")
local choice = require("runner.handlers.helpers").choice
local helpers = require("runner.handlers.helpers")
runner.setup({
position = "right", -- position of the terminal window when using the shell_handler
-- can be: top, left, right, bottom
-- will be overwritten when using the telescope mapping to open horizontally or vertically
width = 50, -- width of window when position is left or right
height = 10, -- height of window when position is top or bottom
})
runner.set_handler(
"cpp",
choice({
Cmake = function()
-- vim.cmd.CMakeBuild()
vim.cmd.CMakeRun()
end,
Makefile = helpers.shell_handler("make"),
["g++"] = helpers.shell_handler(
"g++ " .. vim.fn.expand("%") .. " -o " .. vim.fn.expand("%:r") .. " && " .. vim.fn.expand("%:r")
),
Custom = helpers.shell_handler("", true),
})
)
runner.set_handler(
"c",
choice({
Cmake = vim.cmd.CMakeRun,
Makefile = helpers.shell_handler("make"),
["gcc"] = helpers.shell_handler(
"gcc " .. vim.fn.expand("%") .. " -o " .. vim.fn.expand("%:r") .. " && " .. vim.fn.expand("%:r")
),
Custom = helpers.shell_handler("", true),
})
)
-- runner.set_handler(
-- "python",
-- choice({
-- Python = helpers.shell_handler("python " .. vim.fn.expand("%:t")),
-- Custom = helpers.shell_handler("", true),
-- })
-- )

View File

@@ -0,0 +1,53 @@
if not pcall(require, "luasnip") then
return
end
local ls = require("luasnip")
local s = ls.snippet
local i = ls.insert_node
local fmt = require("luasnip.extras.fmt").fmt
local shared = require("solo.snips")
local same = shared.same
local cmake_version = function()
local version = "3.27.4"
-- vim.fn.jobstart("cmake --version | head -n 1 | rg -o '\\d+\\.\\d+\\.\\d+'", {})
return version
end
ls.add_snippets("cmake", {
s(
"lib",
fmt(
[[
cmake_minimum_required(VERSION {})
project({})
add_library(${{PROJECT_NAME}} src/{}.cc)
]],
{
cmake_version(),
i(1),
same(1),
}
)
),
s(
"bin",
fmt(
[[
cmake_minimum_required(VERSION {})
project({})
add_executable(${{PROJECT_NAME}} src/main.cc)
target_link_directories(${{PROJECT_NAME}} PRIVATE ${{CMAKE_SOURCE_DIR}}/include/{}/target/build/)
target_link_libraries(${{PROJECT_NAME}} {})
]],
{
cmake_version(),
i(1),
i(2),
same(2),
}
)
),
})

View File

@@ -0,0 +1,61 @@
if not pcall(require, "luasnip") then
return
end
local ls = require("luasnip")
local s = ls.snippet
local i = ls.insert_node
local f = ls.function_node
local fmt = require("luasnip.extras.fmt").fmt
local shared = require("solo.snips")
local same = shared.same
local year = shared.year
local date = shared.date
ls.add_snippets("cpp", {
s(
"auth",
fmt(
[[
// Copyright {}
// Author - Kristiāns Francis Cagulis, kc22015
// {}
// Created: {}
]],
{
year(),
i(1),
date(),
}
)
),
s(
"fn",
fmt(
[[
// {};
// Funkcija {}({}) -
// {}
{} {{
}}
]],
{
same(1),
f(function(function_name)
if not function_name[1][1] then
function_name[1][1] = ""
end
local words = {}
for word in function_name[1][1]:gmatch("%w+") do
table.insert(words, word)
end
return words[2] or ""
end, { 1 }),
i(2),
i(0),
i(1),
}
)
),
})

View File

@@ -0,0 +1,79 @@
if not pcall(require, "luasnip") then
return
end
local ls = require("luasnip")
local s = ls.snippet
local sn = ls.sn
local i = ls.insert_node
local t = ls.text_node
local d = ls.dynamic_node
local c = ls.choice_node
local fmt = require("luasnip.extras.fmt").fmt
local shared = require("solo.snips")
local newline = function(text)
return t({ "", text })
end
local require_var = function(args, _)
local text = args[1][1] or ""
local split = vim.split(text, ".", { plain = true })
local options = {}
for len = 0, #split - 1 do
table.insert(options, t(table.concat(vim.list_slice(split, #split - len, #split), "_")))
end
return sn(nil, {
c(1, options),
})
end
ls.add_snippets("lua", {
s(
"lf",
fmt(
[[
local {} = function({})
{}
end
]],
{
i(1),
i(2),
i(0),
}
)
),
s(
"f",
fmt(
[[
function({})
{}
end
]],
{
i(1),
i(0),
}
)
),
s(
"req",
fmt([[ local {} = require("{}") ]], {
d(2, require_var, { 1 }),
i(1),
})
),
s(
"treq",
fmt([[ local {} = require("telescope.{}") ]], {
d(2, require_var, { 1 }),
i(1),
})
),
})

View File

@@ -0,0 +1,21 @@
if not pcall(require, "luasnip") then
return
end
local ls = require("luasnip")
local s = ls.snippet
local i = ls.insert_node
local t = ls.text_node
local c = ls.choice_node
local fmt = require("luasnip.extras.fmt").fmt
ls.add_snippets({ "markdown", "vimwiki" }, {
s(
"t",
fmt("- [{}] {}", {
c(2, { t(" "), t("-"), t("x") }),
i(1, "task"),
})
),
})

View File

@@ -0,0 +1,34 @@
if not pcall(require, "luasnip") then
return
end
local ls = require("luasnip")
local s = ls.snippet
local t = ls.text_node
local i = ls.insert_node
local c = ls.choice_node
local fmt = require("luasnip.extras.fmt").fmt
ls.add_snippets("norg", {
s(
"meta",
fmt(
[[
@document.meta
title: {}
author: {}
categories: {}
@end
]],
{
i(1),
c(2, {
t("Kristofers Solo"),
t("Kristiāns Francis Cagulis, kc22015"),
t("Kristiāns Francis Cagulis"),
}),
i(0),
}
)
),
})

View File

@@ -0,0 +1,51 @@
if not pcall(require, "luasnip") then
return
end
local ls = require("luasnip")
local s = ls.snippet
local sn = ls.snippet_node
local isn = ls.indent_snippet_node
local t = ls.text_node
local i = ls.insert_node
local f = ls.function_node
local c = ls.choice_node
local d = ls.dynamic_node
local r = ls.restore_node
local events = require("luasnip.util.events")
local ai = require("luasnip.nodes.absolute_indexer")
local extras = require("luasnip.extras")
local l = extras.lambda
local rep = extras.rep
local p = extras.partial
local m = extras.match
local n = extras.nonempty
local dl = extras.dynamic_lambda
local fmt = require("luasnip.extras.fmt").fmt
local fmta = require("luasnip.extras.fmt").fmta
local conds = require("luasnip.extras.expand_conditions")
local postfix = require("luasnip.extras.postfix").postfix
local types = require("luasnip.util.types")
local parse = require("luasnip.util.parser").parse_snippet
local ms = ls.multi_snippet
local shared = require("solo.snips")
ls.add_snippets("rust", {
s(
"modtest",
fmt(
[[
#[cfg(test)]
mod tests {{
{}
{}
}}
]],
{
c(1, { t(" use super::*;"), t("") }),
i(0),
}
)
),
})

View File

@@ -2,12 +2,11 @@ if not pcall(require, "telescope") then
return
end
local builtin = require("telescope.builtin")
vim.keymap.set("n", "<C-p>", builtin.git_files, {})
vim.keymap.set("n", "<C-p>", require("telescope.builtin").git_files, {})
local telescope = require("telescope")
local actions = require("telescope.actions")
telescope.setup({
defaults = {
vimgrep_arguments = {
@@ -23,13 +22,15 @@ telescope.setup({
prompt_prefix = "",
selection_caret = "",
path_display = { "smart" },
file_ignore_patterns = { ".git/", "node_modules", ".venv/" },
file_ignore_patterns = { ".git/", ".spl", "target/" },
mappings = {
i = {
["<Down>"] = actions.cycle_history_next,
["<Up>"] = actions.cycle_history_prev,
["<C-j>"] = actions.move_selection_next,
["<C-k>"] = actions.move_selection_previous,
["<C-D>"] = actions.delete_buffer + actions.move_to_top,
-- ["<C-Y>"] = actions.remove_selection
},
},
},
@@ -82,13 +83,95 @@ telescope.setup({
-- codeactions = false,
-- }
},
lazy = {
-- Optional theme (the extension doesn't set a default theme)
theme = "dropdown",
previewer = false,
-- Whether or not to show the icon in the first column
show_icon = true,
-- Mappings for the actions
mappings = {
open_in_browser = "<C-o>",
open_in_file_browser = "<M-b>",
open_in_find_files = "<C-f>",
open_in_live_grep = "<C-g>",
open_plugins_picker = "<C-b>", -- Works only after having called first another action
open_lazy_root_find_files = "<C-r>f",
open_lazy_root_live_grep = "<C-r>g",
},
-- Other telescope configuration options
},
http = {
-- How the mozilla url is opened. By default will be configured based on OS:
open_url = "xdg-open %s", -- UNIX
-- open_url = 'open %s' -- OSX
-- open_url = 'start %s' -- Windows
},
heading = {
treesitter = true,
picker_opts = {
layout_config = { width = 0.8, preview_width = 0.5 },
layout_strategy = "horizontal",
},
},
bibtex = {
-- Depth for the *.bib file
depth = 1,
-- Custom format for citation label
custom_formats = {},
-- Format to use for citation label.
-- Try to match the filetype by default, or use 'plain'
format = "",
-- Path to global bibliographies (placed outside of the project)
global_files = {},
-- Define the search keys to use in the picker
search_keys = { "author", "year", "title" },
-- Template for the formatted citation
citation_format = "{{author}} ({{year}}), {{title}}.",
-- Only use initials for the authors first name
citation_trim_firstname = true,
-- Max number of authors to write in the formatted citation
-- following authors will be replaced by "et al."
citation_max_auth = 2,
-- Context awareness disabled by default
context = false,
-- Fallback to global/directory .bib files if context not found
-- This setting has no effect if context = false
context_fallback = true,
-- Wrapping in the preview window is disabled by default
wrap = false,
},
undo = {
use_delta = true,
use_custom_command = nil, -- setting this implies `use_delta = false`. Accepted format is: { "bash", "-c", "echo '$DIFF' | delta" }
side_by_side = false,
diff_context_lines = vim.o.scrolloff,
entry_format = "state #$ID, $STAT, $TIME",
time_format = "",
mappings = {
i = {
-- IMPORTANT: Note that telescope-undo must be available when telescope is configured if
-- you want to replicate these defaults and use the following actions. This means
-- installing as a dependency of telescope in it's `requirements` and loading this
-- extension from there instead of having the separate plugin definition as outlined
-- above.
["<cr>"] = require("telescope-undo.actions").yank_additions,
["<S-cr>"] = require("telescope-undo.actions").yank_deletions,
["<C-cr>"] = require("telescope-undo.actions").restore,
},
},
},
},
})
pcall(telescope.load_extension, "fzf")
pcall(telescope.load_extension, "media_files")
pcall(telescope.load_extension, "emoji")
pcall(telescope.load_extension, "ui-select")
pcall(telescope.load_extension, "color_names")
pcall(telescope.load_extension, "git_worktree")
pcall(telescope.load_extension, "lazygit")
pcall(telescope.load_extension, "dap")
pcall(telescope.load_extension, "media_files") -- Telescope media_files
pcall(telescope.load_extension, "git_worktree") -- Telescope git_worktree
pcall(telescope.load_extension, "lazy") -- Telescope lazy
pcall(telescope.load_extension, "software-licenses") -- Telescope software-licenses list
pcall(telescope.load_extension, "http") -- Telescope http list
pcall(telescope.load_extension, "heading") -- Telescope heading
pcall(telescope.load_extension, "luasnip") -- Telescope luasnip
pcall(telescope.load_extension, "git_diffs") -- Telescope git_diffs diff_commits
pcall(telescope.load_extension, "bibtex") -- Telescope bibtex
pcall(telescope.load_extension, "undo") -- Telescope undo

View File

@@ -1,14 +1,6 @@
if not pcall(require, "nvim-treesitter") then
return
end
vim.keymap.set("n", "[d", function()
vim.diagnostic.goto_next()
vim.cmd("norm zz")
end, { desc = "Goto next diagnostic" })
vim.keymap.set("n", "]d", function()
vim.diagnostic.goto_prev()
vim.cmd("norm zz")
end, { desc = "Goto prev diagnostic" })
require("nvim-treesitter.configs").setup({
-- A list of parser names, or "all" (the five listed parsers should always be installed)
@@ -46,24 +38,28 @@ require("nvim-treesitter.configs").setup({
},
autotag = {
enable = true,
enable_rename = true,
enable_close = true,
enable_close_on_slash = true,
filetypes = {
"html",
"htmldjango",
"javascript",
"typescript",
"javascriptreact",
"typescriptreact",
"svelte",
"vue",
"tsx",
"jsx",
"rescript",
"xml",
"php",
"markdown",
"astro",
"glimmer",
"handlebars",
"hbs",
"html",
"htmldjango",
"javascript",
"javascriptreact",
"jsx",
"markdown",
"php",
"rescript",
"svelte",
"tsx",
"typescript",
"typescriptreact",
"vue",
"xml",
},
},
-- incremenral_selection = {

View File

@@ -4,6 +4,7 @@ end
local which_key = require("which-key")
local builtin = require("telescope.builtin")
local extensions = require("telescope").extensions
local setup = {
plugins = {
marks = true, -- shows a list of your marks on " and `
@@ -94,9 +95,8 @@ local mappings = {
c = { vim.cmd.bdelete, "[C]lose Buffer" },
x = { "<cmd>!chmod +x %<cr>", "chmod & run" },
mr = { "<cmd>CellularAutomaton make_it_rain<cr>", "[M]ake it [R]ain" },
u = { vim.cmd.UndotreeToggle, "Toggle [U]ndoTree" },
b = { vim.cmd.TagbarToggle, "Toggle Tag[B]ar" },
e = { vim.cmd.Ex, "Open [E]xplorer" },
u = { vim.cmd.UndotreeToggle, "Toggle [U]ndotree" },
T = { vim.cmd.TagbarToggle, "Toggle [T]agbar" },
["/"] = {
function()
builtin.current_buffer_fuzzy_find(require("telescope.themes").get_dropdown({ previewer = false }))
@@ -104,54 +104,56 @@ local mappings = {
"Current Buffer Fuzzy",
},
f = {
name = "[F]ind",
f = {
function()
builtin.find_files(require("telescope.themes").get_dropdown({ previewer = false }))
end,
"[F]iles",
},
t = { builtin.live_grep, "[T]ext" },
b = { builtin.buffers, "[B]uffers" },
function()
builtin.find_files(require("telescope.themes").get_dropdown({ previewer = false }))
end,
"Find [F]iles",
},
h = {
name = "[H]arpoon",
a = { require("harpoon.mark").add_file, "[A]dd File" },
m = { require("harpoon.ui").toggle_quick_menu, "[M]enu" },
},
t = {
name = "[T]elescope",
F = { builtin.live_grep, "Live Grep" },
b = { builtin.buffers, "Find [B]uffers" },
ha = { require("harpoon.mark").add_file, "[H]arpoon [A]dd File" },
hm = { require("harpoon.ui").toggle_quick_menu, "[H]arpoon [M]enu" },
s = {
name = "Telescope [S]earch",
s = { builtin.grep_string, "[S]tring under the cursor" },
e = { builtin.symbols, "[E]moji" },
d = { builtin.diagnostic, "[D]iagnostics" },
b = { builtin.git_branches, "Checkout [B]ranch" },
h = { builtin.help_tags, "Find [H]elp" },
H = { builtin.highlights, "Find [H]ighlight Groups" },
h = { builtin.help_tags, "[H]elp" },
M = { builtin.man_pages, "[M]an Pages" },
r = { builtin.oldfiles, "Open [R]ecent Files" },
R = { builtin.registers, "[R]egisters" },
g = { builtin.live_grep, "Live [G]rep" },
g = { builtin.live_grep, "[G]rep" },
G = { builtin.git_files, "[G]it Files" },
k = { builtin.keymaps, "[K]eymaps" },
C = { builtin.commands, "[C]ommands" },
t = { vim.cmd.TodoTelescope, "[T]odo" },
m = { require("telescope").extensions.media_files.media_files, "[M]edia" },
m = { extensions.media_files.media_files, "[M]edia" },
c = {
function()
builtin.colorscheme({ enable_preview = true })
end,
"[C]olorscheme with Preview",
},
},
g = {
name = "[G]it",
g = { vim.cmd.LazyGit, "Lazygit" },
b = {
function()
vim.cmd.Gitsigns("blame_line")
end,
"[B]lame",
l = { extensions.lazy.lazy, "[L]azy" },
L = { extensions.luasnip.luasnip, "[L]uasnip" },
D = {
name = "[D]evelopment",
s = { "<cmd>Telescope software-licenses find<cr>", "[S]oftware Licenses" },
h = { extensions.http.list, "[H]TTP" },
},
c = { require("telescope").extensions.git_worktree.git_worktrees, "[C]hange Worktree" },
n = { require("telescope").extensions.git_worktree.create_git_worktree, "Create [N]ew Worktree" },
H = { extensions.heading.heading, "[H]eading" },
},
gg = { vim.cmd.LazyGit, "Lazygit" },
gb = {
function()
vim.cmd.Gitsigns("blame_line")
end,
"[G]it [B]lame",
},
gw = { require("telescope").extensions.git_worktree.git_worktrees, "[G]it Change [W]orktree" },
gn = { require("telescope").extensions.git_worktree.create_git_worktree, "[G]it Create [N]ew Worktree" },
gd = { require("telescope").extensions.git_diffs.diff_commits, "[G]it [D]iff" },
l = {
name = "[L]SP",
ca = { vim.lsp.buf.code_action, "[C]ode [A]ction" },
@@ -270,8 +272,8 @@ local mappings = {
d = { vim.cmd.VimwikiDeleteFile, "Rename file" },
r = { vim.cmd.VimwikiRenameFile, "Delete file" },
},
v = {
name = "[V]imTex",
t = {
name = "Vim[T]ex",
b = { vim.cmd.VimtexCompile, "[B]uild" },
v = { vim.cmd.VimtexView, "[V]iew" },
w = { vim.cmd.VimtexCountWords, "[W]ord Count" },
@@ -279,40 +281,63 @@ local mappings = {
c = { vim.cmd.VimtexClean, "[C]lean aux" },
e = { vim.cmd.VimtexErrors, "Report [E]rrors" },
i = { vim.cmd.VimtexInfo, "[I]nfo" },
B = { builtin.bibtex, "Telescope [B]ibtex" },
},
T = {
name = "[T]emplates",
p = {
"<cmd>read ~/.config/nvim/templates/PhilPaper.tex<cr>",
"PhilPaper.tex",
},
p = {
name = "Tem[p]lates",
l = {
"<cmd>read ~/.config/nvim/templates/Letter.tex<cr>",
"Letter.tex",
name = "[L]aTeX",
p = {
function()
vim.cmd.read("~/Templates/LaTeX/PhilPaper.tex")
end,
"PhilPaper.tex",
},
l = {
function()
vim.cmd.read("~/Templates/LaTeX/Letter.tex")
end,
"Letter.tex",
},
g = {
function()
vim.cmd.read("~/Templates/LaTeX/Glossary.tex")
end,
"Glossary.tex",
},
h = {
function()
vim.cmd.read("~/Templates/LaTeX/HandOut.tex")
end,
"HandOut.tex",
},
b = {
function()
vim.cmd.read("~/Templates/LaTeX/PhilBeamer.tex")
end,
"PhilBeamer.tex",
},
s = {
function()
vim.cmd.read("~/Templates/LaTeX/SubFile.tex")
end,
"SubFile.tex",
},
r = {
function()
vim.cmd.read("~/Templates/LaTeX/Root.tex")
end,
"Root.tex",
},
m = {
function()
vim.cmd.read("~/Templates/LaTeX/MultipleAnswer.tex")
end,
"MultipleAnswer.tex",
},
},
g = {
"<cmd>read ~/.config/nvim/templates/Glossary.tex<cr>",
"Glossary.tex",
},
h = {
"<cmd>read ~/.config/nvim/templates/HandOut.tex<cr>",
"HandOut.tex",
},
b = {
"<cmd>read ~/.config/nvim/templates/PhilBeamer.tex<cr>",
"PhilBeamer.tex",
},
s = {
"<cmd>read ~/.config/nvim/templates/SubFile.tex<cr>",
"SubFile.tex",
},
r = {
"<cmd>read ~/.config/nvim/templates/Root.tex<cr>",
"Root.tex",
},
m = {
"<cmd>read ~/.config/nvim/templates/MultipleAnswer.tex<cr>",
"MultipleAnswer.tex",
c = {
name = "[C]make",
},
},
}