Updated scripts
This commit is contained in:
@@ -1,563 +1,167 @@
|
||||
-------------------------------------------------------------------
|
||||
-- Settings
|
||||
-------------------------------------------------------------------
|
||||
vim.g.mapleader = " "
|
||||
vim.g.maplocalleader = " "
|
||||
vim.o.hlsearch = false
|
||||
vim.wo.number = true
|
||||
vim.o.mouse = "a"
|
||||
vim.o.breakindent = true
|
||||
vim.o.undofile = true
|
||||
vim.o.ignorecase = true
|
||||
vim.o.smartcase = true
|
||||
vim.wo.signcolumn = "yes"
|
||||
vim.o.termguicolors = true
|
||||
vim.o.shiftwidth = 4
|
||||
vim.o.smarttab = true
|
||||
vim.o.tabstop = 4
|
||||
vim.o.expandtab = true
|
||||
vim.o.softtabstop = 4
|
||||
vim.o.inccommand = "split"
|
||||
vim.o.cursorline = true
|
||||
vim.o.showmatch = true
|
||||
vim.o.updatetime = 250
|
||||
vim.o.timeoutlen = 300
|
||||
vim.o.pumheight = 10
|
||||
vim.o.relativenumber = true
|
||||
vim.o.scrolloff = 8
|
||||
vim.o.showmode = false
|
||||
vim.o.showtabline = 0
|
||||
vim.o.wrap = true
|
||||
vim.o.foldmethod = "expr"
|
||||
vim.o.foldexpr = "nvim_treesitter#foldexpr()"
|
||||
vim.o.foldlevelstart = 99
|
||||
vim.o.autoread = true
|
||||
|
||||
vim.schedule(function()
|
||||
vim.o.clipboard = "unnamedplus"
|
||||
end)
|
||||
vim.opt.winborder = "rounded"
|
||||
vim.opt.hlsearch = false
|
||||
vim.opt.tabstop = 4
|
||||
vim.opt.cursorcolumn = false
|
||||
vim.opt.ignorecase = true
|
||||
vim.opt.shiftwidth = 4
|
||||
vim.opt.smartindent = true
|
||||
vim.opt.number = true
|
||||
vim.opt.relativenumber = true
|
||||
vim.opt.termguicolors = true
|
||||
vim.opt.undofile = true
|
||||
vim.opt.signcolumn = "yes"
|
||||
vim.g.netrw_banner = 0 -- gets rid of the annoying banner for netrw
|
||||
vim.g.netrw_browse_split = 4 -- open in prior window
|
||||
vim.g.netrw_altv = 1 -- change from left splitting to right splitting
|
||||
vim.g.netrw_liststyle = 3 -- tree style view in netrw
|
||||
|
||||
-------------------------------------------------------------------
|
||||
-- Autocommands
|
||||
-------------------------------------------------------------------
|
||||
-- Autoset current working directory based on closest git repo
|
||||
vim.api.nvim_create_autocmd("BufEnter", {
|
||||
callback = function()
|
||||
local git_dir = vim.fn.finddir(".git", ".;")
|
||||
if git_dir ~= "" then
|
||||
local git_root = vim.fn.fnamemodify(git_dir, ":h")
|
||||
vim.cmd("lcd " .. git_root)
|
||||
end
|
||||
end,
|
||||
})
|
||||
-- show cursor line only in active window
|
||||
local cursorLineGrp = vim.api.nvim_create_augroup("CursorLine", { clear = true })
|
||||
vim.api.nvim_create_autocmd(
|
||||
{ "InsertLeave", "WinEnter" },
|
||||
{ pattern = "*", command = "set cursorline", group = cursorLineGrp }
|
||||
)
|
||||
vim.api.nvim_create_autocmd(
|
||||
{ "InsertEnter", "WinLeave" },
|
||||
{ pattern = "*", command = "set nocursorline", group = cursorLineGrp }
|
||||
)
|
||||
vim.api.nvim_create_autocmd(
|
||||
{ "InsertLeave", "FocusGained" },
|
||||
{ pattern = "*", command = "set cursorline", group = cursorLineGrp }
|
||||
)
|
||||
vim.api.nvim_create_autocmd(
|
||||
{ "InsertEnter", "FocusLost" },
|
||||
{ pattern = "*", command = "set nocursorline", group = cursorLineGrp }
|
||||
)
|
||||
-- Auto update on file changes
|
||||
vim.api.nvim_create_autocmd({ "BufEnter", "CursorHold", "CursorHoldI", "FocusGained" }, {
|
||||
command = "if mode() != 'c' | checktime | endif",
|
||||
pattern = { "*" },
|
||||
})
|
||||
vim.api.nvim_create_autocmd(
|
||||
{ "FileChangedShellPost" },
|
||||
{ command = 'echohl WarningMsg | echo "File changed on disk. Buffer reloaded." | echohl None', pattern = { "*" } }
|
||||
)
|
||||
|
||||
-------------------------------------------------------------------
|
||||
-- Plugin management
|
||||
-------------------------------------------------------------------
|
||||
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)
|
||||
-- -- show cursor line only in active window
|
||||
-- local cursorLineGrp = vim.api.nvim_create_augroup("CursorLine", { clear = true })
|
||||
-- vim.api.nvim_create_autocmd(
|
||||
-- { "InsertLeave", "WinEnter" },
|
||||
-- { pattern = "*", command = "set cursorline", group = cursorLineGrp }
|
||||
-- )
|
||||
-- vim.api.nvim_create_autocmd(
|
||||
-- { "InsertEnter", "WinLeave" },
|
||||
-- { pattern = "*", command = "set nocursorline", group = cursorLineGrp }
|
||||
-- )
|
||||
-- vim.api.nvim_create_autocmd(
|
||||
-- { "InsertLeave", "FocusGained" },
|
||||
-- { pattern = "*", command = "set cursorline", group = cursorLineGrp }
|
||||
-- )
|
||||
-- vim.api.nvim_create_autocmd(
|
||||
-- { "InsertEnter", "FocusLost" },
|
||||
-- { pattern = "*", command = "set nocursorline", group = cursorLineGrp }
|
||||
-- )
|
||||
|
||||
-------------------------------------------------------------------
|
||||
-- Plugin installation
|
||||
-------------------------------------------------------------------
|
||||
require("lazy").setup({
|
||||
vim.pack.add({
|
||||
{ src = "https://git.cmtec.se/cm/nightly_cm.nvim.git" },
|
||||
{ src = "https://github.com/mrjones2014/smart-splits.nvim" },
|
||||
{ src = "https://github.com/nvim-lua/plenary.nvim" },
|
||||
{ src = "https://github.com/kdheepak/lazygit.nvim" },
|
||||
{ src = "https://github.com/echasnovski/mini.icons" },
|
||||
{ src = "https://github.com/echasnovski/mini.statusline" },
|
||||
{ src = "https://github.com/echasnovski/mini.pick" },
|
||||
{ src = 'https://github.com/neovim/nvim-lspconfig' },
|
||||
{ src = 'https://github.com/lewis6991/gitsigns.nvim' },
|
||||
{ src = 'https://github.com/MunifTanjim/nui.nvim' },
|
||||
{ src = 'https://github.com/folke/noice.nvim' },
|
||||
})
|
||||
|
||||
{
|
||||
dir = "~/linuxbox/nightly_cm.nvim",
|
||||
lazy = false,
|
||||
priority = 1000,
|
||||
config = function()
|
||||
vim.cmd.colorscheme("nightly_cm")
|
||||
end,
|
||||
-------------------------------------------------------------------
|
||||
-- Plugin config
|
||||
-------------------------------------------------------------------
|
||||
-- colorscheme
|
||||
vim.cmd.colorscheme("nightly_cm")
|
||||
require "noice".setup()
|
||||
require "mini.pick".setup()
|
||||
require "mini.statusline".setup()
|
||||
require "gitsigns".setup({
|
||||
signs = {
|
||||
add = { text = "▎" },
|
||||
change = { text = "▎" },
|
||||
delete = { text = "▎" },
|
||||
topdelete = { text = "▎" },
|
||||
changedelete = { text = "▎" },
|
||||
untracked = { text = "▎" },
|
||||
},
|
||||
|
||||
{
|
||||
"folke/lazydev.nvim",
|
||||
ft = "lua", -- only load on lua files
|
||||
opts = {
|
||||
library = {
|
||||
{ path = "${3rd}/luv/library", words = { "vim%.uv" } },
|
||||
},
|
||||
},
|
||||
preview_config = {
|
||||
-- Options passed to nvim_open_win
|
||||
border = "solid",
|
||||
style = "minimal",
|
||||
relative = "cursor",
|
||||
row = 0,
|
||||
col = 1,
|
||||
},
|
||||
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
dependencies = {
|
||||
{ "j-hui/fidget.nvim", opts = {} },
|
||||
})
|
||||
-------------------------------------------------------------------
|
||||
-- LSP config
|
||||
-------------------------------------------------------------------
|
||||
vim.lsp.enable({ "lua_ls", "rust_analyzer", "bashls", "pyright", "marksman", "clangd", "yamlls" })
|
||||
-- prevent the built-in vim.lsp.completion autotrigger from selecting the first item
|
||||
vim.opt.completeopt = { "menuone", "popup", "noselect" }
|
||||
vim.api.nvim_create_autocmd("LspAttach", {
|
||||
callback = function(ev)
|
||||
local client = vim.lsp.get_client_by_id(ev.data.client_id)
|
||||
if client ~= nil and client:supports_method("textDocument/completion") then
|
||||
vim.lsp.completion.enable(true, client.id, ev.buf, { autotrigger = true })
|
||||
end
|
||||
end,
|
||||
})
|
||||
vim.diagnostic.config({
|
||||
severity_sort = true,
|
||||
float = { border = "rounded", source = "if_many" },
|
||||
underline = { severity = vim.diagnostic.severity.ERROR },
|
||||
signs = {
|
||||
text = {
|
||||
[vim.diagnostic.severity.ERROR] = " ",
|
||||
[vim.diagnostic.severity.WARN] = " ",
|
||||
[vim.diagnostic.severity.INFO] = " ",
|
||||
[vim.diagnostic.severity.HINT] = " ",
|
||||
},
|
||||
config = function()
|
||||
vim.api.nvim_create_autocmd("LspAttach", {
|
||||
group = vim.api.nvim_create_augroup("kickstart-lsp-attach", { clear = true }),
|
||||
callback = function(event)
|
||||
local map = function(keys, func, desc, mode)
|
||||
mode = mode or "n"
|
||||
vim.keymap.set(mode, keys, func, { buffer = event.buf, desc = "LSP: " .. desc })
|
||||
end
|
||||
|
||||
map("grn", vim.lsp.buf.rename, "[R]e[n]ame")
|
||||
map("gra", vim.lsp.buf.code_action, "[G]oto Code [A]ction", { "n", "x" })
|
||||
map("grr", require("fzf-lua").lsp_references, "[G]oto [R]eferences")
|
||||
map("gri", require("fzf-lua").lsp_implementations, "[G]oto [I]mplementation")
|
||||
map("grd", require("fzf-lua").lsp_definitions, "[G]oto [D]efinition")
|
||||
|
||||
-- WARN: This is not Goto Definition, this is Goto Declaration.
|
||||
-- For example, in C this would take you to the header.
|
||||
map("grD", vim.lsp.buf.declaration, "[G]oto [D]eclaration")
|
||||
map("gO", require("fzf-lua").lsp_document_symbols, "Open Document Symbols")
|
||||
map("gW", require("fzf-lua").lsp_live_workspace_symbols, "Open Workspace Symbols")
|
||||
map("grt", require("fzf-lua").lsp_typedefs, "[G]oto [T]ype Definition")
|
||||
end,
|
||||
})
|
||||
|
||||
vim.diagnostic.config({
|
||||
severity_sort = true,
|
||||
float = { border = "rounded", source = "if_many" },
|
||||
underline = { severity = vim.diagnostic.severity.ERROR },
|
||||
signs = {
|
||||
text = {
|
||||
[vim.diagnostic.severity.ERROR] = " ",
|
||||
[vim.diagnostic.severity.WARN] = " ",
|
||||
[vim.diagnostic.severity.INFO] = " ",
|
||||
[vim.diagnostic.severity.HINT] = " ",
|
||||
},
|
||||
} or {},
|
||||
virtual_text = {
|
||||
source = "if_many",
|
||||
spacing = 2,
|
||||
format = function(diagnostic)
|
||||
local diagnostic_message = {
|
||||
[vim.diagnostic.severity.ERROR] = diagnostic.message,
|
||||
[vim.diagnostic.severity.WARN] = diagnostic.message,
|
||||
[vim.diagnostic.severity.INFO] = diagnostic.message,
|
||||
[vim.diagnostic.severity.HINT] = diagnostic.message,
|
||||
}
|
||||
return diagnostic_message[diagnostic.severity]
|
||||
end,
|
||||
},
|
||||
})
|
||||
|
||||
local capabilities = require("blink.cmp").get_lsp_capabilities()
|
||||
|
||||
local servers = {
|
||||
clangd = {},
|
||||
html = {},
|
||||
yamlls = {},
|
||||
bashls = {},
|
||||
pyright = {},
|
||||
marksman = {},
|
||||
rust_analyzer = {},
|
||||
lua_ls = {
|
||||
settings = {
|
||||
Lua = {
|
||||
completion = {
|
||||
callSnippet = "Replace",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
} or {},
|
||||
virtual_text = {
|
||||
source = "if_many",
|
||||
spacing = 2,
|
||||
format = function(diagnostic)
|
||||
local diagnostic_message = {
|
||||
[vim.diagnostic.severity.ERROR] = diagnostic.message,
|
||||
[vim.diagnostic.severity.WARN] = diagnostic.message,
|
||||
[vim.diagnostic.severity.INFO] = diagnostic.message,
|
||||
[vim.diagnostic.severity.HINT] = diagnostic.message,
|
||||
}
|
||||
|
||||
for server_name, server in pairs(servers) do
|
||||
server.capabilities = vim.tbl_deep_extend("force", {}, capabilities, server.capabilities or {})
|
||||
require("lspconfig")[server_name].setup(server)
|
||||
end
|
||||
return diagnostic_message[diagnostic.severity]
|
||||
end,
|
||||
},
|
||||
})
|
||||
|
||||
{
|
||||
"stevearc/conform.nvim",
|
||||
opts = {
|
||||
formatters_by_ft = {
|
||||
lua = { "stylua" },
|
||||
python = { "isort", "black" },
|
||||
rust = { "rustfmt", lsp_format = "fallback" },
|
||||
c = { "clang_format" },
|
||||
cpp = { "clang_format" },
|
||||
javascript = { "prettier" },
|
||||
typescript = { "prettier" },
|
||||
javascriptreact = { "prettier" },
|
||||
typescriptreact = { "prettier" },
|
||||
css = { "prettier" },
|
||||
html = { "prettier" },
|
||||
json = { "prettier" },
|
||||
yaml = { "prettier" },
|
||||
markdown = { "prettier" },
|
||||
sh = { "shfmt" },
|
||||
},
|
||||
formatters = {
|
||||
clang_format = {
|
||||
prepend_args = { "--style={BasedOnStyle: LLVM, IndentWidth: 4, TabWidth: 4, UseTab: Never}" },
|
||||
},
|
||||
shfmt = {
|
||||
prepend_args = { "-i", "4" },
|
||||
},
|
||||
},
|
||||
format_on_save = {
|
||||
timeout_ms = 3000,
|
||||
lsp_format = "fallback",
|
||||
},
|
||||
},
|
||||
},
|
||||
-------------------------------------------------------------------
|
||||
-- Keybindings
|
||||
-------------------------------------------------------------------
|
||||
local map = vim.keymap.set
|
||||
vim.g.mapleader = " "
|
||||
-- QoL bindings
|
||||
map('i', 'jj', '<Esc>', { noremap = true, silent = true })
|
||||
map('n', '<leader>u', ':update<CR> :source<CR>', { noremap = true, silent = true })
|
||||
map('n', '<leader>w', ':write<CR>', { noremap = true, silent = true })
|
||||
map('n', '<leader>q', ':quit<CR>', { noremap = true, silent = true })
|
||||
map('n', '<leader>v', ':vsplit<CR>', { noremap = true, silent = true })
|
||||
|
||||
{
|
||||
"saghen/blink.cmp",
|
||||
event = "VimEnter",
|
||||
version = "1.*",
|
||||
-- optional: provides snippets for the snippet source
|
||||
dependencies = { "rafamadriz/friendly-snippets" },
|
||||
--- @module 'blink.cmp'
|
||||
--- @type blink.cmp.Config
|
||||
opts = {
|
||||
keymap = {
|
||||
preset = "default",
|
||||
},
|
||||
-- Git
|
||||
map('n', '<leader>g', ':LazyGitCurrentFile<CR>', { noremap = true, silent = true })
|
||||
|
||||
appearance = {
|
||||
nerd_font_variant = "mono",
|
||||
},
|
||||
-- File browser
|
||||
map('n', '<leader>e', ':25Lex<CR>', { noremap = true, silent = true })
|
||||
map('n', '<leader>f', ":Pick files<CR>", { noremap = true, silent = true })
|
||||
map('n', '<leader>h', ":Pick help<CR>", { noremap = true, silent = true })
|
||||
|
||||
completion = {
|
||||
documentation = { auto_show = false, auto_show_delay_ms = 500 },
|
||||
},
|
||||
-- LSP
|
||||
map('n', '<leader>lf', vim.lsp.buf.format, { noremap = true, silent = true })
|
||||
|
||||
sources = {
|
||||
default = { "lsp", "buffer", "path", "snippets" },
|
||||
},
|
||||
-- Global Copy/Paste
|
||||
map({ 'n', 'v' }, '<leader>y', '"+y', { noremap = true, silent = true })
|
||||
map({ 'n', 'v' }, '<leader>d', '"+d', { noremap = true, silent = true })
|
||||
map({ 'n', 'v' }, '<leader>c', '1z=', { noremap = true, silent = true })
|
||||
|
||||
fuzzy = { implementation = "prefer_rust_with_warning" },
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
build = ":TSUpdate",
|
||||
main = "nvim-treesitter.configs", -- Sets main module to use for opts
|
||||
opts = {
|
||||
ensure_installed = {
|
||||
"bash",
|
||||
"c",
|
||||
"diff",
|
||||
"html",
|
||||
"lua",
|
||||
"luadoc",
|
||||
"markdown",
|
||||
"markdown_inline",
|
||||
"query",
|
||||
"vim",
|
||||
"vimdoc",
|
||||
"rust",
|
||||
"python",
|
||||
},
|
||||
auto_install = true,
|
||||
highlight = {
|
||||
enable = true,
|
||||
additional_vim_regex_highlighting = { "ruby" },
|
||||
},
|
||||
indent = { enable = true, disable = { "ruby" } },
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
"ibhagwan/fzf-lua",
|
||||
dependencies = { "echasnovski/mini.icons" },
|
||||
opts = {
|
||||
"telescope",
|
||||
fzf_colors = {
|
||||
true, -- inherit fzf colors that aren't specified below from
|
||||
-- the auto-generated theme similar to `fzf_colors=true`
|
||||
["fg"] = { "fg", "CursorLine" },
|
||||
["bg"] = { "bg", "Normal" },
|
||||
["hl"] = { "fg", "Comment" },
|
||||
["fg+"] = { "fg", "Normal", "underline" },
|
||||
["bg+"] = { "bg", { "CursorLine", "Normal" } },
|
||||
["hl+"] = { "fg", "Statement" },
|
||||
["info"] = { "fg", "PreProc" },
|
||||
["prompt"] = { "fg", "Conditional" },
|
||||
["pointer"] = { "fg", "Exception" },
|
||||
["marker"] = { "fg", "Keyword" },
|
||||
["spinner"] = { "fg", "Label" },
|
||||
["header"] = { "fg", "Comment" },
|
||||
["gutter"] = "-1",
|
||||
},
|
||||
files = {
|
||||
git_icons = true, -- show git icons?
|
||||
file_icons = true, -- show file icons (true|"devicons"|"mini")?
|
||||
color_icons = true, -- colorize file|git icons
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
"mrjones2014/smart-splits.nvim",
|
||||
lazy = false,
|
||||
opts = {
|
||||
at_edge = "stop",
|
||||
float_win_behavior = "mux",
|
||||
ignored_buftypes = { "nofile", "quickfix", "prompt", "fzf" },
|
||||
ignored_filetypes = { "NvimTree", "fzf" },
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
"nvim-lualine/lualine.nvim",
|
||||
opts = {
|
||||
options = {
|
||||
icons_enabled = true,
|
||||
theme = "nightly_cm",
|
||||
component_separators = "",
|
||||
section_separators = "",
|
||||
globalstatus = true,
|
||||
},
|
||||
sections = {
|
||||
lualine_a = { "mode" },
|
||||
lualine_b = { "branch", "diff" },
|
||||
lualine_c = { "diagnostics", "filename" },
|
||||
lualine_x = {
|
||||
{
|
||||
function()
|
||||
return vim.fn.getcwd()
|
||||
end,
|
||||
},
|
||||
{
|
||||
-- Lsp server name .
|
||||
function()
|
||||
local msg = ""
|
||||
local clients = vim.lsp.get_clients({ bufnr = 0 })
|
||||
if next(clients) == nil then
|
||||
return msg
|
||||
end
|
||||
for _, client in ipairs(clients) do
|
||||
msg = msg .. client.name .. ", "
|
||||
end
|
||||
if msg == "" then
|
||||
return msg
|
||||
end
|
||||
return msg:sub(1, -3)
|
||||
end,
|
||||
color = { fg = "#c6c6c6" },
|
||||
},
|
||||
},
|
||||
lualine_y = { "filetype" },
|
||||
lualine_z = { "progress" },
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
{ "echasnovski/mini.icons", version = "*", opts = {} },
|
||||
{ "echasnovski/mini.pairs", version = "*", opts = {} },
|
||||
{ "echasnovski/mini.surround", version = "*", opts = {} },
|
||||
{
|
||||
"echasnovski/mini.files",
|
||||
version = "*",
|
||||
opts = { mappings = {
|
||||
go_n_plus = "l",
|
||||
go_out = "h",
|
||||
go_out_plus = "H",
|
||||
} },
|
||||
},
|
||||
|
||||
{
|
||||
"karb94/neoscroll.nvim",
|
||||
opts = { duration_multiplier = 0.5 },
|
||||
},
|
||||
|
||||
{
|
||||
"folke/flash.nvim",
|
||||
event = "VeryLazy",
|
||||
---@type Flash.Config
|
||||
opts = {},
|
||||
-- stylua: ignore
|
||||
keys = {
|
||||
{ "s", mode = { "n", "x", "o" }, function() require("flash").jump() end, desc = "Flash" },
|
||||
{ "S", mode = { "n", "x", "o" }, function() require("flash").treesitter() end, desc = "Flash Treesitter" },
|
||||
{ "r", mode = "o", function() require("flash").remote() end, desc = "Remote Flash" },
|
||||
{ "R", mode = { "o", "x" }, function() require("flash").treesitter_search() end, desc = "Treesitter Search" },
|
||||
{ "<c-s>", mode = { "c" }, function() require("flash").toggle() end, desc = "Toggle Flash Search" },
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
"lewis6991/gitsigns.nvim",
|
||||
opts = {
|
||||
signs = {
|
||||
add = { text = "▎" },
|
||||
change = { text = "▎" },
|
||||
delete = { text = "▎" },
|
||||
topdelete = { text = "▎" },
|
||||
changedelete = { text = "▎" },
|
||||
untracked = { text = "▎" },
|
||||
},
|
||||
preview_config = {
|
||||
-- Options passed to nvim_open_win
|
||||
border = "solid",
|
||||
style = "minimal",
|
||||
relative = "cursor",
|
||||
row = 0,
|
||||
col = 1,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
"kdheepak/lazygit.nvim",
|
||||
lazy = true,
|
||||
cmd = {
|
||||
"LazyGit",
|
||||
"LazyGitConfig",
|
||||
"LazyGitCurrentFile",
|
||||
"LazyGitFilter",
|
||||
"LazyGitFilterCurrentFile",
|
||||
},
|
||||
-- optional for floating window border decoration
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
},
|
||||
-- setting the keybinding for LazyGit with 'keys' is recommended in
|
||||
-- order to load the plugin when the command is run for the first time
|
||||
keys = {
|
||||
{ "<C-g>", "<cmd>LazyGit<cr>", desc = "LazyGit" },
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
"MeanderingProgrammer/render-markdown.nvim",
|
||||
-- dependencies = { "nvim-treesitter/nvim-treesitter", "echasnovski/mini.nvim" }, -- if you use the mini.nvim suite
|
||||
dependencies = { "nvim-treesitter/nvim-treesitter", "echasnovski/mini.icons" }, -- if you use standalone mini plugins
|
||||
-- dependencies = { 'nvim-treesitter/nvim-treesitter', 'nvim-tree/nvim-web-devicons' }, -- if you prefer nvim-web-devicons
|
||||
---@module 'render-markdown'
|
||||
---@type render.md.UserConfig
|
||||
opts = {},
|
||||
},
|
||||
|
||||
{
|
||||
"lukas-reineke/indent-blankline.nvim",
|
||||
main = "ibl",
|
||||
---@module "ibl"
|
||||
---@type ibl.config
|
||||
opts = {
|
||||
scope = {
|
||||
show_end = false,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
"norcalli/nvim-colorizer.lua",
|
||||
opts = { "*" },
|
||||
},
|
||||
|
||||
{
|
||||
"folke/which-key.nvim",
|
||||
event = "VeryLazy",
|
||||
init = function()
|
||||
vim.o.timeout = true
|
||||
vim.o.timeoutlen = 300
|
||||
end,
|
||||
opts = {},
|
||||
},
|
||||
|
||||
{
|
||||
"folke/noice.nvim",
|
||||
event = "VeryLazy",
|
||||
opts = {
|
||||
-- add any options here
|
||||
},
|
||||
dependencies = {
|
||||
-- if you lazy-load any plugin below, make sure to add proper `module="..."` entries
|
||||
"MunifTanjim/nui.nvim",
|
||||
-- OPTIONAL:
|
||||
-- `nvim-notify` is only needed, if you want to use the notification view.
|
||||
-- If not available, we use `mini` as the fallback
|
||||
"rcarriga/nvim-notify",
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
"max397574/better-escape.nvim",
|
||||
opts = { timeout = 300 },
|
||||
},
|
||||
|
||||
{ "numToStr/Comment.nvim", opts = {} },
|
||||
|
||||
{
|
||||
"folke/todo-comments.nvim",
|
||||
dependencies = { "nvim-lua/plenary.nvim" },
|
||||
opts = {},
|
||||
},
|
||||
}, {})
|
||||
|
||||
-- resizing splits
|
||||
vim.keymap.set({ "n", "t" }, "<A-h>", require("smart-splits").resize_left, { desc = "Resize left" })
|
||||
vim.keymap.set({ "n", "t" }, "<A-j>", require("smart-splits").resize_down, { desc = "Resize down" })
|
||||
vim.keymap.set({ "n", "t" }, "<A-k>", require("smart-splits").resize_up, { desc = "Resize up" })
|
||||
vim.keymap.set({ "n", "t" }, "<A-l>", require("smart-splits").resize_right, { desc = "Resize right" })
|
||||
-- moving between splits
|
||||
vim.keymap.set({ "n", "t" }, "<C-h>", require("smart-splits").move_cursor_left, { desc = "Move cursor left" })
|
||||
vim.keymap.set({ "n", "t" }, "<C-j>", require("smart-splits").move_cursor_down, { desc = "Move cursor down" })
|
||||
vim.keymap.set({ "n", "t" }, "<C-k>", require("smart-splits").move_cursor_up, { desc = "Move cursor up" })
|
||||
vim.keymap.set({ "n", "t" }, "<C-l>", require("smart-splits").move_cursor_right, { desc = "Move cursor right" })
|
||||
-- swapping buffers between windows
|
||||
vim.keymap.set("n", "<leader><leader>h", require("smart-splits").swap_buf_left, { desc = "Swap buffer left" })
|
||||
vim.keymap.set("n", "<leader><leader>j", require("smart-splits").swap_buf_down, { desc = "Swap buffer down" })
|
||||
vim.keymap.set("n", "<leader><leader>k", require("smart-splits").swap_buf_up, { desc = "Swap buffer up" })
|
||||
vim.keymap.set("n", "<leader><leader>l", require("smart-splits").swap_buf_right, { desc = "Swap buffer right" })
|
||||
-- Yank, delete, and paste always use system clipboard
|
||||
vim.keymap.set({ "n", "v" }, "y", '"+y', { noremap = true, silent = true })
|
||||
vim.keymap.set({ "n", "v" }, "Y", '"+Y', { noremap = true, silent = true })
|
||||
vim.keymap.set({ "n", "v" }, "d", '"+d', { noremap = true, silent = true })
|
||||
-- vim.keymap.set({ 'n', 'v' }, 'x', '"+x', { noremap = true, silent = true })
|
||||
vim.keymap.set({ "n", "v" }, "p", '"+p', { noremap = true, silent = true })
|
||||
vim.keymap.set({ "n", "v" }, "P", '"+P', { noremap = true, silent = true })
|
||||
-- Other
|
||||
vim.keymap.set("n", "<Esc>", "<cmd>nohlsearch<CR>")
|
||||
vim.keymap.set("n", "<tab>", ":tabNext<cr>", { desc = "Next tab", silent = true })
|
||||
vim.keymap.set("n", "<C-s>", ":write<cr>", { desc = "Save", silent = true })
|
||||
vim.keymap.set("n", "<C-q>", ":quit<cr>", { desc = "Quit", silent = true })
|
||||
vim.keymap.set("n", "<leader>e", ":e .<cr>", { desc = "File explorer", silent = true })
|
||||
vim.keymap.set("n", "<leader>f", ":FzfLua files<cr>", { desc = "Find file in cwd", silent = true })
|
||||
vim.keymap.set("n", "<leader>F", ":FzfLua files cwd=~/<cr>", { desc = "Find file in root", silent = true })
|
||||
vim.keymap.set("n", "<leader>b", ":FzfLua buffers<cr>", { desc = "Buffers", silent = true })
|
||||
vim.keymap.set("n", "<leader>d", ":FzfLua lsp_document_diagnostics<cr>", { desc = "Diagnostics", silent = true })
|
||||
vim.keymap.set("n", "<leader>o", ":FzfLua oldfiles<cr>", { desc = "Old file", silent = true })
|
||||
vim.keymap.set("n", "<leader>g", ":FzfLua git_status<cr>", { desc = "Git status", silent = true })
|
||||
vim.keymap.set("n", "<leader>t", ":below terminal<cr>", { desc = "Terminal", silent = true })
|
||||
-- Smart splits to support TMUX
|
||||
map({ "n", "t" }, "<A-h>", require("smart-splits").resize_left, { desc = "Resize left" })
|
||||
map({ "n", "t" }, "<A-j>", require("smart-splits").resize_down, { desc = "Resize down" })
|
||||
map({ "n", "t" }, "<A-k>", require("smart-splits").resize_up, { desc = "Resize up" })
|
||||
map({ "n", "t" }, "<A-l>", require("smart-splits").resize_right, { desc = "Resize right" })
|
||||
map({ "n", "t" }, "<C-h>", require("smart-splits").move_cursor_left, { desc = "Move cursor left" })
|
||||
map({ "n", "t" }, "<C-j>", require("smart-splits").move_cursor_down, { desc = "Move cursor down" })
|
||||
map({ "n", "t" }, "<C-k>", require("smart-splits").move_cursor_up, { desc = "Move cursor up" })
|
||||
map({ "n", "t" }, "<C-l>", require("smart-splits").move_cursor_right, { desc = "Move cursor right" })
|
||||
map("n", "<leader><leader>h", require("smart-splits").swap_buf_left, { desc = "Swap buffer left" })
|
||||
map("n", "<leader><leader>j", require("smart-splits").swap_buf_down, { desc = "Swap buffer down" })
|
||||
map("n", "<leader><leader>k", require("smart-splits").swap_buf_up, { desc = "Swap buffer up" })
|
||||
map("n", "<leader><leader>l", require("smart-splits").swap_buf_right, { desc = "Swap buffer right" })
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
{
|
||||
"workspace.checkThirdParty": false
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
---@type ChadrcConfig
|
||||
local M = {}
|
||||
M.ui = {theme = 'tomorrow_night'}
|
||||
M.plugins = 'custom.plugins'
|
||||
M.mappings = require "custom.mappings"
|
||||
return M
|
||||
@@ -1,27 +0,0 @@
|
||||
local on_attach = require("plugins.configs.lspconfig").on_attach
|
||||
local capabilities = require("plugins.configs.lspconfig").capabilities
|
||||
|
||||
local lspconfig = require("lspconfig")
|
||||
local util = require "lspconfig/util"
|
||||
local servers = { "html", "cssls", "clangd", "pyright"}
|
||||
|
||||
for _, lsp in ipairs(servers) do
|
||||
lspconfig[lsp].setup {
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
}
|
||||
end
|
||||
|
||||
lspconfig.rust_analyzer.setup({
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
filetypes = {"rust"},
|
||||
root_dir = util.root_pattern("Cargo.toml"),
|
||||
settings = {
|
||||
['rust-analyzer'] = {
|
||||
cargo = {
|
||||
allFeatures = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
@@ -1,16 +0,0 @@
|
||||
local null_ls = require "null-ls"
|
||||
|
||||
local formatting = null_ls.builtins.formatting
|
||||
local lint = null_ls.builtins.diagnostics
|
||||
|
||||
local sources = {
|
||||
formatting.prettier,
|
||||
formatting.stylua,
|
||||
|
||||
lint.shellcheck,
|
||||
}
|
||||
|
||||
null_ls.setup {
|
||||
debug = true,
|
||||
sources = sources,
|
||||
}
|
||||
@@ -1,68 +0,0 @@
|
||||
local M = {}
|
||||
|
||||
M.treesitter = {
|
||||
ensure_installed = {
|
||||
"vim",
|
||||
"lua",
|
||||
"html",
|
||||
"css",
|
||||
"javascript",
|
||||
"typescript",
|
||||
"tsx",
|
||||
"c",
|
||||
"cpp",
|
||||
"rust",
|
||||
"markdown",
|
||||
"markdown_inline",
|
||||
"python"
|
||||
},
|
||||
indent = {
|
||||
enable = true,
|
||||
-- disable = {
|
||||
-- "python"
|
||||
-- },
|
||||
},
|
||||
}
|
||||
|
||||
M.mason = {
|
||||
ensure_installed = {
|
||||
-- lua stuff
|
||||
"lua-language-server",
|
||||
"stylua",
|
||||
|
||||
-- web dev stuff
|
||||
"css-lsp",
|
||||
"html-lsp",
|
||||
"typescript-language-server",
|
||||
"deno",
|
||||
"prettier",
|
||||
|
||||
-- c/cpp stuff
|
||||
"clangd",
|
||||
"clang-format",
|
||||
|
||||
-- rust
|
||||
"rust-analyzer",
|
||||
|
||||
-- python
|
||||
"pyright",
|
||||
},
|
||||
}
|
||||
|
||||
-- git support in nvimtree
|
||||
M.nvimtree = {
|
||||
git = {
|
||||
enable = true,
|
||||
},
|
||||
|
||||
renderer = {
|
||||
highlight_git = true,
|
||||
icons = {
|
||||
show = {
|
||||
git = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
return M
|
||||
@@ -1 +0,0 @@
|
||||
vim.g.dap_virtual_text = true
|
||||
@@ -1,30 +0,0 @@
|
||||
local M = {}
|
||||
|
||||
M.dap = {
|
||||
plugin = true,
|
||||
n = {
|
||||
["<leader>db"] = { "<cmd> DapToggleBreakpoint <CR>" },
|
||||
["<leader>dus"] = {
|
||||
function ()
|
||||
local widgets = require('dap.ui.widgets');
|
||||
local sidebar = widgets.sidebar(widgets.scopes);
|
||||
sidebar.open();
|
||||
end,
|
||||
"Open debugging sidebar"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
M.crates = {
|
||||
plugin = true,
|
||||
n = {
|
||||
["<leader>rcu"] = {
|
||||
function ()
|
||||
require('crates').upgrade_all_crates()
|
||||
end,
|
||||
"update crates"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return M
|
||||
@@ -1,161 +0,0 @@
|
||||
local overrides = require("custom.configs.overrides")
|
||||
|
||||
---@type NvPluginSpec[]
|
||||
local plugins = {
|
||||
-- Override plugin definition options
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
dependencies = {
|
||||
"jose-elias-alvarez/null-ls.nvim",
|
||||
config = function()
|
||||
require "custom.configs.null-ls"
|
||||
end,
|
||||
},
|
||||
config = function()
|
||||
require "plugins.configs.lspconfig"
|
||||
require "custom.configs.lspconfig"
|
||||
end,
|
||||
},
|
||||
-- override plugin configs
|
||||
{
|
||||
"williamboman/mason.nvim",
|
||||
opts = overrides.mason
|
||||
},
|
||||
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
opts = overrides.treesitter,
|
||||
},
|
||||
|
||||
{
|
||||
"nvim-tree/nvim-tree.lua",
|
||||
opts = overrides.nvimtree,
|
||||
},
|
||||
|
||||
-- Debugger
|
||||
{
|
||||
"mfussenegger/nvim-dap",
|
||||
init = function()
|
||||
require("core.utils").load_mappings("dap")
|
||||
end
|
||||
},
|
||||
|
||||
{
|
||||
"theHamsta/nvim-dap-virtual-text",
|
||||
lazy = false,
|
||||
config = function(_, opts)
|
||||
require("nvim-dap-virtual-text").setup()
|
||||
end
|
||||
},
|
||||
|
||||
-- Rust
|
||||
-- {
|
||||
-- "simrat39/rust-tools.nvim",
|
||||
-- ft = "rust",
|
||||
-- dependencies = "neovim/nvim-lspconfig",
|
||||
-- opts = function ()
|
||||
-- return require "custom.configs.rust-tools"
|
||||
-- end,
|
||||
-- config = function(_, opts)
|
||||
-- require('rust-tools').setup(opts)
|
||||
-- end
|
||||
-- },
|
||||
|
||||
-- {
|
||||
-- 'saecki/crates.nvim',
|
||||
-- ft = {"rust", "toml"},
|
||||
-- config = function(_, opts)
|
||||
-- local crates = require('crates')
|
||||
-- crates.setup(opts)
|
||||
-- require('cmp').setup.buffer({
|
||||
-- sources = { { name = "crates" }}
|
||||
-- })
|
||||
-- crates.show()
|
||||
-- require("core.utils").load_mappings("crates")
|
||||
-- end,
|
||||
-- },
|
||||
|
||||
{
|
||||
"rust-lang/rust.vim",
|
||||
ft = "rust",
|
||||
init = function ()
|
||||
vim.g.rustfmt_autosave = 1
|
||||
end
|
||||
},
|
||||
|
||||
-- Better escape (jj/jk)
|
||||
{
|
||||
"max397574/better-escape.nvim",
|
||||
event = "InsertEnter",
|
||||
config = function()
|
||||
require("better_escape").setup()
|
||||
end,
|
||||
},
|
||||
|
||||
-- Signatures plugin to show function signatures as you type them
|
||||
{
|
||||
"ray-x/lsp_signature.nvim",
|
||||
event = "BufRead",
|
||||
config = function()
|
||||
require("lsp_signature").setup {
|
||||
hint_enable = false,
|
||||
}
|
||||
end,
|
||||
},
|
||||
|
||||
-- -- Rooter plugin to change directory to the project root
|
||||
-- {
|
||||
-- "notjedi/nvim-rooter.lua",
|
||||
-- event = "UIEnter",
|
||||
-- config = function()
|
||||
-- require("nvim-rooter").setup {
|
||||
-- rooter_patterns = { "Makefile", ".git", ".hg", ".svn" },
|
||||
-- trigger_patterns = { "*" },
|
||||
-- manual = false,
|
||||
-- }
|
||||
-- end,
|
||||
-- },
|
||||
|
||||
-- Leap plugin to jump to any line in the file
|
||||
{
|
||||
"ggandor/leap.nvim",
|
||||
event = "UIEnter",
|
||||
config = function() require("leap").add_default_mappings() end,
|
||||
},
|
||||
|
||||
-- Copilot plugin to autocomplete text
|
||||
{
|
||||
"zbirenbaum/copilot.lua",
|
||||
cmd = "Copilot",
|
||||
event = "InsertEnter",
|
||||
config = function()
|
||||
require("copilot").setup {
|
||||
suggestion = { enabled = false },
|
||||
panel = { enabled = false },
|
||||
filetypes = { markdown = true },
|
||||
}
|
||||
end,
|
||||
},
|
||||
|
||||
-- Copilot CMP plugin to autocomplete text in the completion menu
|
||||
{
|
||||
"zbirenbaum/copilot-cmp",
|
||||
dependencies = "zbirenbaum/copilot.lua",
|
||||
event = "InsertEnter",
|
||||
config = function() require("copilot_cmp").setup() end,
|
||||
},
|
||||
-- {
|
||||
-- "hrsh7th/nvim-cmp",
|
||||
-- opts = function()
|
||||
-- local M = require "plugins.configs.cmp"
|
||||
-- M.completion.completeopt = "menu,menuone,noselect"
|
||||
-- M.mapping["<CR>"] = cmp.mapping.confirm {
|
||||
-- behavior = cmp.ConfirmBehavior.Insert,
|
||||
-- select = false,
|
||||
-- }
|
||||
-- table.insert(M.sources, {name = "crates"})
|
||||
-- return M
|
||||
-- end,
|
||||
-- }
|
||||
}
|
||||
return plugins
|
||||
@@ -1,3 +0,0 @@
|
||||
{
|
||||
"workspace.checkThirdParty": false
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
column_width = 200
|
||||
line_endings = "Unix"
|
||||
indent_type = "Spaces"
|
||||
indent_width = 2
|
||||
quote_style = "AutoPreferDouble"
|
||||
call_parentheses = "None"
|
||||
collapse_simple_statement = "Always"
|
||||
@@ -1,98 +0,0 @@
|
||||
return {
|
||||
-- Configure AstroNvim updates
|
||||
updater = {
|
||||
remote = "origin", -- remote to use
|
||||
channel = "stable", -- "stable" or "nightly"
|
||||
version = "latest", -- "latest", tag name, or regex search like "v1.*" to only do updates before v2 (STABLE ONLY)
|
||||
branch = "nightly", -- branch name (NIGHTLY ONLY)
|
||||
commit = nil, -- commit hash (NIGHTLY ONLY)
|
||||
pin_plugins = nil, -- nil, true, false (nil will pin plugins on stable only)
|
||||
skip_prompts = false, -- skip prompts about breaking changes
|
||||
show_changelog = true, -- show the changelog after performing an update
|
||||
auto_quit = false, -- automatically quit the current session after a successful update
|
||||
remotes = { -- easily add new remotes to track
|
||||
},
|
||||
},
|
||||
|
||||
-- Set colorscheme to use
|
||||
colorscheme = "astrodark",
|
||||
|
||||
-- Diagnostics configuration (for vim.diagnostics.config({...})) when diagnostics are on
|
||||
diagnostics = { virtual_text = true, underline = true },
|
||||
|
||||
lsp = {
|
||||
-- customize lsp formatting options
|
||||
formatting = {
|
||||
-- control auto formatting on save
|
||||
format_on_save = {
|
||||
enabled = false, -- enable or disable format on save globally
|
||||
allow_filetypes = { -- enable format on save for specified filetypes only
|
||||
-- "go",
|
||||
},
|
||||
ignore_filetypes = { -- disable format on save for specified filetypes
|
||||
-- "python",
|
||||
},
|
||||
},
|
||||
disabled = { -- disable formatting capabilities for the listed language servers
|
||||
-- disable lua_ls formatting capability if you want to use StyLua to format your lua code
|
||||
-- "lua_ls",
|
||||
},
|
||||
timeout_ms = 1000, -- default format timeout
|
||||
-- filter = function(client) -- fully override the default formatting function
|
||||
-- return true
|
||||
-- end
|
||||
},
|
||||
-- enable servers that you already have installed without mason
|
||||
servers = {
|
||||
-- "pyright"
|
||||
},
|
||||
},
|
||||
|
||||
-- Configure require("lazy").setup() options
|
||||
lazy = {
|
||||
defaults = { lazy = true },
|
||||
performance = {
|
||||
rtp = {
|
||||
-- customize default disabled vim plugins
|
||||
disabled_plugins = {
|
||||
"tohtml",
|
||||
"gzip",
|
||||
"matchit",
|
||||
"zipPlugin",
|
||||
"netrwPlugin",
|
||||
"tarPlugin",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
-- This function is run last and is a good place to configuring
|
||||
-- augroups/autocommands and custom filetypes also this just pure lua so
|
||||
-- anything that doesn't fit in the normal config locations above can go here
|
||||
polish = function()
|
||||
local rt = require "rust-tools"
|
||||
|
||||
rt.setup {
|
||||
server = {
|
||||
on_attach = function(_, bufnr)
|
||||
-- Hover actions
|
||||
vim.keymap.set("n", "<C-space>", rt.hover_actions.hover_actions, { buffer = bufnr })
|
||||
-- Code action groups
|
||||
vim.keymap.set("n", "<Leader>a", rt.code_action_group.code_action_group, { buffer = bufnr })
|
||||
end,
|
||||
},
|
||||
}
|
||||
-- Set up custom filetypes
|
||||
-- vim.filetype.add {
|
||||
-- extension = {
|
||||
-- foo = "fooscript",
|
||||
-- },
|
||||
-- filename = {
|
||||
-- ["Foofile"] = "fooscript",
|
||||
-- },
|
||||
-- pattern = {
|
||||
-- ["~/%.config/foo/.*"] = "fooscript",
|
||||
-- },
|
||||
-- }
|
||||
end,
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
return {
|
||||
capabilities = {
|
||||
offsetEncoding = "utf-16",
|
||||
},
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
return {
|
||||
settings = {
|
||||
Lua = {
|
||||
runtime = {
|
||||
-- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim)
|
||||
version = "LuaJIT",
|
||||
},
|
||||
diagnostics = {
|
||||
-- Get the language server to recognize the `vim` global
|
||||
globals = { "vim" },
|
||||
},
|
||||
workspace = {
|
||||
-- Make the server aware of Neovim runtime files
|
||||
library = vim.api.nvim_get_runtime_file("", true),
|
||||
},
|
||||
-- Do not send telemetry data containing a randomized but unique identifier
|
||||
telemetry = {
|
||||
enable = false,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -1,46 +0,0 @@
|
||||
-- Mapping data with "desc" stored directly by vim.keymap.set().
|
||||
--
|
||||
-- Please use this mappings table to set keyboard mapping since this is the
|
||||
-- lower level configuration and more robust one. (which-key will
|
||||
-- automatically pick-up stored data by this setting.)
|
||||
|
||||
return {
|
||||
-- first key is the mode
|
||||
n = {
|
||||
["<leader>bD"] = {
|
||||
function()
|
||||
require("astronvim.utils.status").heirline.buffer_picker(function(bufnr) require("astronvim.utils.buffer").close(
|
||||
bufnr) end)
|
||||
end,
|
||||
desc = "Pick to close",
|
||||
},
|
||||
|
||||
["<leader>b"] = { name = "Buffers" },
|
||||
["<tab>"] = { ":bnext<cr>", desc = "Next buffer tab" },
|
||||
|
||||
-- Open file
|
||||
["<leader><space>"] = { ":Telescope find_files search_dirs=~/<cr>", desc = "Open file" },
|
||||
["<leader><C-space>"] = { ":Telescope find_files search_dirs=~/ hidden=true<cr>", desc =
|
||||
"Open file inc. hidden files" },
|
||||
|
||||
-- Make
|
||||
["<leader>m"] = { name = "Make (Compile)" },
|
||||
["<leader>mm"] = { ":make<cr>", desc = "Make" },
|
||||
["<leader>mn"] = { ":make clean<cr>", desc = "Make clean" },
|
||||
["<leader>mr"] = { ":make run<cr>", desc = "Make run" },
|
||||
["<leader>mu"] = { ":make upload<cr>", desc = "Make upload" },
|
||||
|
||||
-- Go to source file
|
||||
["gs"] = { ":ClangdSwitchSourceHeader<cr>" },
|
||||
|
||||
-- Format code
|
||||
["<M-f>"] = { ":Format<cr>" },
|
||||
["<leader>a"] = { ":lua require'rust-tools'.hover_actions.hover_actions()<cr>" },
|
||||
-- Disable bindings
|
||||
["<leader>n"] = false,
|
||||
},
|
||||
t = {
|
||||
-- setting a mapping to false will disable it
|
||||
-- ["<esc>"] = false,
|
||||
},
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
-- set vim options here (vim.<first_key>.<second_key> = value)
|
||||
return {
|
||||
opt = {
|
||||
-- set to true or false etc.
|
||||
relativenumber = true, -- sets vim.opt.relativenumber
|
||||
number = true, -- sets vim.opt.number
|
||||
spell = false, -- sets vim.opt.spell
|
||||
signcolumn = "auto", -- sets vim.opt.signcolumn to auto
|
||||
wrap = false, -- sets vim.opt.wrap
|
||||
textwidth = 200, -- sets vim.opt.textwidth
|
||||
},
|
||||
g = {
|
||||
mapleader = " ", -- sets vim.g.mapleader
|
||||
autoformat_enabled = true, -- enable or disable auto formatting at start (lsp.formatting.format_on_save must be enabled)
|
||||
cmp_enabled = true, -- enable completion at start
|
||||
autopairs_enabled = true, -- enable autopairs at start
|
||||
diagnostics_mode = 3, -- set the visibility of diagnostics in the UI (0=off, 1=only show in status line, 2=virtual text off, 3=all on)
|
||||
icons_enabled = true, -- disable icons in the UI (disable if no nerd font is available, requires :PackerSync after changing)
|
||||
ui_notifications_enabled = true, -- disable notifications when toggling UI elements
|
||||
},
|
||||
}
|
||||
-- If you need more control, you can use the function()...end notation
|
||||
-- return function(local_vim)
|
||||
-- local_vim.opt.relativenumber = true
|
||||
-- local_vim.g.mapleader = " "
|
||||
-- local_vim.opt.whichwrap = vim.opt.whichwrap - { 'b', 's' } -- removing option from list
|
||||
-- local_vim.opt.shortmess = vim.opt.shortmess + { I = true } -- add to option list
|
||||
--
|
||||
-- return local_vim
|
||||
-- end
|
||||
@@ -1,27 +0,0 @@
|
||||
return {
|
||||
"AstroNvim/astrotheme",
|
||||
config = function()
|
||||
require("astrotheme").setup {
|
||||
|
||||
palettes = {
|
||||
astrodark = {
|
||||
-- Extend or modify astrodarks palette colors
|
||||
base = "#1e1e1e",
|
||||
mantle = "#181818",
|
||||
crust = "#1f1f1f",
|
||||
surface0 = "#252525",
|
||||
surface1 = "#3e3e3e",
|
||||
overlay1 = "#2c2c2c",
|
||||
overlay2 = "#282828",
|
||||
subtext0 = "#4b4b4b",
|
||||
subtext1 = "#777777",
|
||||
text = "#ababab",
|
||||
},
|
||||
},
|
||||
|
||||
highlights = {
|
||||
astrodark = {},
|
||||
},
|
||||
}
|
||||
end,
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
return {
|
||||
"hrsh7th/nvim-cmp",
|
||||
-- override the options table that is used in the `require("cmp").setup()` call
|
||||
opts = function(_, opts)
|
||||
-- opts parameter is the default options table
|
||||
-- the function is lazy loaded so cmp is able to be required
|
||||
local cmp = require "cmp"
|
||||
-- modify the sources part of the options table
|
||||
opts.sources = cmp.config.sources {
|
||||
{ name = "nvim_lsp", priority = 1000 },
|
||||
{ name = "luasnip", priority = 750 },
|
||||
{ name = "buffer", priority = 500 },
|
||||
{ name = "path", priority = 250 },
|
||||
{ name = "copilot", priority = 100 },
|
||||
}
|
||||
|
||||
-- return the new table to be used
|
||||
return opts
|
||||
end,
|
||||
} -- override nvim-cmp plugin
|
||||
@@ -1,9 +0,0 @@
|
||||
return {
|
||||
-- Add the community repository of plugin specifications
|
||||
-- "AstroNvim/astrocommunity",
|
||||
-- example of imporing a plugin, comment out to use it or add your own
|
||||
-- available plugins can be found at https://github.com/AstroNvim/astrocommunity
|
||||
|
||||
-- { import = "astrocommunity.colorscheme.catppuccin" },
|
||||
-- { import = "astrocommunity.completion.copilot-lua-cmp" },
|
||||
}
|
||||
@@ -1,82 +0,0 @@
|
||||
return {
|
||||
-- customize alpha options
|
||||
{
|
||||
"goolord/alpha-nvim",
|
||||
opts = function(_, opts)
|
||||
-- customize the dashboard header
|
||||
opts.section.header.val = {
|
||||
" =======================================================================================================",
|
||||
" -------------------------------------------------------------------------------------------------------",
|
||||
" ---████████████████████-----███████████-------███████████-----████████████--████████████-████████████--",
|
||||
" --█████████████████████----█████████████-----█████████████---- -- - ---",
|
||||
" --██████ ██---█████ ███-----███ █████---------██-------████████-----█-------------",
|
||||
" -- -------------- --- ----- --- ----- ---------██-------█------------█-------------",
|
||||
" --█████--------------------█████------████-████------█████---------██-------███████████--████████████--",
|
||||
" -- -------------------- ------ ------ --------- ------- -- --",
|
||||
" --█████--------------------█████--------█████--------█████---------------------------------------------",
|
||||
" -- -------------------- -------- -------- ---------------------------------------------",
|
||||
" --██████--------------██---█████---------------------█████------------- (Neo)vim coding IDE -----------",
|
||||
" --█████████████████████ ---█████---------------------█████---------------------------------------------",
|
||||
" ---███████████████████ ----█████---------------------█████---------------------------------------------",
|
||||
" --- ----- --------------------- ---------------------------------------------",
|
||||
" -------------------------------------------------------------------------------------------------------",
|
||||
" =======================================================================================================",
|
||||
}
|
||||
opts.section.header.opts.hl = "String"
|
||||
end,
|
||||
},
|
||||
-- You can disable default plugins as follows:
|
||||
-- { "max397574/better-escape.nvim", enabled = false },
|
||||
--
|
||||
-- You can also easily customize additional setup of plugins that is outside of the plugin's setup call
|
||||
-- {
|
||||
-- "L3MON4D3/LuaSnip",
|
||||
-- config = function(plugin, opts)
|
||||
-- require "plugins.configs.luasnip"(plugin, opts) -- include the default astronvim config that calls the setup call
|
||||
-- -- add more custom luasnip configuration such as filetype extend or custom snippets
|
||||
-- local luasnip = require "luasnip"
|
||||
-- luasnip.filetype_extend("javascript", { "javascriptreact" })
|
||||
-- end,
|
||||
-- },
|
||||
-- {
|
||||
-- "windwp/nvim-autopairs",
|
||||
-- config = function(plugin, opts)
|
||||
-- require "plugins.configs.nvim-autopairs"(plugin, opts) -- include the default astronvim config that calls the setup call
|
||||
-- -- add more custom autopairs configuration such as custom rules
|
||||
-- local npairs = require "nvim-autopairs"
|
||||
-- local Rule = require "nvim-autopairs.rule"
|
||||
-- local cond = require "nvim-autopairs.conds"
|
||||
-- npairs.add_rules(
|
||||
-- {
|
||||
-- Rule("$", "$", { "tex", "latex" })
|
||||
-- -- don't add a pair if the next character is %
|
||||
-- :with_pair(cond.not_after_regex "%%")
|
||||
-- -- don't add a pair if the previous character is xxx
|
||||
-- :with_pair(
|
||||
-- cond.not_before_regex("xxx", 3)
|
||||
-- )
|
||||
-- -- don't move right when repeat character
|
||||
-- :with_move(cond.none())
|
||||
-- -- don't delete if the next character is xx
|
||||
-- :with_del(cond.not_after_regex "xx")
|
||||
-- -- disable adding a newline when you press <cr>
|
||||
-- :with_cr(cond.none()),
|
||||
-- },
|
||||
-- -- disable for .vim files, but it work for another filetypes
|
||||
-- Rule("a", "a", "-vim")
|
||||
-- )
|
||||
-- end,
|
||||
-- },
|
||||
-- By adding to the which-key config and using our helper function you can add more which-key registered bindings
|
||||
-- {
|
||||
-- "folke/which-key.nvim",
|
||||
-- config = function(plugin, opts)
|
||||
-- require "plugins.configs.which-key"(plugin, opts) -- include the default astronvim config that calls the setup call
|
||||
-- -- Add bindings which show up as group name
|
||||
-- local wk = require "which-key"
|
||||
-- wk.register({
|
||||
-- b = { name = "Buffer" },
|
||||
-- }, { mode = "n", prefix = "<leader>" })
|
||||
-- end,
|
||||
-- },
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
return {
|
||||
"onsails/lspkind.nvim",
|
||||
opts = {
|
||||
mode = "symbol",
|
||||
symbol_map = {
|
||||
NONE = "",
|
||||
Array = "",
|
||||
Boolean = "⊨",
|
||||
Class = "",
|
||||
Constructor = "",
|
||||
Key = "",
|
||||
Namespace = "",
|
||||
Null = "NULL",
|
||||
Number = "#",
|
||||
Object = "⦿",
|
||||
Package = "",
|
||||
Property = "",
|
||||
Reference = "",
|
||||
Snippet = "",
|
||||
String = "𝓐",
|
||||
TypeParameter = "",
|
||||
Unit = "",
|
||||
Copilot = "",
|
||||
},
|
||||
},
|
||||
vim.api.nvim_set_hl(0, "CmpItemKindCopilot", {fg ="#6CC644"})
|
||||
}
|
||||
@@ -1,50 +0,0 @@
|
||||
-- customize mason plugins
|
||||
return {
|
||||
-- use mason-lspconfig to configure LSP installations
|
||||
{
|
||||
"williamboman/mason-lspconfig.nvim",
|
||||
-- overrides `require("mason-lspconfig").setup(...)`
|
||||
opts = function(_, opts)
|
||||
-- add more things to the ensure_installed table protecting against community packs modifying it
|
||||
opts.ensure_installed = require("astronvim.utils").list_insert_unique(opts.ensure_installed, {
|
||||
"lua_ls",
|
||||
"pyright",
|
||||
"cssls",
|
||||
"html",
|
||||
"jsonls",
|
||||
"clangd",
|
||||
"marksman",
|
||||
"bashls",
|
||||
"dockerls",
|
||||
"openscad_lsp",
|
||||
})
|
||||
end,
|
||||
},
|
||||
-- use mason-null-ls to configure Formatters/Linter installation for null-ls sources
|
||||
{
|
||||
"jay-babu/mason-null-ls.nvim",
|
||||
-- overrides `require("mason-null-ls").setup(...)`
|
||||
opts = function(_, opts)
|
||||
-- add more things to the ensure_installed table protecting against community packs modifying it
|
||||
opts.ensure_installed = require("astronvim.utils").list_insert_unique(opts.ensure_installed, {
|
||||
"prettier",
|
||||
"clang-format",
|
||||
"black",
|
||||
"flake8",
|
||||
"markdownlint",
|
||||
"beautysh",
|
||||
"stylua",
|
||||
})
|
||||
end,
|
||||
},
|
||||
{
|
||||
"jay-babu/mason-nvim-dap.nvim",
|
||||
-- overrides `require("mason-nvim-dap").setup(...)`
|
||||
opts = function(_, opts)
|
||||
-- add more things to the ensure_installed table protecting against community packs modifying it
|
||||
opts.ensure_installed = require("astronvim.utils").list_insert_unique(opts.ensure_installed, {
|
||||
-- "python",
|
||||
})
|
||||
end,
|
||||
},
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
return {
|
||||
"jose-elias-alvarez/null-ls.nvim",
|
||||
opts = function(_, config)
|
||||
-- config variable is the default configuration table for the setup function call
|
||||
-- local null_ls = require "null-ls"
|
||||
|
||||
-- Check supported formatters and linters
|
||||
-- https://github.com/jose-elias-alvarez/null-ls.nvim/tree/main/lua/null-ls/builtins/formatting
|
||||
-- https://github.com/jose-elias-alvarez/null-ls.nvim/tree/main/lua/null-ls/builtins/diagnostics
|
||||
config.sources = {
|
||||
-- Set a formatter
|
||||
-- null_ls.builtins.formatting.stylua,
|
||||
-- null_ls.builtins.formatting.prettier,
|
||||
}
|
||||
return config -- return final config table
|
||||
end,
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
return {
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
opts = function(_, opts)
|
||||
-- add more things to the ensure_installed table protecting against community packs modifying it
|
||||
opts.ensure_installed = require("astronvim.utils").list_insert_unique(opts.ensure_installed, {
|
||||
"lua",
|
||||
"c",
|
||||
"vim",
|
||||
"bash",
|
||||
"json",
|
||||
"yaml",
|
||||
"html",
|
||||
"css",
|
||||
"javascript",
|
||||
"typescript",
|
||||
"python",
|
||||
"dockerfile",
|
||||
"cpp",
|
||||
"rust",
|
||||
})
|
||||
end,
|
||||
}
|
||||
@@ -1,54 +0,0 @@
|
||||
return {
|
||||
-- Signatures plugin to show function signatures as you type them
|
||||
{
|
||||
"ray-x/lsp_signature.nvim",
|
||||
event = "BufRead",
|
||||
config = function()
|
||||
require("lsp_signature").setup {
|
||||
hint_enable = false,
|
||||
}
|
||||
end,
|
||||
},
|
||||
|
||||
-- Rooter plugin to change directory to the project root
|
||||
{
|
||||
"notjedi/nvim-rooter.lua",
|
||||
event = "UIEnter",
|
||||
config = function()
|
||||
require("nvim-rooter").setup {
|
||||
rooter_patterns = { "Makefile", ".git", ".hg", ".svn" },
|
||||
trigger_patterns = { "*" },
|
||||
manual = false,
|
||||
}
|
||||
end,
|
||||
},
|
||||
|
||||
-- Leap plugin to jump to any line in the file
|
||||
{
|
||||
"ggandor/leap.nvim",
|
||||
event = "UIEnter",
|
||||
config = function() require("leap").add_default_mappings() end,
|
||||
},
|
||||
|
||||
-- Copilot plugin to autocomplete text
|
||||
{
|
||||
"zbirenbaum/copilot.lua",
|
||||
cmd = "Copilot",
|
||||
event = "InsertEnter",
|
||||
config = function()
|
||||
require("copilot").setup {
|
||||
suggestion = { enabled = false },
|
||||
panel = { enabled = false },
|
||||
filetypes = { markdown = true },
|
||||
}
|
||||
end,
|
||||
},
|
||||
|
||||
-- Copilot CMP plugin to autocomplete text in the completion menu
|
||||
{
|
||||
"zbirenbaum/copilot-cmp",
|
||||
event = "InsertEnter",
|
||||
config = function() require("copilot_cmp").setup() end,
|
||||
},
|
||||
'simrat39/rust-tools.nvim'
|
||||
}
|
||||
Reference in New Issue
Block a user