add config folder
This commit is contained in:
10
.config/nvim/after/plugin/colors.lua
Normal file
10
.config/nvim/after/plugin/colors.lua
Normal file
@@ -0,0 +1,10 @@
|
||||
function ColorMyNVim(color)
|
||||
color = color or "gruvbox"
|
||||
vim.cmd.colorscheme(color)
|
||||
|
||||
vim.api.nvim_set_hl(0, "Normal", { bg = "none" })
|
||||
vim.api.nvim_set_hl(0, "NormalFloat", { bg = "none" })
|
||||
|
||||
end
|
||||
|
||||
ColorMyNVim()
|
||||
8
.config/nvim/after/plugin/comment.lua
Normal file
8
.config/nvim/after/plugin/comment.lua
Normal file
@@ -0,0 +1,8 @@
|
||||
require("ts_context_commentstring").setup({
|
||||
enable_autocmd = false,
|
||||
})
|
||||
require('Comment').setup({
|
||||
ignore = '^$', -- Ignore empty lines
|
||||
pre_hook = require("ts_context_commentstring.integrations.comment_nvim").create_pre_hook(),
|
||||
})
|
||||
|
||||
1
.config/nvim/after/plugin/fugitive.lua
Normal file
1
.config/nvim/after/plugin/fugitive.lua
Normal file
@@ -0,0 +1 @@
|
||||
vim.keymap.set("n", "<leader>gs", vim.cmd.Git)
|
||||
3
.config/nvim/after/plugin/gitgutter.lua
Normal file
3
.config/nvim/after/plugin/gitgutter.lua
Normal file
@@ -0,0 +1,3 @@
|
||||
vim.keymap.set("n", "<leader>hs", "<cmd>GitGutterStageHunk<cr>")
|
||||
vim.keymap.set("n", "<leader>hu", "<cmd>GitGutterUndoHunk<cr>")
|
||||
vim.keymap.set("n", "<leader>hp", "<cmd>GitGutterPreviewHunk<cr>")
|
||||
10
.config/nvim/after/plugin/harpoon.lua
Normal file
10
.config/nvim/after/plugin/harpoon.lua
Normal file
@@ -0,0 +1,10 @@
|
||||
local mark = require("harpoon.mark")
|
||||
local ui = require("harpoon.ui")
|
||||
|
||||
vim.keymap.set("n", "<leader>a", mark.add_file)
|
||||
vim.keymap.set("n", "<C-e>", ui.toggle_quick_menu)
|
||||
|
||||
vim.keymap.set("n", "<C-a>", function() ui.nav_file(1) end)
|
||||
vim.keymap.set("n", "<C-z>", function() ui.nav_file(2) end)
|
||||
vim.keymap.set("n", "<C-q>", function() ui.nav_file(3) end)
|
||||
vim.keymap.set("n", "<C-s>", function() ui.nav_file(4) end)
|
||||
14
.config/nvim/after/plugin/indent-blankline.lua
Normal file
14
.config/nvim/after/plugin/indent-blankline.lua
Normal file
@@ -0,0 +1,14 @@
|
||||
vim.api.nvim_set_hl(0, "IndentBlanklineContextChar", { fg = "#d79921", bg = "none"})
|
||||
|
||||
require("ibl").setup({
|
||||
indent = { char = " "},
|
||||
whitespace = { },
|
||||
scope = { char = "▎",
|
||||
highlight = "IndentBlanklineContextChar",
|
||||
show_start = false,
|
||||
show_end = false,
|
||||
include = { node_type = { python = { "if_statement",
|
||||
"for_statement",
|
||||
"with_statement", } } },
|
||||
},
|
||||
})
|
||||
156
.config/nvim/after/plugin/lsp.lua
Normal file
156
.config/nvim/after/plugin/lsp.lua
Normal file
@@ -0,0 +1,156 @@
|
||||
local map_lsp_keybinds = require('config.remap').map_lsp_keybinds -- Has to load keymaps before pluginslsp
|
||||
|
||||
-- Use neodev to configure lua_ls in nvim directories - must load before lspconfig
|
||||
require("neodev").setup()
|
||||
|
||||
require("fidget").setup({
|
||||
notification = {
|
||||
redirect = -- Conditionally redirect notifications to another backend
|
||||
function(msg, level, opts)
|
||||
if opts and opts.on_open then
|
||||
return require("fidget.integration.nvim-notify").delegate(msg, level, opts)
|
||||
end
|
||||
end,
|
||||
},
|
||||
})
|
||||
|
||||
require('mason').setup({})
|
||||
require('mason-lspconfig').setup({
|
||||
ensure_installed = {'bashls', 'clangd', 'fortls', 'julials', 'marksman', 'pylsp', 'rust_analyzer', 'texlab'},
|
||||
})
|
||||
|
||||
local cmp = require('cmp')
|
||||
local cmp_select = {behavior = cmp.SelectBehavior.Select}
|
||||
|
||||
local servers = {
|
||||
bashls = {},
|
||||
clangd = {},
|
||||
fortls = {},
|
||||
julials = {},
|
||||
marksman = {},
|
||||
pylsp = {
|
||||
settings = {
|
||||
pylsp = {
|
||||
plugins = {
|
||||
pycodestyle = {
|
||||
ignore = {},
|
||||
maxLineLength = 160,
|
||||
},
|
||||
ruff = {
|
||||
enabled = true, -- Enable the plugin
|
||||
executable = "<path-to-ruff-bin>", -- Custom path to ruff
|
||||
config = "<path_to_custom_ruff_toml>", -- Custom config for ruff to use
|
||||
extendSelect = { "I" }, -- Rules that are additionally used by ruff
|
||||
extendIgnore = { "C90" }, -- Rules that are additionally ignored by ruff
|
||||
format = { "I" }, -- Rules that are marked as fixable by ruff that should be fixed when running textDocument/formatting
|
||||
severities = { ["D212"] = "I" }, -- Optional table of rules where a custom severity is desired
|
||||
unsafeFixes = false, -- Whether or not to offer unsafe fixes as code actions. Ignored with the "Fix All" action
|
||||
|
||||
-- Rules that are ignored when a pyproject.toml or ruff.toml is present:
|
||||
lineLength = 80, -- Line length to pass to ruff checking and formatting
|
||||
exclude = { "__about__.py" }, -- Files to be excluded by ruff checking
|
||||
select = { "F" }, -- Rules to be enabled by ruff
|
||||
ignore = { "D210" }, -- Rules to be ignored by ruff
|
||||
perFileIgnores = { ["__init__.py"] = "CPY001" }, -- Rules that should be ignored for specific files
|
||||
preview = false, -- Whether to enable the preview style linting and formatting.
|
||||
targetVersion = "py310", -- The minimum python version to target (applies for both linting and formatting).
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
rust_analyzer = {},
|
||||
texlab = {},
|
||||
}
|
||||
|
||||
-- Default handlers for LSP
|
||||
local default_handlers = {
|
||||
["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, { border = "rounded" }),
|
||||
["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, { border = "rounded" }),
|
||||
}
|
||||
|
||||
-- this is the function that loads the extra snippets to luasnip
|
||||
-- from rafamadriz/friendly-snippets
|
||||
require('luasnip.loaders.from_vscode').lazy_load()
|
||||
|
||||
cmp.setup({
|
||||
-- No preselection
|
||||
preselect = 'None',
|
||||
|
||||
sources = {
|
||||
{name = 'nvim_lsp'}, -- lsp
|
||||
{name = 'buffer', max_item_count = 5}, -- Text within current buffer
|
||||
{name = 'luasnip', max_item_count = 3}, -- Snippets
|
||||
{name = 'path', max_item_count = 3}, -- File system paths
|
||||
},
|
||||
|
||||
formatting = {
|
||||
expandable_indicator = true,
|
||||
},
|
||||
|
||||
experimental = {
|
||||
ghost_text = true,
|
||||
},
|
||||
|
||||
mapping = cmp.mapping.preset.insert({
|
||||
['<C-p>'] = cmp.mapping.select_prev_item(cmp_select),
|
||||
['<C-n>'] = cmp.mapping.select_next_item(cmp_select),
|
||||
['<C-y>'] = cmp.mapping.confirm({ select = true }),
|
||||
['<C-Space>'] = cmp.mapping.complete(),
|
||||
}),
|
||||
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
local ls = require("luasnip")
|
||||
if not ls then
|
||||
return
|
||||
end
|
||||
ls.lsp_expand(args.body)
|
||||
end,
|
||||
},
|
||||
|
||||
})
|
||||
|
||||
-- nvim-cmp supports additional completion capabilities
|
||||
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||
local default_capabilities = require("cmp_nvim_lsp").default_capabilities(capabilities)
|
||||
|
||||
local on_attach = function(_client, buffer_number)
|
||||
-- Pass the current buffer to map lsp keybinds
|
||||
map_lsp_keybinds(buffer_number)
|
||||
|
||||
-- Create a command `:Format` local to the LSP buffer
|
||||
vim.api.nvim_buf_create_user_command(buffer_number, "Format", function(_)
|
||||
vim.lsp.buf.format({
|
||||
filter = function(format_client)
|
||||
-- Use Prettier to format TS/JS if it's available
|
||||
return format_client.name ~= "tsserver" or not null_ls.is_registered("prettier")
|
||||
end,
|
||||
})
|
||||
end, { desc = "LSP: Format current buffer with LSP" })
|
||||
end
|
||||
|
||||
-- Iterate over our servers and set them up
|
||||
for name, config in pairs(servers) do
|
||||
require("lspconfig")[name].setup({
|
||||
capabilities = default_capabilities,
|
||||
filetypes = config.filetypes,
|
||||
handlers = vim.tbl_deep_extend("force", {}, default_handlers, config.handlers or {}),
|
||||
on_attach = on_attach,
|
||||
settings = config.settings,
|
||||
})
|
||||
end
|
||||
|
||||
vim.diagnostic.config({
|
||||
-- update_in_insert = true,
|
||||
virtual_text = true,
|
||||
underline = false,
|
||||
float = {
|
||||
focusable = false,
|
||||
style = "minimal",
|
||||
border = "rounded",
|
||||
source = "always",
|
||||
header = "",
|
||||
prefix = "",
|
||||
},
|
||||
})
|
||||
6
.config/nvim/after/plugin/telescope.lua
Normal file
6
.config/nvim/after/plugin/telescope.lua
Normal file
@@ -0,0 +1,6 @@
|
||||
local builtin = require('telescope.builtin')
|
||||
vim.keymap.set('n', '<leader>pf', builtin.find_files, {})
|
||||
vim.keymap.set('n', '<C-p>', builtin.git_files, {})
|
||||
vim.keymap.set('n', '<leader>ps', function()
|
||||
builtin.grep_string({ search = vim.fn.input("Grep > ") });
|
||||
end)
|
||||
56
.config/nvim/after/plugin/treesitter.lua
Normal file
56
.config/nvim/after/plugin/treesitter.lua
Normal file
@@ -0,0 +1,56 @@
|
||||
require'nvim-treesitter.configs'.setup {
|
||||
-- A list of parser names, or "all" (the five listed parsers should always be installed)
|
||||
ensure_installed = { "bash", "c", "cpp", "cuda", "latex", "lua", "markdown", "rust", "vim", "vimdoc" },
|
||||
|
||||
-- Install parsers synchronously (only applied to `ensure_installed`)
|
||||
sync_install = false,
|
||||
|
||||
-- Automatically install missing parsers when entering buffer
|
||||
-- Recommendation: set to false if you don't have `tree-sitter` CLI installed locally
|
||||
auto_install = true,
|
||||
|
||||
---- If you need to change the installation directory of the parsers (see -> Advanced Setup)
|
||||
-- parser_install_dir = "/some/path/to/store/parsers", -- Remember to run vim.opt.runtimepath:append("/some/path/to/store/parsers")!
|
||||
|
||||
highlight = {
|
||||
enable = true,
|
||||
|
||||
-- Setting this to true will run `:h syntax` and tree-sitter at the same time.
|
||||
-- Set this to `true` if you depend on 'syntax' being enabled (like for indentation).
|
||||
-- Using this option may slow down your editor, and you may see some duplicate highlights.
|
||||
-- Instead of true it can also be a list of languages
|
||||
additional_vim_regex_highlighting = false,
|
||||
},
|
||||
}
|
||||
local vim = vim
|
||||
local opt = vim.opt
|
||||
local api = vim.api
|
||||
local M = {}
|
||||
|
||||
opt.foldmethod = "expr"
|
||||
opt.foldexpr = "nvim_treesitter#foldexpr()"
|
||||
|
||||
-- function to create a list of commands and convert them to autocommands
|
||||
-------- This function is taken from https://github.com/norcalli/nvim_utils
|
||||
function M.nvim_create_augroups(definitions)
|
||||
for group_name, definition in pairs(definitions) do
|
||||
api.nvim_command('augroup '..group_name)
|
||||
api.nvim_command('autocmd!')
|
||||
for _, def in ipairs(definition) do
|
||||
local command = table.concat(vim.tbl_flatten{'autocmd', def}, ' ')
|
||||
api.nvim_command(command)
|
||||
end
|
||||
api.nvim_command('augroup END')
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
local autoCommands = {
|
||||
-- other autocommands
|
||||
open_folds = {
|
||||
{"BufReadPost,FileReadPost", "*", "normal zR"}
|
||||
}
|
||||
}
|
||||
|
||||
M.nvim_create_augroups(autoCommands)
|
||||
|
||||
1
.config/nvim/after/plugin/undotree.lua
Normal file
1
.config/nvim/after/plugin/undotree.lua
Normal file
@@ -0,0 +1 @@
|
||||
vim.keymap.set("n", "<leader>u", vim.cmd.UndotreeToggle)
|
||||
Reference in New Issue
Block a user