Setup the directory structure to handle both mac and linux, and stowing with only one command, well two, one for the OS specific dir as well.

This commit is contained in:
Martin Larsson 2024-04-19 01:19:38 +02:00
parent 5759f6a798
commit bc87253453
65 changed files with 0 additions and 0 deletions

View file

@ -1,128 +0,0 @@
local g = vim.g
g.mapleader = " "
g.maplocalleader = " "
require("utils").add_keymaps({
n = {
-- Disable hjkl, using Colemak
["h"] = {
cmd = "<Nop>",
},
["j"] = {
cmd = "<Nop>",
},
["k"] = {
cmd = "<Nop>",
},
["l"] = {
cmd = "<Nop>",
},
-- Navigation
["<C-Left>"] = {
cmd = "<C-w>h",
},
["<C-Down>"] = {
cmd = "<C-w>j",
},
["<C-Up>"] = {
cmd = "<C-w>k",
},
["<C-Right>"] = {
cmd = "<C-w>l",
},
-- Window
["<leader>x"] = {
cmd = "<C-w>q",
},
-- Disable current highlights
["<Esc>"] = {
cmd = "<cmd> noh <CR>",
},
-- Save
["<C-s>"] = {
cmd = "<cmd> w <CR>",
},
-- Copies the entire file
["<C-c>"] = {
cmd = ":silent %y+<CR>",
},
-- Allow moving the cursor through wrapped lines with <Up> and <Down>
-- http://www.reddit.com/r/vim/comments/2k4cbr/problem_with_gj_and_gk/
-- empty mode is same as using <cmd> :map
-- also don't use g[j|k] when in operator pending mode, so it doesn't alter d, y or c behaviour
["<Up>"] = {
cmd = "v:count || mode(1)[0:1] == \"no\" ? \"k\" : \"gk\"",
opts = {
expr = true
}
},
["<Down>"] = {
cmd = "v:count || mode(1)[0:1] == \"no\" ? \"j\" : \"gj\"",
opts = {
expr = true
}
},
-- Maps to remove
["<C-z>"] = {
cmd = "<Nop>",
},
},
i = {},
v = {
["<Up>"] = {
cmd = "v:count || mode(1)[0:1] == \"no\" ? \"k\" : \"gk\"",
opts = {
expr = true
}
},
["<Down>"] = {
cmd = "v:count || mode(1)[0:1] == \"no\" ? \"j\" : \"gj\"",
opts = {
expr = true
}
},
["<tab>"] = {
cmd = ">gv",
},
["<S-tab>"] = {
cmd = "<gv",
},
},
x = {
["<Up>"] = {
cmd = "v:count || mode(1)[0:1] == \"no\" ? \"k\" : \"gk\"",
opts = {
expr = true
}
},
["<Down>"] = {
cmd = "v:count || mode(1)[0:1] == \"no\" ? \"j\" : \"gj\"",
opts = {
expr = true
}
},
["p"] = {
cmd = "p:let @+=@0<CR>:let @\"=@0<CR>",
opts = {
silent = true
},
},
},
t = {
["<C-x>"] = {
cmd = "<C-\\><C-N>",
},
["<Esc>"] = {
cmd = function()
local win = vim.api.nvim_get_current_win()
vim.api.nvim_win_close(win, true)
end,
}
},
})

View file

@ -1,44 +0,0 @@
local utils = require("lspconfig.util")
return {
default_config = {
cmd = { "bash-language-server", "start" },
settings = {
bashIde = {
-- Glob pattern for finding and parsing shell script files in the workspace.
-- Used by the background analysis features across files.
-- Prevent recursive scanning which will cause issues when opening a file
-- directly in the home directory (e.g. ~/foo.sh).
--
-- Default upstream pattern is "**/*@(.sh|.inc|.bash|.command)".
globPattern = vim.env.GLOB_PATTERN or "**/*@(.sh|.inc|.bash|.command|.zsh|zshrc|zsh_*)",
},
bash = {
format = {
enable = true,
shell = "shfmt",
args = {
"-i",
"4",
"-bn",
"-ci"
}
},
ignorePatterns = {
"node_modules",
".git"
},
lint = {
enable = true
},
trace = {
server = "verbose"
},
},
},
filetypes = { "sh", "zsh" },
root_dir = utils.find_git_ancestor,
single_file_support = true,
},
}

