mirror of
https://github.com/kristoferssolo/SoloVim.git
synced 2026-02-04 06:42:05 +00:00
Installed tabnine
This commit is contained in:
48
lua/solo/alpha.lua
Normal file
48
lua/solo/alpha.lua
Normal file
@@ -0,0 +1,48 @@
|
||||
local status_ok, alpha = pcall(require, "alpha")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
local dashboard = require("alpha.themes.dashboard")
|
||||
|
||||
local function header()
|
||||
return {
|
||||
[[ ___ ]],
|
||||
[[ /\_ \ __ ]],
|
||||
[[ ____ ___\//\ \ ___ __ __ /\_\ ___ ___ ]],
|
||||
[[ /',__\ / __`\\ \ \ / __`\/\ \/\ \\/\ \ /' __` __`\ ]],
|
||||
[[/\__, `\/\ \L\ \\_\ \_/\ \L\ \ \ \_/ |\ \ \/\ \/\ \/\ \ ]],
|
||||
[[\/\____/\ \____//\____\ \____/\ \___/ \ \_\ \_\ \_\ \_\]],
|
||||
[[ \/___/ \/___/ \/____/\/___/ \/__/ \/_/\/_/\/_/\/_/]],
|
||||
}
|
||||
end
|
||||
|
||||
local function footer()
|
||||
return "kristofers.xyz"
|
||||
end
|
||||
|
||||
dashboard.section.header.val = header()
|
||||
dashboard.section.buttons.val = {
|
||||
dashboard.button("f", " " .. " Find file", "<cmd>lua require('telescope.builtin').find_files()<cr>"),
|
||||
dashboard.button("e", " " .. " New file", "<cmd>ene <BAR> startinsert<cr>"),
|
||||
dashboard.button("\\", " " .. " Persistence", "<cmd>lua require('persistence').load()<cr>"),
|
||||
dashboard.button("r", " " .. " Recent files", "<cmd>Telescope oldfiles<cr>"),
|
||||
dashboard.button("t", " " .. " Find text", "<cmd>Telescope live_grep<cr>"),
|
||||
dashboard.button(
|
||||
"p",
|
||||
" " .. " Find project",
|
||||
"<cmd>lua require('telescope').extensions.projects.projects()<cr>"
|
||||
),
|
||||
dashboard.button("n", " " .. " Neorg", "<cmd>Neorg index<cr>"),
|
||||
dashboard.button("g", " " .. " Git", "<cmd>lua _LAZYGIT_TOGGLE()<cr>"),
|
||||
dashboard.button("c", " " .. " Config", "<cmd>e ~/.config/nvim/init.lua <cr>"),
|
||||
dashboard.button("q", " " .. " Quit", "<cmd>qa<cr>"),
|
||||
}
|
||||
dashboard.section.footer.val = footer()
|
||||
|
||||
dashboard.section.footer.opts.hl = "Type"
|
||||
dashboard.section.header.opts.hl = "Include"
|
||||
dashboard.section.buttons.opts.hl = "Keyword"
|
||||
|
||||
dashboard.opts.opts.noautocmd = true
|
||||
alpha.setup(dashboard.opts)
|
||||
121
lua/solo/autocommands.lua
Normal file
121
lua/solo/autocommands.lua
Normal file
@@ -0,0 +1,121 @@
|
||||
-- Use 'q' to quit from common plugins
|
||||
vim.api.nvim_create_autocmd({ "FileType" }, {
|
||||
pattern = { "qf", "help", "man", "lspinfo", "spectre_panel", "lir" },
|
||||
callback = function()
|
||||
vim.cmd([[ nnoremap <silent> <buffer> q :close<cr>
|
||||
set nobuflisted
|
||||
]])
|
||||
end,
|
||||
})
|
||||
|
||||
-- Remove statusline and tabline when in Alpha
|
||||
-- vim.api.nvim_create_autocmd({ "User" }, {
|
||||
-- pattern = { "AlphaReady" },
|
||||
-- callback = function()
|
||||
-- vim.cmd([[
|
||||
-- set showtabline=0 | autocmd BufUnload <buffer> set showtabline=2
|
||||
-- set laststatus=0 | autocmd BufUnload <buffer> set laststatus=3
|
||||
-- ]])
|
||||
-- end,
|
||||
-- })
|
||||
|
||||
-- Set wrap and spell in markdown and gitcommit
|
||||
vim.api.nvim_create_autocmd({ "FileType" }, {
|
||||
pattern = { "gitcommit", "markdown", "vimwiki" },
|
||||
callback = function()
|
||||
vim.opt_local.wrap = true
|
||||
-- vim.opt_local.spell = true
|
||||
end,
|
||||
})
|
||||
|
||||
vim.cmd("autocmd BufEnter * ++nested if winnr('$') == 1 && bufname() == 'NvimTree_' . tabpagenr() | quit | endif")
|
||||
|
||||
-- Fixes Autocomment
|
||||
vim.api.nvim_create_autocmd({ "BufWinEnter" }, {
|
||||
callback = function()
|
||||
vim.cmd("set formatoptions-=cro")
|
||||
end,
|
||||
})
|
||||
|
||||
-- Highlight Yanked Text
|
||||
vim.api.nvim_create_autocmd({ "TextYankPost" }, {
|
||||
callback = function()
|
||||
vim.highlight.on_yank({ higroup = "Visual", timeout = 200 })
|
||||
end,
|
||||
})
|
||||
|
||||
-- Format File on Save
|
||||
vim.api.nvim_create_autocmd({ "BufWritePre" }, {
|
||||
callback = function()
|
||||
vim.lsp.buf.format()
|
||||
end,
|
||||
})
|
||||
|
||||
-- Center on InsertEnter
|
||||
vim.api.nvim_create_autocmd({ "InsertEnter" }, {
|
||||
callback = function()
|
||||
vim.cmd("norm zz")
|
||||
end,
|
||||
})
|
||||
|
||||
-- Disable `expandtab` (don't replace tab with spaces) for lua files
|
||||
vim.api.nvim_create_autocmd({ "FileType" }, {
|
||||
pattern = { "lua" },
|
||||
callback = function()
|
||||
vim.opt_local.expandtab = false
|
||||
end,
|
||||
})
|
||||
|
||||
-- Set tab size for the following file types to 2
|
||||
vim.api.nvim_create_autocmd({ "FileType" }, {
|
||||
pattern = { "vimwiki", "java", "sql" },
|
||||
callback = function()
|
||||
vim.opt_local.ts = 2
|
||||
vim.opt_local.sw = 2
|
||||
vim.opt_local.sts = 2
|
||||
end,
|
||||
})
|
||||
|
||||
-- Autocommand that reloads waybar whenever you save the ~/.config/waybar/config file
|
||||
vim.api.nvim_create_autocmd({ "BufWritePost" }, {
|
||||
group = vim.api.nvim_create_augroup("AutoReloadWaybar", { clear = true }),
|
||||
pattern = { "**/waybar/config", "**/waybar/style.css" },
|
||||
callback = function()
|
||||
vim.cmd("!pkill waybar && waybar & disown")
|
||||
end,
|
||||
})
|
||||
|
||||
-- Autocommand that sources neovim files on save
|
||||
vim.api.nvim_create_autocmd({ "BufWritePost" }, {
|
||||
group = vim.api.nvim_create_augroup("AutoReloadConfig", { clear = true }),
|
||||
pattern = { "**/nvim/**/*.lua", "**/SoloVim/**/*.lua" },
|
||||
callback = function()
|
||||
local file_path = vim.api.nvim_buf_get_name(vim.api.nvim_get_current_buf())
|
||||
vim.cmd.source(file_path)
|
||||
end,
|
||||
})
|
||||
|
||||
-- Run PackerSync on file save
|
||||
vim.api.nvim_create_autocmd({ "BufWritePost" }, {
|
||||
group = vim.api.nvim_create_augroup("AutoPackerSync", { clear = true }),
|
||||
pattern = { "**/lua/plugins/*" },
|
||||
callback = function()
|
||||
require("lazy").sync()
|
||||
end,
|
||||
})
|
||||
|
||||
-- vim.api.nvim_create_autocmd({ "BufWinLeave" }, {
|
||||
-- group = vim.api.nvim_create_augroup("AutoSaveFold", { clear = true }),
|
||||
-- pattern = { "*.*" },
|
||||
-- callback = function()
|
||||
-- vim.cmd.mkview()
|
||||
-- end,
|
||||
-- })
|
||||
--
|
||||
-- vim.api.nvim_create_autocmd({ "BufWinEnter" }, {
|
||||
-- group = vim.api.nvim_create_augroup("LoadFold", { clear = true }),
|
||||
-- pattern = { "*.*" },
|
||||
-- callback = function()
|
||||
-- vim.cmd.loadview()
|
||||
-- end,
|
||||
-- })
|
||||
17
lua/solo/autopairs.lua
Normal file
17
lua/solo/autopairs.lua
Normal file
@@ -0,0 +1,17 @@
|
||||
-- Setup nvim-cmp.
|
||||
local status_ok, npairs = pcall(require, "nvim-autopairs")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
npairs.setup({
|
||||
check_ts = true, -- treesitter integration
|
||||
disable_filetype = { "TelescopePrompt" },
|
||||
})
|
||||
|
||||
local cmp_autopairs = require("nvim-autopairs.completion.cmp")
|
||||
local cmp_status_ok, cmp = pcall(require, "cmp")
|
||||
if not cmp_status_ok then
|
||||
return
|
||||
end
|
||||
cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done({}))
|
||||
33
lua/solo/autosave.lua
Normal file
33
lua/solo/autosave.lua
Normal file
@@ -0,0 +1,33 @@
|
||||
local attach_on_buffer = function(output_bufnr, pattern, command)
|
||||
vim.api.nvim_create_autocmd("BufWritePost", {
|
||||
group = vim.api.nvim_create_augroup("autosave", { clear = true }),
|
||||
pattern = pattern,
|
||||
callback = function()
|
||||
local append_data = function(_, data)
|
||||
if data then
|
||||
vim.api.nvim_buf_set_lines(output_bufnr, -1, -1, false, data)
|
||||
end
|
||||
end
|
||||
|
||||
local file_path = vim.api.nvim_buf_get_name(vim.api.nvim_get_current_buf())
|
||||
vim.api.nvim_buf_set_lines(output_bufnr, 0, -1, false, { file_path })
|
||||
vim.fn.jobstart(command, {
|
||||
stdout_buffered = true,
|
||||
on_stdout = append_data,
|
||||
on_stderr = append_data,
|
||||
})
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
||||
vim.api.nvim_create_user_command("AutoRun", function()
|
||||
print("AutoRun starts now...")
|
||||
local bufnr = vim.api.nvim_get_current_buf()
|
||||
local command = vim.fn.input("Command: ")
|
||||
local pattern = vim.split(vim.fn.input("Pattern: "), " ")
|
||||
attach_on_buffer(tonumber(bufnr), pattern, command)
|
||||
end, {})
|
||||
|
||||
vim.api.nvim_create_user_command("AutoStop", function()
|
||||
vim.api.nvim_create_augroup("autosave", { clear = true })
|
||||
end, {})
|
||||
9
lua/solo/init.lua
Normal file
9
lua/solo/init.lua
Normal file
@@ -0,0 +1,9 @@
|
||||
require("solo.options")
|
||||
require("solo.keymaps")
|
||||
require("solo.vimwiki")
|
||||
require("solo.plugin")
|
||||
require("solo.autocommands")
|
||||
require("solo.alpha")
|
||||
require("solo.autopairs")
|
||||
require("solo.autosave")
|
||||
require("solo.mason")
|
||||
95
lua/solo/keymaps.lua
Normal file
95
lua/solo/keymaps.lua
Normal file
@@ -0,0 +1,95 @@
|
||||
local keymap = vim.keymap.set
|
||||
local opts = { silent = true }
|
||||
|
||||
--Remap space as leader key
|
||||
keymap("", "<Space>", "<Nop>", opts)
|
||||
keymap("n", "q", "<Nop>", opts)
|
||||
keymap("n", "Q", "<Nop>", opts)
|
||||
vim.g.mapleader = " "
|
||||
|
||||
-- Modes
|
||||
-- normal_mode = "n",
|
||||
-- insert_mode = "i",
|
||||
-- visual_mode = "v",
|
||||
-- visual_block_mode = "x",
|
||||
-- term_mode = "t",
|
||||
-- command_mode = "c",
|
||||
|
||||
-- Normal --
|
||||
keymap("n", "<C-d>", "<C-d>zz", opts)
|
||||
keymap("n", "<C-u>", "<C-u>zz", opts)
|
||||
keymap("n", "n", "nzzzv", opts)
|
||||
keymap("n", "N", "Nzzzv", opts)
|
||||
|
||||
-- Better window navigation with tmux
|
||||
keymap("n", "<C-h>", "<cmd>TmuxNavigateLeft<cr>", opts)
|
||||
keymap("n", "<C-j>", "<cmd>TmuxNavigateDown<cr>", opts)
|
||||
keymap("n", "<C-k>", "<cmd>TmuxNavigateUp<cr>", opts)
|
||||
keymap("n", "<C-l>", "<cmd>TmuxNavigateRight<cr>", opts)
|
||||
|
||||
-- Resize with arrows
|
||||
keymap("n", "<C-Up>", "<cmd>resize -2<cr>", opts)
|
||||
keymap("n", "<C-Down>", "<cmd>resize +2<cr>", opts)
|
||||
keymap("n", "<C-Left>", "<cmd>vertical resize -2<cr>", opts)
|
||||
keymap("n", "<C-Right>", "<cmd>vertical resize +2<cr>", opts)
|
||||
|
||||
-- -- Navigate buffers
|
||||
-- keymap("n", "<S-l>", "<cmd>bnext<cr>", opts)
|
||||
-- keymap("n", "<S-h>", "<cmd>bprevious<cr>", opts)
|
||||
|
||||
-- Better paste
|
||||
keymap("v", "p", '"_dP', opts)
|
||||
|
||||
-- Move current line / block with Alt-j/k ala vscode
|
||||
keymap("n", "<A-j>", "<cmd>m .+1<cr>==", opts)
|
||||
keymap("n", "<A-k>", "<cmd>m .-2<cr>==", opts)
|
||||
|
||||
-- QuickFix
|
||||
keymap("n", "]q", "<cmd>cnext<cr>", opts)
|
||||
keymap("n", "[q", "<cmd>cprev<cr>", opts)
|
||||
|
||||
keymap("n", "<S-s>", ":%s/\\<<C-r><C-w>\\>/<C-r><C-w>/gI<Left><Left><Left>", {})
|
||||
|
||||
keymap("n", "<S-j>", "mzJ`z")
|
||||
|
||||
-- Insert --
|
||||
-- Press jk fast to enter
|
||||
keymap("i", "jk", "<ESC>", opts)
|
||||
|
||||
-- Move current line / block with Alt-j/k ala vscode.
|
||||
keymap("i", "<A-j>", "<Esc><cmd>m .+1<cr>==gi", opts)
|
||||
keymap("i", "<A-k>", "<Esc><cmd>m .-2<cr>==gi", opts)
|
||||
-- navigation
|
||||
keymap("i", "<A-Up>", "<C-\\><C-N><C-w>k", opts)
|
||||
keymap("i", "<A-Down>", "<C-\\><C-N><C-w>j", opts)
|
||||
keymap("i", "<A-Left>", "<C-\\><C-N><C-w>h", opts)
|
||||
keymap("i", "<A-Right>", "<C-\\><C-N><C-w>l", opts)
|
||||
|
||||
-- Visual --
|
||||
-- Stay in indent mode
|
||||
keymap("v", "<", "<gv", opts)
|
||||
keymap("v", ">", ">gv", opts)
|
||||
|
||||
-- keymap("v", "<A-j>", "<cmd>m '>+1<cr>gv=gv")
|
||||
-- keymap("v", "<A-k>", "<cmd>m '<-2<cr>gv=gv")
|
||||
|
||||
-- Visual Block --
|
||||
-- Move current line / block with Alt-j/k ala vscode.
|
||||
-- keymap("x", "<A-j>", "<cmd>move '>+1<cr>gv-gv", opts)
|
||||
-- keymap("x", "<A-k>", "<cmd>move '<-2<cr>gv-gv", opts)
|
||||
|
||||
-- Command --
|
||||
-- navigate tab completion with <c-j> and <c-k>
|
||||
-- runs conditionally
|
||||
keymap("c", "<C-j>", 'pumvisible() ? "\\<C-n>" : "\\<C-j>"', { expr = true, noremap = true })
|
||||
keymap("c", "<C-k>", 'pumvisible() ? "\\<C-p>" : "\\<C-k>"', { expr = true, noremap = true })
|
||||
|
||||
-- Terminal --
|
||||
-- Terminal window navigation
|
||||
keymap("t", "<C-h>", "<C-\\><C-N><C-w>h", opts)
|
||||
keymap("t", "<C-j>", "<C-\\><C-N><C-w>j", opts)
|
||||
keymap("t", "<C-k>", "<C-\\><C-N><C-w>k", opts)
|
||||
keymap("t", "<C-l>", "<C-\\><C-N><C-w>l", opts)
|
||||
|
||||
keymap("n", "<C-b>", "<cmd>w!<cr><cmd>!compiler '%:p'<cr>")
|
||||
keymap("n", "<C-o>", "<cmd>w!<cr><cmd>!opout '%:p'<cr>")
|
||||
113
lua/solo/mason/handlers.lua
Normal file
113
lua/solo/mason/handlers.lua
Normal file
@@ -0,0 +1,113 @@
|
||||
local M = {}
|
||||
|
||||
local status_cmp_ok, cmp_nvim_lsp = pcall(require, "cmp_nvim_lsp")
|
||||
if not status_cmp_ok then
|
||||
return
|
||||
end
|
||||
|
||||
M.capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||
M.capabilities.textDocument.completion.completionItem.snippetSupport = true
|
||||
M.capabilities = cmp_nvim_lsp.default_capabilities(M.capabilities)
|
||||
|
||||
M.setup = function()
|
||||
local signs = {
|
||||
|
||||
{ name = "DiagnosticSignError", text = "" },
|
||||
{ name = "DiagnosticSignWarn", text = "" },
|
||||
{ name = "DiagnosticSignHint", text = "" },
|
||||
{ name = "DiagnosticSignInfo", text = "" },
|
||||
}
|
||||
|
||||
for _, sign in pairs(signs) do
|
||||
vim.fn.sign_define(sign.name, { texthl = sign.name, text = sign.text, numhl = "" })
|
||||
end
|
||||
|
||||
local config = {
|
||||
virtual_text = false, -- virtual text
|
||||
signs = {
|
||||
active = signs, -- show signs
|
||||
},
|
||||
update_in_insert = true,
|
||||
underline = true,
|
||||
severity_sort = true,
|
||||
float = {
|
||||
focusable = true,
|
||||
style = "minimal",
|
||||
border = "rounded",
|
||||
source = "always",
|
||||
header = "",
|
||||
prefix = "",
|
||||
},
|
||||
}
|
||||
|
||||
vim.diagnostic.config(config)
|
||||
|
||||
vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, {
|
||||
border = "rounded",
|
||||
})
|
||||
|
||||
vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, {
|
||||
border = "rounded",
|
||||
})
|
||||
end
|
||||
|
||||
local function lsp_keymaps(bufnr)
|
||||
local opts = { noremap = true, silent = true }
|
||||
local keymap = vim.api.nvim_buf_set_keymap
|
||||
keymap(bufnr, "n", "gD", "<cmd>lua vim.lsp.buf.declaration()<cr>", opts)
|
||||
keymap(bufnr, "n", "gd", "<cmd>lua require('telescope.builtin').lsp_definitions()<cr>", opts)
|
||||
keymap(bufnr, "n", "K", "<cmd>lua vim.lsp.buf.hover()<cr>", opts)
|
||||
keymap(bufnr, "n", "gI", "<cmd>lua vim.lsp.buf.implementation()<cr>", opts)
|
||||
keymap(bufnr, "n", "gr", "<cmd>lua require('telescope.builtin').lsp_references()<cr>", opts)
|
||||
keymap(bufnr, "n", "gl", "<cmd>lua vim.diagnostic.open_float()<cr>", opts)
|
||||
end
|
||||
|
||||
M.on_attach = function(client, bufnr)
|
||||
lsp_keymaps(bufnr)
|
||||
local status_ok, illuminate = pcall(require, "illuminate")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
illuminate.configure({
|
||||
-- providers: provider used to get references in the buffer, ordered by priority
|
||||
providers = {
|
||||
"lsp",
|
||||
"treesitter",
|
||||
"regex",
|
||||
},
|
||||
-- delay: delay in milliseconds
|
||||
delay = 100,
|
||||
-- filetype_overrides: filetype specific overrides.
|
||||
-- The keys are strings to represent the filetype while the values are tables that
|
||||
-- supports the same keys passed to .configure except for filetypes_denylist and filetypes_allowlist
|
||||
filetype_overrides = {},
|
||||
-- filetypes_denylist: filetypes to not illuminate, this overrides filetypes_allowlist
|
||||
filetypes_denylist = {
|
||||
"dirvish",
|
||||
"fugitive",
|
||||
"alpha",
|
||||
"NvimTree",
|
||||
},
|
||||
-- filetypes_allowlist: filetypes to illuminate, this is overridden by filetypes_denylist
|
||||
filetypes_allowlist = {},
|
||||
-- modes_denylist: modes to not illuminate, this overrides modes_allowlist
|
||||
modes_denylist = {},
|
||||
-- modes_allowlist: modes to illuminate, this is overridden by modes_denylist
|
||||
modes_allowlist = {},
|
||||
-- providers_regex_syntax_denylist: syntax to not illuminate, this overrides providers_regex_syntax_allowlist
|
||||
-- Only applies to the 'regex' provider
|
||||
-- Use :echom synIDattr(synIDtrans(synID(line('.'), col('.'), 1)), 'name')
|
||||
providers_regex_syntax_denylist = {},
|
||||
-- providers_regex_syntax_allowlist: syntax to illuminate, this is overridden by providers_regex_syntax_denylist
|
||||
-- Only applies to the 'regex' provider
|
||||
-- Use :echom synIDattr(synIDtrans(synID(line('.'), col('.'), 1)), 'name')
|
||||
providers_regex_syntax_allowlist = {},
|
||||
-- under_cursor: whether or not to illuminate under the cursor
|
||||
under_cursor = true,
|
||||
-- max_file_lines: max number of lines in a file to illuminate
|
||||
max_file_lines = nil,
|
||||
})
|
||||
illuminate.on_attach(client)
|
||||
end
|
||||
|
||||
return M
|
||||
8
lua/solo/mason/init.lua
Normal file
8
lua/solo/mason/init.lua
Normal file
@@ -0,0 +1,8 @@
|
||||
local status_ok, _ = pcall(require, "mason-lspconfig")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
require("solo.mason.mason-installer")
|
||||
require("solo.mason.handlers").setup()
|
||||
require("solo.mason.null-ls")
|
||||
84
lua/solo/mason/mason-installer.lua
Normal file
84
lua/solo/mason/mason-installer.lua
Normal file
@@ -0,0 +1,84 @@
|
||||
local status_ok, mason = pcall(require, "mason")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
local status_lspconfig_ok, lspconfig = pcall(require, "lspconfig")
|
||||
if not status_lspconfig_ok then
|
||||
return
|
||||
end
|
||||
|
||||
local status_mason_lspconfig_ok, mason_lspconfig = pcall(require, "mason-lspconfig")
|
||||
if not status_mason_lspconfig_ok then
|
||||
return
|
||||
end
|
||||
|
||||
local servers = {
|
||||
"bashls",
|
||||
"clangd",
|
||||
"cmake",
|
||||
"cssls",
|
||||
"emmet_ls",
|
||||
"html",
|
||||
"jedi_language_server",
|
||||
"jsonls",
|
||||
"lua_ls",
|
||||
"phpactor",
|
||||
"ruff_lsp",
|
||||
"rust_analyzer",
|
||||
"sqlls",
|
||||
"taplo",
|
||||
"texlab",
|
||||
"tsserver",
|
||||
}
|
||||
|
||||
mason.setup()
|
||||
|
||||
mason_lspconfig.setup({
|
||||
ensure_installed = servers,
|
||||
})
|
||||
|
||||
local on_attach = require("solo.mason.handlers").on_attach
|
||||
local capabilities = require("solo.mason.handlers").capabilities
|
||||
for _, server in pairs(servers) do
|
||||
local opts = {
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
}
|
||||
|
||||
if server == "bashls" then
|
||||
local bashls_opts = require("solo.mason.settings.bashls")
|
||||
opts = vim.tbl_deep_extend("force", bashls_opts, opts)
|
||||
end
|
||||
|
||||
if server == "lua_ls" then
|
||||
local lua_ls_opts = require("solo.mason.settings.lua_ls")
|
||||
opts = vim.tbl_deep_extend("force", lua_ls_opts, opts)
|
||||
end
|
||||
|
||||
if server == "emmet_ls" then
|
||||
local emmet_ls_opts = require("solo.mason.settings.emmet_ls")
|
||||
opts = vim.tbl_deep_extend("force", emmet_ls_opts, opts)
|
||||
end
|
||||
|
||||
if server == "rust_analyzer" then
|
||||
local rust_analyzer_opts = require("solo.mason.settings.rust_analyzer")
|
||||
opts = vim.tbl_deep_extend("force", rust_analyzer_opts, opts)
|
||||
require("rust-tools").setup(opts)
|
||||
goto continue
|
||||
end
|
||||
|
||||
if server == "clangd" then
|
||||
local clangd_opts = require("solo.mason.settings.clangd")
|
||||
opts = vim.tbl_deep_extend("force", clangd_opts, opts)
|
||||
require("clangd_extensions").setup(opts)
|
||||
goto continue
|
||||
end
|
||||
|
||||
if server == "texlab" then
|
||||
local texlab_opts = require("solo.mason.settings.texlab")
|
||||
opts = vim.tbl_deep_extend("force", texlab_opts, opts)
|
||||
end
|
||||
|
||||
lspconfig[server].setup(opts)
|
||||
::continue::
|
||||
end
|
||||
98
lua/solo/mason/null-ls.lua
Normal file
98
lua/solo/mason/null-ls.lua
Normal file
@@ -0,0 +1,98 @@
|
||||
local null_ls_status_ok, null_ls = pcall(require, "null-ls")
|
||||
if not null_ls_status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
local mason_null_ls_status_ok, mason_null_ls = pcall(require, "mason-null-ls")
|
||||
if not mason_null_ls_status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
mason_null_ls.setup({
|
||||
ensure_installed = {
|
||||
"autopep8",
|
||||
"beautysh",
|
||||
"clang_format",
|
||||
"codespell",
|
||||
"cpplint",
|
||||
"djlint",
|
||||
"gitlint",
|
||||
"html_lint",
|
||||
"isort",
|
||||
"luacheck",
|
||||
"misspell",
|
||||
"mypy",
|
||||
"phpcbf",
|
||||
"phpcs",
|
||||
"prettier",
|
||||
"rustfmt",
|
||||
"sql-formatter",
|
||||
"shfmt",
|
||||
"yamlfmt",
|
||||
"cmakelang",
|
||||
},
|
||||
automatic_installation = true,
|
||||
automatic_setup = true,
|
||||
})
|
||||
|
||||
-- https://github.com/jose-elias-alvarez/null-ls.nvim/tree/main/lua/null-ls/builtins/formatting
|
||||
local formatting = null_ls.builtins.formatting
|
||||
-- https://github.com/jose-elias-alvarez/null-ls.nvim/tree/main/lua/null-ls/builtins/diagnostics
|
||||
local diagnostics = null_ls.builtins.diagnostics
|
||||
-- https://github.com/prettier-solidity/prettier-plugin-solidity
|
||||
null_ls.setup({
|
||||
debug = false,
|
||||
sources = {
|
||||
diagnostics.codespell,
|
||||
diagnostics.cpplint,
|
||||
diagnostics.luacheck.with({
|
||||
extra_args = {
|
||||
"--globals",
|
||||
"vim",
|
||||
},
|
||||
}),
|
||||
diagnostics.misspell,
|
||||
diagnostics.mypy,
|
||||
diagnostics.cmake_lint,
|
||||
formatting.cmake_format,
|
||||
formatting.autopep8,
|
||||
formatting.beautysh,
|
||||
formatting.clang_format,
|
||||
formatting.djlint,
|
||||
formatting.google_java_format,
|
||||
formatting.isort,
|
||||
formatting.prettier.with({
|
||||
extra_filetypes = { "toml" },
|
||||
extra_args = {
|
||||
"--no-semi",
|
||||
"--double-quote",
|
||||
"--no-bracket-spacing",
|
||||
"--tab-width",
|
||||
"4",
|
||||
"--bracket-same-line",
|
||||
"--html-whitespace-sensitivity",
|
||||
"strict",
|
||||
},
|
||||
}),
|
||||
formatting.phpcbf,
|
||||
formatting.rustfmt,
|
||||
formatting.shfmt.with({
|
||||
extra_filetypes = {
|
||||
"bash",
|
||||
"csh",
|
||||
"ksh",
|
||||
"sh",
|
||||
"zsh",
|
||||
},
|
||||
}),
|
||||
-- formatting.sql_formatter.with({
|
||||
-- extra_args = {
|
||||
-- "-c",
|
||||
-- "/home/kristofers/.config/sql/sql-formatter.json",
|
||||
-- },
|
||||
-- }),
|
||||
formatting.stylua,
|
||||
formatting.yamlfmt,
|
||||
formatting.black,
|
||||
},
|
||||
})
|
||||
7
lua/solo/mason/settings/bashls.lua
Normal file
7
lua/solo/mason/settings/bashls.lua
Normal file
@@ -0,0 +1,7 @@
|
||||
return {
|
||||
filetypes = {
|
||||
"sh",
|
||||
"bash",
|
||||
"zsh",
|
||||
},
|
||||
}
|
||||
71
lua/solo/mason/settings/clangd.lua
Normal file
71
lua/solo/mason/settings/clangd.lua
Normal file
@@ -0,0 +1,71 @@
|
||||
return {
|
||||
server = {
|
||||
capabilities = {
|
||||
offsetEncoding = { "utf-16" },
|
||||
},
|
||||
on_attach = require("solo.mason.handlers").on_attach,
|
||||
},
|
||||
extensions = {
|
||||
-- defaults:
|
||||
-- Automatically set inlay hints (type hints)
|
||||
autoSetHints = true,
|
||||
-- These apply to the default ClangdSetInlayHints command
|
||||
inlay_hints = {
|
||||
-- Only show inlay hints for the current line
|
||||
only_current_line = false,
|
||||
-- Event which triggers a refersh of the inlay hints.
|
||||
-- You can make this "CursorMoved" or "CursorMoved,CursorMovedI" but
|
||||
-- not that this may cause higher CPU usage.
|
||||
-- This option is only respected when only_current_line and
|
||||
-- autoSetHints both are true.
|
||||
only_current_line_autocmd = "CursorHold",
|
||||
-- whether to show parameter hints with the inlay hints or not
|
||||
show_parameter_hints = true,
|
||||
-- prefix for parameter hints
|
||||
parameter_hints_prefix = "<- ",
|
||||
-- prefix for all the other hints (type, chaining)
|
||||
other_hints_prefix = "=> ",
|
||||
-- whether to align to the length of the longest line in the file
|
||||
max_len_align = true,
|
||||
-- padding from the left if max_len_align is true
|
||||
max_len_align_padding = 1,
|
||||
-- whether to align to the extreme right or not
|
||||
right_align = false,
|
||||
-- padding from the right if right_align is true
|
||||
right_align_padding = 7,
|
||||
-- The color of the hints
|
||||
highlight = "Comment",
|
||||
-- The highlight group priority for extmark
|
||||
priority = 100,
|
||||
},
|
||||
ast = {
|
||||
-- These require codicons (https://github.com/microsoft/vscode-codicons)
|
||||
role_icons = {
|
||||
type = "",
|
||||
declaration = "",
|
||||
expression = "",
|
||||
specifier = "",
|
||||
statement = "",
|
||||
["template argument"] = "",
|
||||
},
|
||||
kind_icons = {
|
||||
Compound = "",
|
||||
Recovery = "",
|
||||
TranslationUnit = "",
|
||||
PackExpansion = "",
|
||||
TemplateTypeParm = "",
|
||||
TemplateTemplateParm = "",
|
||||
TemplateParamObject = "",
|
||||
},
|
||||
highlights = {
|
||||
detail = "Comment",
|
||||
},
|
||||
},
|
||||
memory_usage = {
|
||||
border = "none",
|
||||
},
|
||||
symbol_info = {
|
||||
border = "none",
|
||||
},
|
||||
},
|
||||
}
|
||||
13
lua/solo/mason/settings/emmet_ls.lua
Normal file
13
lua/solo/mason/settings/emmet_ls.lua
Normal file
@@ -0,0 +1,13 @@
|
||||
return {
|
||||
filetypes = {
|
||||
"html",
|
||||
"htmldjango",
|
||||
"typescriptreact",
|
||||
"javascriptreact",
|
||||
"css",
|
||||
"sass",
|
||||
"scss",
|
||||
"less",
|
||||
"eruby",
|
||||
},
|
||||
}
|
||||
35
lua/solo/mason/settings/lua_ls.lua
Normal file
35
lua/solo/mason/settings/lua_ls.lua
Normal file
@@ -0,0 +1,35 @@
|
||||
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", "awesome", "client" },
|
||||
},
|
||||
-- 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,
|
||||
},
|
||||
root_pattern = {
|
||||
".stylua.toml",
|
||||
".luarc.json",
|
||||
".luarc.jsonc",
|
||||
".luacheckrc",
|
||||
"stylua.toml",
|
||||
"selene.toml",
|
||||
"selene.yml",
|
||||
".git",
|
||||
},
|
||||
format = {
|
||||
enable = false,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
105
lua/solo/mason/settings/rust_analyzer.lua
Normal file
105
lua/solo/mason/settings/rust_analyzer.lua
Normal file
@@ -0,0 +1,105 @@
|
||||
return {
|
||||
server = {
|
||||
on_attach = require("solo.mason.handlers").on_attach,
|
||||
capabilities = require("solo.mason.handlers").capabilities,
|
||||
},
|
||||
tools = {
|
||||
-- how to execute terminal commands
|
||||
-- options right now: termopen / quickfix
|
||||
executor = require("rust-tools.executors").termopen,
|
||||
-- callback to execute once rust-analyzer is done initializing the workspace
|
||||
-- The callback receives one parameter indicating the `health` of the server: "ok" | "warning" | "error"
|
||||
on_initialized = function()
|
||||
vim.api.nvim_create_autocmd({ "BufEnter", "CursorHold", "InsertLeave", "BufWritePost" }, {
|
||||
group = vim.api.nvim_create_augroup("InitializeRustAnalyzer", { clear = true }),
|
||||
pattern = { "*.rs" },
|
||||
callback = function()
|
||||
vim.lsp.codelens.refresh()
|
||||
end,
|
||||
})
|
||||
end,
|
||||
-- automatically call RustReloadWorkspace when writing to a Cargo.toml file.
|
||||
reload_workspace_from_cargo_toml = true,
|
||||
-- These apply to the default RustSetInlayHints command
|
||||
inlay_hints = {
|
||||
-- automatically set inlay hints (type hints)
|
||||
-- default: true
|
||||
auto = true,
|
||||
-- Only show inlay hints for the current line
|
||||
only_current_line = false,
|
||||
-- whether to show parameter hints with the inlay hints or not
|
||||
-- default: true
|
||||
show_parameter_hints = true,
|
||||
-- prefix for parameter hints
|
||||
-- default: "<-"
|
||||
parameter_hints_prefix = " <- ",
|
||||
-- prefix for all the other hints (type, chaining)
|
||||
-- default: "=>"
|
||||
other_hints_prefix = " => ",
|
||||
-- whether to align to the length of the longest line in the file
|
||||
max_len_align = false,
|
||||
-- padding from the left if max_len_align is true
|
||||
max_len_align_padding = 1,
|
||||
-- whether to align to the extreme right or not
|
||||
right_align = false,
|
||||
-- padding from the right if right_align is true
|
||||
right_align_padding = 7,
|
||||
-- The color of the hints
|
||||
highlight = "Comment",
|
||||
},
|
||||
-- options same as lsp hover / vim.lsp.util.open_floating_preview()
|
||||
hover_actions = {
|
||||
-- the border that is used for the hover window
|
||||
-- see vim.api.nvim_open_win()
|
||||
border = {
|
||||
{ "╭", "FloatBorder" },
|
||||
{ "─", "FloatBorder" },
|
||||
{ "╮", "FloatBorder" },
|
||||
{ "│", "FloatBorder" },
|
||||
{ "╯", "FloatBorder" },
|
||||
{ "─", "FloatBorder" },
|
||||
{ "╰", "FloatBorder" },
|
||||
{ "│", "FloatBorder" },
|
||||
},
|
||||
-- Maximal width of the hover window. Nil means no max.
|
||||
max_width = nil,
|
||||
-- Maximal height of the hover window. Nil means no max.
|
||||
max_height = nil,
|
||||
-- whether the hover action window gets automatically focused
|
||||
-- default: false
|
||||
auto_focus = false,
|
||||
},
|
||||
-- settings for showing the crate graph based on graphviz and the dot
|
||||
-- command
|
||||
crate_graph = {
|
||||
-- Backend used for displaying the graph
|
||||
-- see: https://graphviz.org/docs/outputs/
|
||||
-- default: x11
|
||||
backend = "x11",
|
||||
-- where to store the output, nil for no output stored (relative
|
||||
-- path from pwd)
|
||||
-- default: nil
|
||||
output = nil,
|
||||
-- true for all crates.io and external crates, false only the local
|
||||
-- crates
|
||||
-- default: true
|
||||
full = true,
|
||||
},
|
||||
-- all the opts to send to nvim-lspconfig
|
||||
-- these override the defaults set by rust-tools.nvim
|
||||
-- see https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#rust_analyzer
|
||||
server = {
|
||||
-- standalone file support
|
||||
-- setting it to false may improve startup time
|
||||
standalone = true,
|
||||
}, -- rust-analyzer options
|
||||
-- debugging stuff
|
||||
dap = {
|
||||
adapter = {
|
||||
type = "executable",
|
||||
command = "codelldb",
|
||||
name = "rt_lldb",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
27
lua/solo/mason/settings/texlab.lua
Normal file
27
lua/solo/mason/settings/texlab.lua
Normal file
@@ -0,0 +1,27 @@
|
||||
return {
|
||||
settings = {
|
||||
texlab = {
|
||||
auxDirectory = ".",
|
||||
bibtexFormatter = "texlab",
|
||||
build = {
|
||||
args = { "-pdf", "-interaction=nonstopmode", "-synctex=1", "%f" },
|
||||
executable = "xelatex",
|
||||
forwardSearchAfter = false,
|
||||
onSave = false,
|
||||
},
|
||||
chktex = {
|
||||
onEdit = false,
|
||||
onOpenAndSave = false,
|
||||
},
|
||||
diagnosticsDelay = 0,
|
||||
formatterLineLength = 120,
|
||||
forwardSearch = {
|
||||
args = {},
|
||||
},
|
||||
latexFormatter = "latexindent",
|
||||
latexindent = {
|
||||
modifyLineBreaks = false,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
63
lua/solo/options.lua
Normal file
63
lua/solo/options.lua
Normal file
@@ -0,0 +1,63 @@
|
||||
local options = {
|
||||
backup = false, -- creates a backup file
|
||||
clipboard = "unnamedplus", -- allows neovim to access the system clipboard
|
||||
cmdheight = 1, -- more space in the neovim command line for displaying messages
|
||||
completeopt = { "menuone", "noselect" }, -- mostly just for cmp
|
||||
conceallevel = 0, -- so that `` is visible in markdown files
|
||||
fileencoding = "utf-8", -- the encoding written to a file
|
||||
hlsearch = false, -- highlight all matches on previous search pattern
|
||||
incsearch = true,
|
||||
ignorecase = true, -- ignore case in search patterns
|
||||
mouse = "a", -- allow the mouse to be used in neovim
|
||||
pumheight = 10, -- pop up menu height showmode = false, -- we don't need to see things like -- INSERT -- anymore
|
||||
showtabline = 0, -- disable tabs
|
||||
smartcase = true, -- smart case
|
||||
smartindent = true, -- make indenting smarter again
|
||||
splitbelow = true, -- force all horizontal splits to go below current window
|
||||
splitright = true, -- force all vertical splits to go to the right of current window
|
||||
swapfile = false, -- creates a swapfile
|
||||
termguicolors = true, -- set term gui colors (most terminals support this)
|
||||
timeoutlen = 250, -- time to wait for a mapped sequence to complete (in milliseconds)
|
||||
undofile = true, -- enable persistent undo
|
||||
undodir = vim.fn.stdpath("data") .. "/nvim/undodir",
|
||||
updatetime = 50, -- faster completion (4000ms default)
|
||||
writebackup = false, -- if a file is being edited by another program (or was written to file while editing with another program), it is not allowed to be edited
|
||||
expandtab = true, -- convert tabs to spaces
|
||||
shiftwidth = 4, -- the number of spaces inserted for each indentation
|
||||
tabstop = 4, -- insert 4 spaces for a tab
|
||||
cursorcolumn = true, -- highlight the current column
|
||||
cursorline = true, -- highlight the current line
|
||||
number = true, -- set numbered lines
|
||||
relativenumber = true, -- set relative numbered lines
|
||||
laststatus = 3,
|
||||
showcmd = false,
|
||||
ruler = false,
|
||||
numberwidth = 4, -- set number column width to 4 {default 4}
|
||||
signcolumn = "yes", -- always show the sign column, otherwise it would shift the text each time
|
||||
wrap = false, -- display lines as one long line
|
||||
scrolloff = 8, -- is one of my fav
|
||||
sidescrolloff = 8,
|
||||
guifont = "JetBrainsMono NF:h11", -- the font used in graphical neovim applications
|
||||
spell = false,
|
||||
foldmethod = "manual",
|
||||
}
|
||||
|
||||
vim.opt.fillchars.eob = " "
|
||||
vim.opt.shortmess:append("c")
|
||||
vim.opt.whichwrap:append("<,>,[,],h,l")
|
||||
vim.opt.iskeyword:append("-")
|
||||
|
||||
for k, v in pairs(options) do
|
||||
vim.opt[k] = v
|
||||
end
|
||||
vim.opt.spelloptions:append("camel")
|
||||
|
||||
local g = vim.g
|
||||
g.mapleader = " "
|
||||
g.maplocalleader = " "
|
||||
g.loaded_netrw = 1
|
||||
g.loaded_netrwPlugin = 1
|
||||
|
||||
vim.opt_local.suffixesadd:prepend(".lua")
|
||||
vim.opt_local.suffixesadd:prepend("init.lua")
|
||||
vim.opt_local.path:prepend(vim.fn.stdpath("config") .. "/lua")
|
||||
13
lua/solo/plugin.lua
Normal file
13
lua/solo/plugin.lua
Normal file
@@ -0,0 +1,13 @@
|
||||
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)
|
||||
require("lazy").setup("plugins")
|
||||
14
lua/solo/vimwiki.lua
Normal file
14
lua/solo/vimwiki.lua
Normal file
@@ -0,0 +1,14 @@
|
||||
vim.g.vimwiki_list = {
|
||||
{
|
||||
path = "~/vimwiki",
|
||||
syntax = "markdown",
|
||||
ext = ".md",
|
||||
},
|
||||
}
|
||||
vim.g.vimwiki_ext2syntax = {
|
||||
[".md"] = "markdown",
|
||||
[".markdown"] = "markdown",
|
||||
[".mdown"] = "markdown",
|
||||
}
|
||||
|
||||
vim.g.vimwiki_global_ext = 1
|
||||
Reference in New Issue
Block a user