186 lines
4.7 KiB
Lua
186 lines
4.7 KiB
Lua
-- general options
|
|
local opt = vim.opt
|
|
vim.g.mapleader = " "
|
|
vim.g.maplocalleader = "\\"
|
|
opt.number = true
|
|
opt.relativenumber = true
|
|
|
|
opt.cursorline = true
|
|
opt.termguicolors = true
|
|
opt.winborder = "rounded"
|
|
opt.signcolumn = "yes"
|
|
vim.lsp.inlay_hint.enable = true
|
|
opt.tabstop = 8
|
|
vim.opt.expandtab = true
|
|
vim.g.tinted_background_transparent = 0
|
|
opt.swapfile = false
|
|
|
|
opt.shiftwidth = 8
|
|
vim.diagnostic.config({
|
|
virtual_text = {
|
|
spacing = 4,
|
|
source = true,
|
|
},
|
|
})
|
|
-- add plugins
|
|
vim.pack.add({
|
|
"https://github.com/folke/snacks.nvim",
|
|
"https://github.com/nvim-lualine/lualine.nvim",
|
|
"https://github.com/RRethy/base16-nvim",
|
|
"https://github.com/akinsho/bufferline.nvim",
|
|
"https://github.com/nvimdev/lspsaga.nvim",
|
|
"https://github.com/neovim/nvim-lspconfig",
|
|
"https://github.com/nvim-treesitter/nvim-treesitter",
|
|
"https://github.com/vyfor/cord.nvim",
|
|
"https://github.com/mason-org/mason-lspconfig.nvim.git",
|
|
"https://github.com/mason-org/mason.nvim.git",
|
|
{ src = "https://github.com/Saghen/blink.cmp", version = "v1" },
|
|
})
|
|
|
|
vim.lsp.config("qmlls", {
|
|
cmd = { "qmlls6" },
|
|
})
|
|
require("blink.cmp").setup({
|
|
fuzzy = { implementation = "prefer_rust_with_warning" },
|
|
completion = {
|
|
menu = {
|
|
auto_show = false,
|
|
},
|
|
},
|
|
sources = {
|
|
default = { "lsp", "path", "snippets", "buffer" },
|
|
},
|
|
})
|
|
require("mason").setup()
|
|
require("mason-lspconfig").setup()
|
|
require("bufferline").setup({
|
|
options = {
|
|
themable = true,
|
|
numbers = "ordinal",
|
|
indicator = {
|
|
icon = "",
|
|
style = "underline",
|
|
},
|
|
},
|
|
})
|
|
require("lualine").setup()
|
|
require("snacks").setup({
|
|
notifier = { enabled = true },
|
|
statuscolumn = { enabled = true },
|
|
picker = {},
|
|
})
|
|
require("lspsaga").setup({
|
|
symbol_in_winbar = { enable = true },
|
|
lightbulb = {
|
|
enable = true,
|
|
sign = false,
|
|
},
|
|
hover = {
|
|
max_width = 0.6,
|
|
open_link = "gx",
|
|
open_browser = "!google-chrome",
|
|
},
|
|
})
|
|
require("cord").setup({
|
|
display = {
|
|
theme = "atom",
|
|
},
|
|
editor = { tooltip = "ur gay x3" },
|
|
})
|
|
require("lualine").setup({
|
|
options = {
|
|
component_separators = { left = "", right = "" },
|
|
section_separators = { left = "", right = "" },
|
|
},
|
|
sections = {
|
|
lualine_a = { "mode" },
|
|
lualine_b = { "diagnostics" },
|
|
lualine_c = { "filename", "branch", "navic" },
|
|
lualine_x = { "lsp_status", "filetype" },
|
|
lualine_y = { "progress" },
|
|
lualine_z = { "location" },
|
|
},
|
|
})
|
|
|
|
-- keymaps
|
|
local map = vim.keymap.set
|
|
|
|
map("n", "<leader>ff", function()
|
|
Snacks.picker.files()
|
|
end)
|
|
map("n", "<leader>lg", function()
|
|
Snacks.picker.grep()
|
|
end)
|
|
|
|
map("n", "<C-h>", "<C-w>h")
|
|
map("n", "<C-j>", "<C-w>j")
|
|
map("n", "<C-k>", "<C-w>k")
|
|
map("n", "<C-l>", "<C-w>l")
|
|
map("n", "<C-S-Left>", ":vertical resize -5<CR>", { silent = true })
|
|
map("n", "<C-S-Right>", ":vertical resize +5<CR>", { silent = true })
|
|
map("n", "<C-S-Up>", ":resize +5<CR>", { silent = true })
|
|
map("n", "<C-S-Down>", ":resize -5<CR>", { silent = true })
|
|
-- lsp keybinds
|
|
map("n", "K", "<cmd> Lspsaga hover_doc<cr>")
|
|
map("n", "go", "<cmd> Lspsaga goto_definition<cr>")
|
|
map("n", "gr", "<cmd> Lspsaga finder<cr>")
|
|
map("n", "<leader>qf", "<cmd> Lspsaga code_action<cr>")
|
|
map("n", "<C-f>", function()
|
|
vim.lsp.buf.format()
|
|
end)
|
|
-- bufferline keybinds
|
|
map("n", "<A-1>", "<cmd> BufferLineGoToBuffer 1 <cr>")
|
|
map("n", "<A-2>", "<cmd> BufferLineGoToBuffer 2 <cr>")
|
|
map("n", "<A-3>", "<cmd> BufferLineGoToBuffer 3 <cr>")
|
|
map("n", "<A-4>", "<cmd> BufferLineGoToBuffer 4 <cr>")
|
|
map("n", "<A-5>", "<cmd> BufferLineGoToBuffer 5 <cr>")
|
|
map("n", "<A-6>", "<cmd> BufferLineGoToBuffer 6 <cr>")
|
|
map("n", "<A-7>", "<cmd> BufferLineGoToBuffer 7 <cr>")
|
|
map("n", "<A-8>", "<cmd> BufferLineGoToBuffer 8 <cr>")
|
|
map("n", "<A-9>", "<cmd> BufferLineGoToBuffer 9 <cr>")
|
|
map("n", "<A-0>", "<cmd> BufferLineGoToBuffer last <cr>")
|
|
map("n", "<leader>w", "<cmd> bdelete! <cr>")
|
|
|
|
-- util keybinds
|
|
map("n", "<leader>t", "<cmd> terminal <cr>")
|
|
map("n", "<A-t>", "<cmd>Lspsaga term_toggle<cr>")
|
|
map("t", "<esc>", "<c-\\><c-n>")
|
|
map("i", "<C-space>", vim.lsp.completion.get, { desc = "trigger autocompletion" })
|
|
|
|
-- tinty function
|
|
local default_theme = "base16-oceanicnext"
|
|
|
|
local function get_tinty_theme()
|
|
local theme_name = vim.fn.system("cat /home/lucy/.local/share/tinted-theming/tinty/current_scheme")
|
|
|
|
if vim.v.shell_error ~= 0 then
|
|
return default_theme
|
|
else
|
|
return vim.trim(theme_name)
|
|
end
|
|
end
|
|
|
|
local function handle_focus_gained()
|
|
local new_theme_name = get_tinty_theme()
|
|
local current_theme_name = vim.g.colors_name
|
|
|
|
if current_theme_name ~= new_theme_name then
|
|
vim.cmd("colorscheme " .. new_theme_name)
|
|
require("lualine").setup()
|
|
end
|
|
require("lualine").setup()
|
|
end
|
|
|
|
local function main()
|
|
vim.o.termguicolors = true
|
|
vim.g.tinted_colorspace = 256
|
|
local current_theme_name = get_tinty_theme()
|
|
|
|
vim.cmd("colorscheme " .. current_theme_name)
|
|
|
|
vim.api.nvim_create_autocmd("FocusGained", {
|
|
callback = handle_focus_gained,
|
|
})
|
|
end
|
|
|
|
main()
|