View file

@ -1,54 +0,0 @@
local function switch_between_header_and_source(bufnr)
local util = require("lspconfig/util")
bufnr = util.validate_bufnr(bufnr)
local clangd_client = util.get_active_client_by_name(bufnr, "clangd")
local params = { uri = vim.uri_from_bufnr(bufnr) }
-- invert this with an early return
if not clangd_client then
print "method textDocument/switchSourceHeader is not supported by any servers active on the current buffer"
return
end
clangd_client.request("textDocument/switchSourceHeader", params, function(err, result)
if err then
error(tostring(err))
end
if not result then
print("Corresponding file cannot be determined")
return
end
vim.api.nvim_command("drop " .. vim.uri_to_fname(result))
end, bufnr)
end
local M = {
cmd = {
"clangd",
"--background-index",
"--clang-tidy",
"--completion-style=bundled",
-- "--cross-file-rename", // This has been deprecated
"--rename-file-limit=0",
"--header-insertion=iwyu",
"--inlay-hints",
"--compile-commands-dir=build/",
},
commands = {
ClangdSwitchSourceHeader = {
function()
switch_between_header_and_source(0)
end,
description = "Switch between source/header",
},
},
}
function M.post_setup()
require("utils").add_keymaps({
n = {
["<leader>ko"] = { cmd = ":ClangdSwitchSourceHeader<CR>" }
},
})
end
return M

View file

@ -1,3 +0,0 @@
return {
}

View file

@ -1,30 +0,0 @@
return {
on_init = function(client)
local path = client.workspace_folders[1].name
if not vim.loop.fs_stat(path .. "/.luarc.json") and not vim.loop.fs_stat(path .. "/.luarc.jsonc") then
client.config.settings = vim.tbl_deep_extend("force", client.config.settings, {
Lua = {
runtime = {
-- Tell the language server which version of Lua you're using
-- (most likely LuaJIT in the case of Neovim)
version = "LuaJIT",
},
-- Make the server aware of Neovim runtime files
workspace = {
checkThirdParty = false,
library = {
vim.env.VIMRUNTIME,
-- "${3rd}/luv/library"
-- "${3rd}/busted/library",
},
-- or pull in all of 'runtimepath'. NOTE: this is a lot slower
-- library = vim.api.nvim_get_runtime_file("", true)
},
},
})
client.notify("workspace/didChangeConfiguration", { settings = client.config.settings })
end
return true
end
}

View file

@ -1 +0,0 @@
return {}

View file

@ -1,12 +0,0 @@
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
vim.fn.system({
"git",
"clone",
"--filter=blob:none",
"https://github.com/folke/lazy.nvim.git",
"--branch=stable", -- latest stable release
lazypath,
})
end
vim.opt.rtp:prepend(lazypath)

View file

@ -1,9 +0,0 @@
local M = {}
function M.get_breadcrumbs()
local breadcrumbs = require("lspsaga.symbol.winbar").get_bar()
-- Return breadcrumbs if the string exists and is not empty, otherwise, get the filename and return it
return breadcrumbs and breadcrumbs ~= "" and breadcrumbs or vim.fn.expand("%:t")
end
return M

View file

@ -1,25 +0,0 @@
return {
"otavioschwanck/arrow.nvim",
opts = {
show_icons = true,
leader_key = ",",
global_bookmarks = true,
custom_actions = {
open = function(filename, _)
vim.cmd(string.format(":drop %s", filename))
end,
},
mappings = {
edit = "e",
delete_mode = "d",
clear_all_items = "C",
toggle = "s",
open_vertical = "v",
open_horizontal = "h",
quit = "q",
remove = "x",
next_item = "n",
prev_item = "p",
}
}
}

View file

@ -1,19 +0,0 @@
return {
"rmagatti/auto-session",
config = function()
require("auto-session").setup {
log_level = "error",
auto_session_suppress_dirs = {
"/",
"~/",
"~/Projects",
"~/Downloads",
"~/Development",
"~/Dev",
"~/Dev/Git",
"~/.config",
"~/dev/git/.dotfiles",
},
}
end
}

View file

