Switch to a multihost/home-manager setup
This commit is contained in:
@@ -0,0 +1,266 @@
|
||||
-- Options
|
||||
local o = vim.opt
|
||||
vim.g.mapleader = " "
|
||||
vim.g.loaded_perl_provider = 0
|
||||
vim.g.loaded_ruby_provider = 0
|
||||
vim.g.clipboard = 'osc52'
|
||||
o.number = true
|
||||
o.expandtab = true
|
||||
o.shiftwidth = 2
|
||||
o.tabstop = 4
|
||||
o.softtabstop = 4
|
||||
o.completeopt = { "menuone", "noselect", "noinsert" }
|
||||
o.updatetime = 100
|
||||
o.timeoutlen = 300
|
||||
o.clipboard = "unnamedplus"
|
||||
o.foldenable = false
|
||||
o.list = true
|
||||
o.listchars = {
|
||||
tab = "→ ",
|
||||
eol = " ",
|
||||
space = " ",
|
||||
nbsp = "␣",
|
||||
trail = "·",
|
||||
lead = "·",
|
||||
}
|
||||
o.scroll = 5
|
||||
o.smoothscroll = true
|
||||
o.termguicolors = true
|
||||
o.laststatus = 3
|
||||
o.mousescroll = "ver:0,hor:0"
|
||||
|
||||
vim.lsp.semantic_tokens.enable = false
|
||||
|
||||
vim.lsp.handlers.hover = function(_, result, ctx, config)
|
||||
config = config or {}
|
||||
config.border = "rounded"
|
||||
return vim.lsp.handlers.hover(_, result, ctx, config)
|
||||
end
|
||||
|
||||
vim.lsp.handlers.signature_help = function(_, result, ctx, config)
|
||||
config = config or {}
|
||||
config.border = "rounded"
|
||||
return vim.lsp.handlers.signature_help(_, result, ctx, config)
|
||||
end
|
||||
|
||||
vim.g.rainbow_delimiters = {
|
||||
highlight = {
|
||||
"RainbowDelimiterYellow",
|
||||
"RainbowDelimiterBlue",
|
||||
"RainbowDelimiterOrange",
|
||||
"RainbowDelimiterGreen",
|
||||
"RainbowDelimiterViolet",
|
||||
"RainbowDelimiterCyan",
|
||||
"RainbowDelimiterRed",
|
||||
},
|
||||
}
|
||||
|
||||
vim.diagnostic.config({
|
||||
virtual_text = true,
|
||||
signs = {
|
||||
text = {
|
||||
[vim.diagnostic.severity.ERROR] = " ",
|
||||
[vim.diagnostic.severity.WARN] = " ",
|
||||
[vim.diagnostic.severity.INFO] = " ",
|
||||
[vim.diagnostic.severity.HINT] = " ",
|
||||
},
|
||||
},
|
||||
underline = true,
|
||||
update_in_insert = true,
|
||||
severity_sort = true,
|
||||
})
|
||||
|
||||
-- LSP config
|
||||
local capabilities = require("cmp_nvim_lsp").default_capabilities()
|
||||
|
||||
require("lspconfig").lua_ls.setup({
|
||||
capabilities = capabilities,
|
||||
})
|
||||
|
||||
require("lspconfig").clangd.setup({
|
||||
capabilities = capabilities,
|
||||
})
|
||||
|
||||
-- Plugins
|
||||
require("picvim").setup({})
|
||||
|
||||
require("notify").setup({})
|
||||
|
||||
require("gitsigns").setup({})
|
||||
|
||||
require("mini.pairs").setup({})
|
||||
|
||||
require("rainbow-delimiters.setup").setup({})
|
||||
|
||||
require("neo-tree").setup({
|
||||
filesystem = {
|
||||
filtered_items = {
|
||||
visible = true,
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
require("lualine").setup({
|
||||
options = {
|
||||
theme = "auto",
|
||||
},
|
||||
sections = {
|
||||
lualine_b = {
|
||||
{ "branch" },
|
||||
{
|
||||
"diff",
|
||||
symbols = {
|
||||
added = " ",
|
||||
modified = " ",
|
||||
removed = " ",
|
||||
},
|
||||
diff_color = {
|
||||
added = { fg = "#a6e3a1" },
|
||||
modified = { fg = "#f9e2af" },
|
||||
removed = { fg = "#f38ca8" },
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
require("nvim-treesitter.configs").setup({
|
||||
highlight = {
|
||||
enable = true,
|
||||
},
|
||||
})
|
||||
|
||||
require("nvim-cursorline").setup({
|
||||
cursorline = {
|
||||
enable = true,
|
||||
timeout = 0,
|
||||
number = false,
|
||||
},
|
||||
cursorword = {
|
||||
enable = true,
|
||||
min_length = 1,
|
||||
hl = {
|
||||
underline = true,
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
require("conform").setup({
|
||||
formatters_by_ft = {
|
||||
lua = { "stylua" },
|
||||
},
|
||||
|
||||
format_on_save = {
|
||||
timeout_ms = 500,
|
||||
lsp_fallback = true,
|
||||
},
|
||||
})
|
||||
|
||||
local cmp = require("cmp")
|
||||
cmp.setup({
|
||||
window = {
|
||||
completion = cmp.config.window.bordered({
|
||||
border = "rounded",
|
||||
}),
|
||||
documentation = cmp.config.window.bordered({
|
||||
border = "rounded",
|
||||
}),
|
||||
},
|
||||
mapping = cmp.mapping.preset.insert({
|
||||
["<CR>"] = cmp.mapping.confirm({
|
||||
select = true,
|
||||
}),
|
||||
["<Tab>"] = cmp.mapping.select_next_item(),
|
||||
["<S-Tab>"] = cmp.mapping.select_prev_item(),
|
||||
}),
|
||||
sources = {
|
||||
{
|
||||
name = "nvim_lsp",
|
||||
},
|
||||
{
|
||||
name = "clangd",
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
local neoscroll = require("neoscroll")
|
||||
neoscroll.setup({
|
||||
mappings = {
|
||||
"<C-u>",
|
||||
"<C-d>",
|
||||
"<C-b>",
|
||||
"<C-f>",
|
||||
"<C-y>",
|
||||
"<C-e>",
|
||||
"zt",
|
||||
"zz",
|
||||
"zb",
|
||||
},
|
||||
})
|
||||
|
||||
-- Keymaps
|
||||
local map = vim.keymap.set
|
||||
map({ "n", "i", "v" }, "<C-s>", "<cmd>w<CR>")
|
||||
map("n", ";", ":")
|
||||
map("n", "<A-Up>", ":move-2<CR>")
|
||||
map("n", "<A-Down>", ":move+1<CR>")
|
||||
map("x", "<A-Up>", ":move '<-2<CR>gv")
|
||||
map("x", "<A-Down>", ":move '>+1<CR>gv")
|
||||
map("i", "<A-Up>", "<C-o>:move-2<CR>")
|
||||
map("i", "<A-Down>", "<C-o>:move+1<CR>")
|
||||
map("n", ">", ">>")
|
||||
map("v", ">", ">gv")
|
||||
map("n", "<", "<<")
|
||||
map("v", "<", "<gv")
|
||||
map("n", ".", ">>")
|
||||
map("v", ".", ">gv")
|
||||
map("n", ",", "<<")
|
||||
map("v", ",", "<gv")
|
||||
map("n", "<Esc>", "<cmd>nohlsearch<CR><Esc>")
|
||||
map("n", "u", "ggVG")
|
||||
map("n", "z", "<cmd>u<CR>")
|
||||
map("n", "d", "<cmd>red<CR>")
|
||||
map("n", "q", "<cmd>Neotree<CR>")
|
||||
map("n", "<A-a>", "<cmd>Minuet virtualtext toggle<CR>")
|
||||
map("x", "p", '"_dP')
|
||||
map("x", "P", '"_dP')
|
||||
map("n", "\\", function()
|
||||
vim.cmd([[
|
||||
Neotree close
|
||||
mksession! p.vim
|
||||
echo "saved session"
|
||||
]])
|
||||
end)
|
||||
map("n", "<ScrollWheelUp>", function()
|
||||
neoscroll.scroll(-0.05, { move_cursor = false, duration = 20 })
|
||||
end)
|
||||
map("n", "<ScrollWheelDown>", function()
|
||||
neoscroll.scroll(0.05, { move_cursor = false, duration = 20 })
|
||||
end)
|
||||
map("n", "<C-Up>", function()
|
||||
neoscroll.scroll(-0.1, { move_cursor = false, duration = 50 })
|
||||
end)
|
||||
map("n", "<C-Down>", function()
|
||||
neoscroll.scroll(0.1, { move_cursor = false, duration = 50 })
|
||||
end)
|
||||
|
||||
|
||||
-- Vimscript stuff
|
||||
vim.cmd([[
|
||||
aunmenu PopUp
|
||||
colorscheme tokyonight-night
|
||||
]])
|
||||
|
||||
-- AutoCMD's
|
||||
|
||||
local autocmd = vim.api.nvim_create_autocmd
|
||||
|
||||
autocmd("CursorHold", {
|
||||
callback = function()
|
||||
vim.diagnostic.open_float(nil, {
|
||||
focusable = false,
|
||||
border = "rounded",
|
||||
source = "if_many",
|
||||
})
|
||||
end,
|
||||
})
|
||||
Reference in New Issue
Block a user