@ -1,5 +0,0 @@
return {
"windwp/nvim-autopairs",
event = "InsertEnter",
opts = {},
}

View file

@ -1,66 +0,0 @@
return {
"catppuccin/nvim",
name = "catppuccin",
priority = 1000,
config = function()
require("catppuccin").setup({
flavour = "macchiato",
background = {
light = "latte",
dark = "macchiato"
},
transparent_background = true,
term_colors = true,
sidebars = { "qf", "help" },
integrations = {
leap = true,
lsp_saga = true,
mason = true,
semantic_tokens = true,
treesitter_context = true,
telescope = {
enable = true,
-- style = "nvchad",
},
-- dap_ui = true,
-- dap = true,
-- Read catppuccin integration guide when installing dap, and dap_ui
-- sign("DapBreakpoint", { text = "●", texthl = "DapBreakpoint", linehl = "", numhl = ""})
-- sign("DapBreakpointCondition", { text = "●", texthl = "DapBreakpointCondition", linehl = "", numhl = ""})
-- sign("DapLogPoint", { text = "◆", texthl = "DapLogPoint", linehl = "", numhl = ""})
},
on_highlights = function(hl, c)
-- local prompt = "#2d3149"
-- hl.TelescopeNormal = {
-- bg = c.bg_dark,
-- fg = c.fg_dark,
-- }
-- hl.TelescopeBorder = {
-- bg = c.bg_dark,
-- fg = c.bg_dark,
-- }
-- hl.TelescopePromptNormal = {
-- bg = prompt,
-- }
-- hl.TelescopePromptBorder = {
-- bg = prompt,
-- fg = prompt,
-- }
-- hl.TelescopePromptTitle = {
-- bg = prompt,
-- fg = prompt,
-- }
-- hl.TelescopePreviewTitle = {
-- bg = c.bg_dark,
-- fg = c.bg_dark,
-- }
-- hl.TelescopeResultsTitle = {
-- bg = c.bg_dark,
-- fg = c.bg_dark,
-- }
end,
})
vim.cmd.colorscheme "catppuccin"
end
}

View file

@ -1,67 +0,0 @@
return {
"hrsh7th/nvim-cmp",
dependencies = {
"hrsh7th/cmp-nvim-lsp",
"hrsh7th/cmp-buffer",
"hrsh7th/cmp-path",
"hrsh7th/cmp-cmdline",
},
config = function()
-- Set up nvim-cmp.
local cmp = require("cmp")
cmp.setup({
snippet = {
expand = function(args)
vim.snippet.expand(args.body) -- For native neovim snippets (Neovim v0.10+)
end,
},
window = {
completion = cmp.config.window.bordered(),
documentation = cmp.config.window.bordered(),
},
mapping = cmp.mapping.preset.insert({
["<C-b>"] = cmp.mapping.scroll_docs(-4),
["<C-f>"] = cmp.mapping.scroll_docs(4),
["<C-Space>"] = cmp.mapping.complete(),
["<C-e>"] = cmp.mapping.abort(),
["<CR>"] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
}),
sources = cmp.config.sources({
{ name = "nvim_lsp" },
},
{
{ name = "buffer" },
})
})
-- Set configuration for specific filetype.
cmp.setup.filetype("gitcommit", {
sources = cmp.config.sources({
{ name = "git" }, -- You can specify the `git` source if [you were installed it](https://github.com/petertriho/cmp-git).
}, {
{ name = "buffer" },
})
})
-- Use buffer source for `/` and `?` (if you enabled `native_menu`, this won't work anymore).
cmp.setup.cmdline({ "/", "?" }, {
mapping = cmp.mapping.preset.cmdline(),
sources = {
{ name = "buffer" }
}
})
-- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore).
cmp.setup.cmdline(":", {
mapping = cmp.mapping.preset.cmdline(),
sources = cmp.config.sources({
{ name = "path" }
}, {
{ name = "cmdline" }
}),
matching = { disallow_symbol_nonprefix_matching = false }
})
end,
}

View file

@ -1,23 +0,0 @@
return {
"mistricky/codesnap.nvim",
build = "make",
config = function()
require("codesnap").setup({
mac_window_bar = true,
title = "codesnap.nvim",
code_font_family = "JetBrainsMono Nerd Font",
breadcrumbs_separator = "/",
has_breadcrumbs = true,
bg_theme = "grape",
watermark = "",
})
require("utils").add_keymaps({
v = {
["<leader>cs"] = {
cmd = ":CodeSnap<CR>"
},
}
})
end,
}

View file

@ -1,17 +0,0 @@
return {
"norcalli/nvim-colorizer.lua",
config = function()
require("colorizer").setup({
DEFAULT_OPTIONS = {
RGB = true,
RRGGBB = true,
names = false,
RRGGBBAA = true,
css = true,
css_fn = true,
mode = "background",
},
"*",
})
end,
}

View file

@ -1,9 +0,0 @@
return {
"numToStr/Comment.nvim",
opts = {
mappings = {
extra = false,
},
},
lazy = false,
}

View file

@ -1,3 +0,0 @@
return {
"github/copilot.vim",
}

View file

@ -1,3 +0,0 @@
return {
"nvim-tree/nvim-web-devicons",
}

View file

@ -1,79 +0,0 @@
return {
"b0o/incline.nvim",
dependencies = {
"lewis6991/gitsigns.nvim"
},
config = function()
require("gitsigns").setup({})
local devicons = require("nvim-web-devicons")
require("incline").setup({
window = {
padding = 0,
},
render = function(props)
local filename = vim.fn.fnamemodify(vim.api.nvim_buf_get_name(props.buf), ":t")
if filename == "" then
filename = "[No Name]"
end
local ft_icon, ft_color = devicons.get_icon_color(filename)
local function get_git_diff()
local icons = { removed = "", changed = "", added = "" }
local signs = vim.b[props.buf].gitsigns_status_dict
local labels = {}
if signs == nil then
return labels
end
for name, icon in pairs(icons) do
if tonumber(signs[name]) and signs[name] > 0 then
table.insert(labels, { icon .. signs[name] .. " ", group = "Diff" .. name })
end
end
if #labels > 0 then
table.insert(labels, { "" })
end
return labels
end
local function get_diagnostic_label()
local icons = { error = "", warn = "", info = "", hint = "" }
local label = {}
for severity, icon in pairs(icons) do
local n = #vim.diagnostic.get(props.buf,
{ severity = vim.diagnostic.severity[string.upper(severity)] })
if n > 0 then
table.insert(label, { icon .. n .. " ", group = "DiagnosticSign" .. severity })
end
end
if #label > 0 then
table.insert(label, { "" })
end
return label
end
local function get_arrow_label()
local statusline = require("arrow.statusline")
if statusline.is_on_arrow_file(props.buf) == nil then
return ""
end
return " " .. statusline.text_for_statusline_with_icons(props.buf)
end
return {
guibg = "#1e2030",
guifg = "#cad3f5",
{ " " },
{ get_diagnostic_label() },
{ get_git_diff() },
{ (ft_icon or "") .. " ", guifg = ft_color, guibg = "none" },
{ filename .. "", gui = vim.bo[props.buf].modified and "bold,italic" or "bold" },
{ get_arrow_label() .. "" .. vim.api.nvim_win_get_number(props.win), group = "DevIconWindows" },
{ " " }
}
end,
})
end,
event = "VeryLazy",
}

View file

@ -1,42 +0,0 @@
return {
"ggandor/leap.nvim",
dependencies = {
"tpope/vim-repeat",
},
config = function()
local leap = require("leap")
leap.opts.safe_labels = {}
-- Hide the (real) cursor when leaping, and restore it afterwards.
vim.api.nvim_create_autocmd(
"User",
{
pattern = "LeapEnter",
callback = function()
vim.cmd.hi("Cursor", "blend=100")
vim.opt.guicursor:append { "a:Cursor/lCursor" }
end,
}
)
vim.api.nvim_create_autocmd(
"User",
{
pattern = "LeapLeave",
callback = function()
vim.cmd.hi("Cursor", "blend=0")
vim.opt.guicursor:remove { "a:Cursor/lCursor" }
end,
}
)
require("utils").add_keymaps({
n = {
["l"] = {
cmd = function()
require("leap").leap({ target_windows = require("leap.user").get_focusable_windows() })
end,
}
}
})
end,
}

View file

@ -1,71 +0,0 @@
return {
"nvimdev/lspsaga.nvim",
event = "LspAttach",
dependencies = {
"nvim-tree/nvim-web-devicons",
},
config = function()
require("lspsaga").setup({
symbol_in_winbar = {
enable = false,
-- separator = " ",
-- hide_keyword = true,
-- ignore_patterns = nil,
-- show_file = true,
-- folder_level = 2,
-- color_mode = true,
-- dely = 300,
-- show_nodes = true,
-- max_nodes = 2,
},
implement = {
enable = false,
},
outline = {
win_width = 52,
},
ui = {
kind = require("catppuccin.groups.integrations.lsp_saga").custom_kind(),
border = "single",
}
})
require("utils").add_keymaps({
n = {
["<F2>"] = {
cmd = ":Lspsaga diagnostic_jump_next<CR>"
},
["<F3>"] = {
cmd = ":Lspsaga diagnostic_jump_prev<CR>"
},
["K"] = {
cmd = ":Lspsaga hover_doc<CR>"
},
["<leader>lo"] = {
cmd = ":Lspsaga outline<CR>"
},
["<leader>rn"] = {
cmd = ":Lspsaga rename<CR>"
},
["<leader>h"] = {
cmd = ":Lspsaga term_toggle<CR>"
},
["gr"] = {
cmd = ":Lspsaga finder<CR>"
},
["<leader>lt"] = {
cmd = ":Lspsaga peek_type_definition<CR>"
},
["<leader>ld"] = {
cmd = ":Lspsaga peek_definition<CR>"
},
["<leader>ca"] = {
cmd = ":Lspsaga code_action<CR>"
},
["<leader>lc"] = {
cmd = ":Lspsaga incoming_calls<CR>"
},
}
})
end,
}

View file

@ -1,33 +0,0 @@
return {
"nvim-lualine/lualine.nvim",
dependencies = {
"nvim-tree/nvim-web-devicons"
},
config = function()
require("lualine").setup {
options = {
theme = "catppuccin",
section_separators = { "", "" },
component_separators = { "", "" },
icons_enabled = true,
},
sections = {
lualine_a = { "mode" },
lualine_b = { "branch" },
lualine_c = { require("auto-session.lib").current_session_name },
lualine_x = { "encoding", "fileformat", "filetype" },
lualine_y = { "progress" },
lualine_z = { "location" }
},
inactive_sections = {
lualine_a = {},
lualine_b = {},
lualine_c = {},
lualine_x = {},
lualine_y = {},
lualine_z = {}
},
tabline = {},
}
end
}

View file

@ -1,159 +0,0 @@
local utils = require("utils")
local function setup_lsp(server_names)
local capabilities = require("cmp_nvim_lsp").default_capabilities()
local lspconfig = require("lspconfig")
for _, server_name in ipairs(server_names) do
local server = lspconfig[server_name]
if server then
local server_table = require("language_servers/" .. server_name)
server_table.capabilities = capabilities
server_table.on_attach = function(client, bufnr)
vim.lsp.inlay_hint.enable(bufnr, true)
if client.server_capabilities.documentFormattingProvider then
vim.api.nvim_buf_create_user_command(bufnr, "Format", vim.lsp.buf.format, { nargs = 0 })
vim.api.nvim_create_autocmd("BufWritePre", {
buffer = bufnr,
callback = function()
vim.lsp.buf.format()
end,
})
end
utils.add_keymaps({
n = {
["gd"] = {
cmd = function()
vim.lsp.buf.definition()
end,
opts = {
noremap = true,
silent = true
}
},
["gD"] = {
cmd = function()
vim.lsp.buf.declaration()
end,
opts = {
noremap = true,
silent = true
}
},
}
})
end
server.setup(server_table)
-- Run the post_setup function if it exists
if server_table.post_setup then
server_table.post_setup()
end
else
error("LSP server not found: " .. server_name)
end
end
end
local function setup_dap()
local dap = require("dap")
local dapui = require("dapui")
dapui.setup()
local dap_signs = {
{ "DapBreakpoint", { text = "🛑", texthl = "", linehl = "", numhl = "" } },
}
for _, sign in ipairs(dap_signs) do
vim.fn.sign_define(sign[1], sign[2])
end
dap.listeners.after.event_initialized["dapui_config"] = function()
dapui.open()
end
dap.listeners.before.event_terminated["dapui_config"] = function()
dapui.close()
end
dap.listeners.before.event_exited["dapui_config"] = function()
dapui.close()
end
require("mason-nvim-dap").setup({
handlers = {}
})
require("nvim-dap-repl-highlights").setup()
utils.add_keymaps({
n = {
["<leader>dr"] = { cmd = ":lua require(\"dap\").continue()<CR>" },
["<leader>db"] = { cmd = ":lua require(\"dap\").toggle_breakpoint()<CR>" },
["<leader>ds"] = {
cmd = function()
dap.disconnect({ terminateDebuggee = true })
dap.close()
dapui.close()
end
},
["<F10>"] = { cmd = ":lua require(\"dap\").step_over()<CR>" },
["<F11>"] = { cmd = ":lua require(\"dap\").step_into()<CR>" },
["<F12>"] = { cmd = ":lua require(\"dap\").step_out()<CR>" },
}
})
end
return {
"williamboman/mason.nvim",
dependencies = {
-- Mason plugins
"WhoIsSethDaniel/mason-tool-installer.nvim",
"RubixDev/mason-update-all",
-- LSP config
"neovim/nvim-lspconfig",
"williamboman/mason-lspconfig.nvim",
-- DAP
"folke/neodev.nvim",
"jay-babu/mason-nvim-dap.nvim",
"rcarriga/nvim-dap-ui",
"mfussenegger/nvim-dap",
"nvim-neotest/nvim-nio",
"LiadOz/nvim-dap-repl-highlights"
},
config = function()
-- Find all files in lua/language_servers and require them
-- We use them to ensure that the servers are installed and configured
-- Make sure that the files use the lspconfig naming convention
local lua_files_str = vim.fn.globpath(vim.fn.stdpath("config") .. "/lua/language_servers", "*.lua", true)
local has_line_breaks = vim.fn.match(lua_files_str, [[\n]]) > -1
-- Get an array of all the files in the directory, make sure to account for single file
local lua_files = has_line_breaks and vim.fn.split(lua_files_str, "\n") or { lua_files_str }
-- Remove path and extension and only keep the filename
local server_names = vim.tbl_map(function(file)
return vim.fn.fnamemodify(file, ":t:r")
end, lua_files)
-- Create a new table which contains the non-lsp setups for Mason (linters, formatters, etc)
-- IMPORTANT: Make sure to leave rust-analyzer out of this list, as it can cause conflicts with rustaceanvim.
-- Install rust-analyzer using your systems package manager instead.
local mason_installs = vim.list_extend({
"clang-format",
"cmakelang",
"codelldb",
"netcoredbg",
}, server_names)
require("mason").setup()
require("mason-lspconfig").setup()
require("mason-tool-installer").setup({
ensure_installed = mason_installs,
})
setup_lsp(server_names)
setup_dap()
require("mason-update-all").setup()
end,
}

View file

@ -1,17 +0,0 @@
return {
"stevearc/oil.nvim",
config = function()
local oil = require("oil")
oil.setup()
require("utils").add_keymaps({
n = {
["<leader>o"] = {
cmd = function()
oil.toggle_float(vim.fn.getcwd())
end,
}
}
})
end,
}

View file

@ -1,3 +0,0 @@
return {
"nvim-lua/plenary.nvim",
}

View file

@ -1,18 +0,0 @@
return {
"ahmedkhalf/project.nvim",
config = function()
require("project_nvim").setup({
patterns = {
".git",
".hg",
".svn",
"Makefile",
"package.json",
"Cargo.toml",
"go.mod",
".clang-tidy",
".clang-format"
},
})
end,
}

View file

@ -1,8 +0,0 @@
return {
"rasulomaroff/reactive.nvim",
config = function()
require("reactive").setup({
load = { "catppuccin-macchiato-cursor", "catppuccin-macchiato-cursorline" }
})
end,
}

View file

@ -1,32 +0,0 @@
return {
"mrcjkb/rustaceanvim",
version = "^4",
ft = { "rust" },
config = function()
vim.g.rustaceanvim = {
inlay_hints = {
highlight = "NonText",
},
tools = {
hover_actions = {
auto_focus = true,
},
},
server = {
on_attach = function(client, bufnr)
vim.lsp.inlay_hint.enable(bufnr, true)
if client.server_capabilities.documentFormattingProvider then
vim.api.nvim_buf_create_user_command(bufnr, "Format", vim.lsp.buf.format, { nargs = 0 })
vim.api.nvim_create_autocmd("BufWritePre", {
buffer = bufnr,
callback = function()
vim.lsp.buf.format()
end,
})
end
end,
}
}
end,
}

View file

@ -1,16 +0,0 @@
return {
"kylechui/nvim-surround",
version = "*",
event = "VeryLazy",
config = function()
require("nvim-surround").setup({
-- Make sure that we never get whitespaces when adding surroundings
surrounds = {
["("] = { add = { "(", ")" }, },
["{"] = { add = { "{", "}" }, },
["<"] = { add = { "<", ">" }, },
["["] = { add = { "[", "]" }, },
}
})
end,
}

View file

@ -1,156 +0,0 @@
return {
"nvim-telescope/telescope.nvim",
dependencies = {
"nvim-lua/plenary.nvim",
"nvim-telescope/telescope-fzf-native.nvim",
},
config = function()
local actions = require("telescope.actions")
require("telescope").setup({
pickers = {
buffers = {
mappings = {
i = {
["<CR>"] = actions.select_drop,
},
n = {
["<CR>"] = actions.select_drop,
}
}
},
find_files = {
mappings = {
i = {
["<CR>"] = actions.select_drop,
},
n = {
["<CR>"] = actions.select_drop,
}
}
},
git_files = {
mappings = {
i = {
["<CR>"] = actions.select_drop,
},
n = {
["<CR>"] = actions.select_drop,
}
}
},
old_files = {
mappings = {
i = {
["<CR>"] = actions.select_drop,
},
n = {
["<CR>"] = actions.select_drop,
}
}
},
}
})
require("telescope").load_extension("fzf")
local dropdown_theme = require('telescope.themes').get_dropdown({
-- results_height = 50,
width = 0.2,
winblend = 20,
prompt_title = "",
borderchars = {
{ '', '', '', '', '', '', '', ''},
prompt = {"", "", " ", "", '', '', "", ""},
results = {"", "", "", "", "", "", "", ""},
preview = { '', '', '', '', '', '', '', ''},
}
})
require("utils").add_keymaps({
n = {
-- File search
["<leader>to"] = {
cmd = function()
dropdown_theme.prompt_prefix = "Files>"
dropdown_theme.previewer = false
dropdown_theme.find_command = nil
require("telescope.builtin").find_files(dropdown_theme)
-- require("telescope.builtin").find_files()
end,
},
["<leader>tf"] = {
cmd = function()
dropdown_theme.prompt_prefix = "Find>"
dropdown_theme.previewer = true
dropdown_theme.find_command = nil
require("telescope.builtin").current_buffer_fuzzy_find(dropdown_theme)
end,
},
["<leader>ta"] = {
-- cmd = ":lua require('telescope.builtin').live_grep({find_command=rg,--ignore-file,.gitignore,--exclude,*.git,--exclude,*.svn,--exclude,*.vs,--exclude,*.idea}) <CR>",
cmd = function()
dropdown_theme.prompt_prefix = "Grep>"
dropdown_theme.previewer = true
dropdown_theme.find_command = {
find_command = "rg",
"--ignore-file",
".gitignore",
"--exclude",
"*.git",
"--exclude",
"*.svn",
"--exclude",
"*.vs",
"--exclude",
"*.idea",
}
require("telescope.builtin").live_grep(dropdown_theme)
end,
},
-- Git
["<leader>gl"] = {
cmd = function()
dropdown_theme.prompt_prefix = "Log>"
dropdown_theme.previewer = true
dropdown_theme.find_command = nil
require("telescope.builtin").git_commits(dropdown_theme)
end,
},
["<leader>gs"] = {
cmd = function()
dropdown_theme.prompt_prefix = "Status>"
dropdown_theme.previewer = true
dropdown_theme.find_command = nil
require("telescope.builtin").git_status(dropdown_theme)
end,
},
["<leader>gh"] = {
cmd = function()
dropdown_theme.prompt_prefix = "History>"
dropdown_theme.previewer = true
dropdown_theme.find_command = nil
require("telescope.builtin").git_bcommits(dropdown_theme)
end,
},
["<leader>gb"] = {
cmd = function()
dropdown_theme.prompt_prefix = "Branches>"
dropdown_theme.previewer = true
dropdown_theme.find_command = nil
require("telescope.builtin").git_branches(dropdown_theme)
end,
},
-- Misc
["<leader>tb"] = {
cmd = function()
dropdown_theme.prompt_prefix = "Marks>"
dropdown_theme.previewer = true
dropdown_theme.find_command = nil
require("telescope.builtin").marks(dropdown_theme)
end,
}
}
})
end,
}

View file

@ -1,4 +0,0 @@
return {
"nvim-telescope/telescope-fzf-native.nvim",
build = "cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release && cmake --build build --config Release && cmake --install build --prefix build",
}

View file

@ -1,69 +0,0 @@
return {
"nvim-treesitter/nvim-treesitter",
event = { "BufReadPre", "BufNewFile" },
build = ":TSUpdate",
dependencies = {
-- "nvim-treesitter/nvim-treesitter-context",
"nvim-treesitter/nvim-treesitter-textobjects",
},
config = function()
require("nvim-treesitter.configs").setup({
ensure_installed = {
"vim",
"vimdoc",
"bash",
"lua",
"c",
"cpp",
"c_sharp",
"rust",
"cmake",
"make",
"yaml",
"ninja",
"gitignore",
"markdown",
"markdown_inline",
"hyprlang",
"json",
"html",
"hlsl",
"glsl",
"gdshader",
"gdscript",
"dockerfile",
"dart",
"css"
},
sync_install = false,
-- This can be updated to a list of languages instead of defaulting to true
highlight = { enable = true },
indent = { enable = true },
incremental_selection = {
enable = true,
keymaps = {
init_selection = "<C-cr>",
node_incremental = "<C-cr>",
scope_incremental = false,
node_decremental = "<C-bs>",
},
},
textobjects = {
select = {
enable = true,
lookahead = true,
keymaps = {
["ic"] = { query = "@class.inner" },
["ac"] = { query = "@class.outer" },
["ii"] = { query = "@conditional.inner" },
["ai"] = { query = "@conditional.outer" },
["if"] = { query = "@function.inner" },
["af"] = { query = "@function.outer" },
["il"] = { query = "@loop.inner" },
["al"] = { query = "@loop.outer" },
},
},
},
})
end,
}

View file

@ -1,11 +0,0 @@
local M = {}
function M.add_keymaps(maps)
for mode, entries in pairs(maps) do
for code, info in pairs(entries) do
vim.keymap.set(mode, code, info.cmd, info.opts)
end
end
end
return M

View file

@ -1,60 +0,0 @@
local opt = vim.opt
-- Disable tabs, will use telescope and harpoon instead
opt.showtabline = 0
-- Make Vim use the system clipboard
opt.clipboard = "unnamedplus"
-- Highlight the currently selected row
opt.cursorline = true
opt.cursorlineopt = "both"
-- Indenting
opt.expandtab = true
opt.smartindent = true
opt.breakindent = true
opt.shiftwidth = 4
opt.tabstop = 4
opt.softtabstop = 4
-- Disable home screen
opt.shortmess:append("sI")
-- Signcolumn
opt.signcolumn = "yes:2" -- Adds a spacing to the left which can contain gutter icons
opt.fillchars = { eob = " " } -- Remove the fill character for empty lines which defaults to: "~"
-- Search
opt.ignorecase = true
opt.smartcase = true
opt.incsearch = true
-- Disable mouse support
opt.mouse = ""
-- Numbers
opt.number = true
opt.relativenumber = true
opt.numberwidth = 4
-- Decrease update time
opt.updatetime = 250
opt.timeoutlen = 300
-- Richer colors in terminal, not all terminals support this
opt.termguicolors = true
-- Disable swapfile, 99/100 times it just gets in the way
opt.swapfile = false
-- Buffers
opt.splitright = true
opt.splitbelow = true
-- Removes the extra command line bar at the bottom, using lualine instead
opt.cmdheight = 0
opt.laststatus = 3
return opt