feat: some shit!
This commit is contained in:
@ -1,92 +0,0 @@
|
||||
-- luasnip setup
|
||||
local luasnip = require("luasnip")
|
||||
|
||||
local lspkind = require("lspkind")
|
||||
local cmp = require("cmp")
|
||||
local cmp_autopairs = require("nvim-autopairs.completion.cmp")
|
||||
|
||||
local capabilities = require("cmp_nvim_lsp").default_capabilities()
|
||||
require("lspconfig").html.setup({
|
||||
capabilities = capabilities,
|
||||
})
|
||||
|
||||
require("nvim-autopairs").setup()
|
||||
require("copilot").setup()
|
||||
require("copilot_cmp").setup({
|
||||
clear_after_cursor = true,
|
||||
})
|
||||
|
||||
cmp.setup({
|
||||
window = {
|
||||
documentation = cmp.config.window.bordered(),
|
||||
},
|
||||
experimental = {
|
||||
ghost_text = true,
|
||||
},
|
||||
completion = {
|
||||
completeopt = "menu,menuone,noselect",
|
||||
},
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
luasnip.lsp_expand(args.body)
|
||||
end,
|
||||
},
|
||||
mapping = {
|
||||
["<C-Leader>"] = cmp.mapping.complete({}),
|
||||
["<Tab>"] = function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_next_item()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end,
|
||||
["<S-Tab>"] = function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_prev_item()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end,
|
||||
["<CR>"] = cmp.mapping.confirm({
|
||||
behavior = cmp.ConfirmBehavior.Replace,
|
||||
select = true,
|
||||
}),
|
||||
},
|
||||
formatting = {
|
||||
format = lspkind.cmp_format({
|
||||
mode = "symbol_text",
|
||||
max_width = 50,
|
||||
symbol_map = { Copilot = "" },
|
||||
}),
|
||||
},
|
||||
sources = {
|
||||
{ name = "copilot" },
|
||||
{ name = "vim-dadbod-completion", filetype = "sql" },
|
||||
{ name = "nvim_lua" },
|
||||
{ name = "nvim_lsp" },
|
||||
{ name = "luasnip" },
|
||||
{ name = "emoji" },
|
||||
{ name = "path" },
|
||||
{ name = "buffer" },
|
||||
{ name = "buffer" },
|
||||
{ name = "calc" },
|
||||
},
|
||||
})
|
||||
|
||||
-- Use buffer source for `/` (if you enabled `native_menu`, this won't work anymore).
|
||||
cmp.setup.cmdline("/", {
|
||||
sources = {
|
||||
{ name = "buffer" },
|
||||
},
|
||||
})
|
||||
|
||||
-- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore).
|
||||
cmp.setup.cmdline(":", {
|
||||
sources = cmp.config.sources({
|
||||
{ name = "path" },
|
||||
}, {
|
||||
{ name = "cmdline" },
|
||||
}),
|
||||
})
|
||||
|
||||
cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done({ map_char = { tex = "" } }))
|
@ -1,83 +0,0 @@
|
||||
-----------------------------------
|
||||
-- Welcome Screen Configuration --
|
||||
-----------------------------------
|
||||
|
||||
-- Call Alpha With A pcall
|
||||
local status_ok, alpha = pcall(require, "alpha")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
-- Enable Alpha Dashboard
|
||||
local dashboard = require("alpha.themes.dashboard")
|
||||
|
||||
-- Remove These ~ ~ ~
|
||||
vim.opt.fillchars:append({ eob = " " })
|
||||
|
||||
-- Disable Status Line so that alpha dashboard look nice
|
||||
-- vim.cmd [[ au User AlphaReady if winnr('$') == 1 | set laststatus=1 ]]
|
||||
|
||||
-- Custom Footer
|
||||
dashboard.section.footer.val = {
|
||||
"Write Programs That Do One Thing And Do It Well.",
|
||||
}
|
||||
|
||||
-- Custom Section
|
||||
dashboard.section.buttons.val = {
|
||||
dashboard.button("n", " Create New file", ":set laststatus=3 | :ene <BAR> startinsert <CR>"),
|
||||
dashboard.button("e", " Open File Manager", ":set laststatus=3 | :NvimTreeOpen <CR>"),
|
||||
dashboard.button("s", "Δ Search Sessions", ":Telescope persisted<CR>"),
|
||||
dashboard.button("v", " Neovim Settings ", ":set laststatus=3 | e ~/.config/nvim/init.lua <CR>"),
|
||||
dashboard.button("b", "⟳ Recent Files", ":Telescope oldfiles<CR>"),
|
||||
-- dashboard.button("s", " Shell Configuration", ":set laststatus=3 | e ~/.config/zsh/.zshrc <CR>"),
|
||||
dashboard.button("u", " Update Nvim Plugins", ":Lazy update <CR>"),
|
||||
dashboard.button("q", " Quit Neovim", ":qa<CR>"),
|
||||
}
|
||||
|
||||
-- LuaVim Ascii Art
|
||||
dashboard.section.header.val = {
|
||||
[[███╗ ███╗ █████╗ ██╗ ██╗ ███╗ ██╗ ██╗ ██╗██╗███╗ ███╗]],
|
||||
[[████╗ ████║██╔══██╗╚██╗██╔╝ ████╗ ██║ ██║ ██║██║████╗ ████║]],
|
||||
[[██╔████╔██║███████║ ╚███╔╝ ██╔██╗ ██║ ██║ ██║██║██╔████╔██║]],
|
||||
[[██║╚██╔╝██║██╔══██║ ██╔██╗ ██║╚██╗██║ ╚██╗ ██╔╝██║██║╚██╔╝██║]],
|
||||
[[██║ ╚═╝ ██║██║ ██║██╔╝ ██╗ ██║ ╚████║ ╚████╔╝ ██║██║ ╚═╝ ██║]],
|
||||
[[╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝ ╚═╝ ╚═══╝ ╚═══╝ ╚═╝╚═╝ ╚═╝]],
|
||||
}
|
||||
|
||||
dashboard.section.header.val = {
|
||||
[[ __ ]],
|
||||
[[ /\ \ ]],
|
||||
[[ / /\ \ ]],
|
||||
[[/ /__\ \ ]],
|
||||
[[\/____\/ ]],
|
||||
}
|
||||
|
||||
-- dashboard.section.header.val = {
|
||||
-- [[ ____]],
|
||||
-- [[ /\ \]],
|
||||
-- [[ / \ \]],
|
||||
-- [[ / \ \]],
|
||||
-- [[ / \ \]],
|
||||
-- [[ / /\ \ \]],
|
||||
-- [[ / / \ \ \]],
|
||||
-- [[ / / \ \ \]],
|
||||
-- [[ / / / \ \ \]],
|
||||
-- [[ / / / \ \ \]],
|
||||
-- [[ / / /---------' \]],
|
||||
-- [[/ / /_______________\]],
|
||||
-- [[\ / /]],
|
||||
-- [[ \/_____________________/ ]],
|
||||
-- }
|
||||
|
||||
|
||||
-- Layout For Luavim ascii art
|
||||
dashboard.config.layout = {
|
||||
{ type = "padding", val = 5 },
|
||||
dashboard.section.header,
|
||||
{ type = "padding", val = 2 },
|
||||
dashboard.section.buttons,
|
||||
{ type = "padding", val = 1 },
|
||||
dashboard.section.footer,
|
||||
}
|
||||
|
||||
alpha.setup(dashboard.opts)
|
@ -1,241 +0,0 @@
|
||||
local mason = require("mason")
|
||||
local mason_lsp = require("mason-lspconfig")
|
||||
local lsp = require("lspconfig")
|
||||
|
||||
require("null-ls").setup({
|
||||
sources = {
|
||||
require("null-ls").builtins.formatting.stylua,
|
||||
require("null-ls").builtins.diagnostics.eslint,
|
||||
require("null-ls").builtins.code_actions.eslint_d,
|
||||
-- require("null-ls").builtins.completion.spell,
|
||||
},
|
||||
})
|
||||
|
||||
mason.setup()
|
||||
|
||||
mason_lsp.setup({
|
||||
ensure_installed = { "sumneko_lua", "jsonls", "tsserver", "svelte", "cssls" },
|
||||
})
|
||||
|
||||
local runtime_path = vim.split(package.path, ";")
|
||||
table.insert(runtime_path, "lua/?.lua")
|
||||
table.insert(runtime_path, "lua/?/init.lua")
|
||||
|
||||
local function on_attach(client, bufnr)
|
||||
local cap = client.server_capabilities
|
||||
|
||||
if cap.documentFormattingProvider then
|
||||
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||
buffer = bufnr,
|
||||
callback = function()
|
||||
vim.lsp.buf.format()
|
||||
|
||||
if client.name == "tsserver" or client.name == "svelte" then
|
||||
-- params for the request
|
||||
local params = {
|
||||
command = "_typescript.organizeImports",
|
||||
arguments = { vim.api.nvim_buf_get_name(bufnr) },
|
||||
title = "",
|
||||
}
|
||||
|
||||
-- perform a syncronous request
|
||||
-- 500ms timeout depending on the size of file a bigger timeout may be needed
|
||||
vim.lsp.buf_request_sync(bufnr, "workspace/executeCommand", params, 500)
|
||||
end
|
||||
end,
|
||||
})
|
||||
else
|
||||
-- vim.notify("Lsp (" .. client.name .. ") doesnt support format")
|
||||
end
|
||||
end
|
||||
|
||||
lsp.sumneko_lua.setup({
|
||||
on_attach = on_attach,
|
||||
settings = {
|
||||
Lua = {
|
||||
runtime = {
|
||||
-- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim)
|
||||
version = "LuaJIT",
|
||||
-- Setup your lua path
|
||||
path = runtime_path,
|
||||
},
|
||||
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,
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
local capabilities = require("cmp_nvim_lsp").default_capabilities()
|
||||
|
||||
capabilities.textDocument.completion.completionItem.snippetSupport = true
|
||||
|
||||
lsp.prismals.setup({
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
})
|
||||
|
||||
lsp.emmet_ls.setup({
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
})
|
||||
|
||||
lsp.solargraph.setup({
|
||||
filetypes = { "ruby" },
|
||||
on_attach = on_attach,
|
||||
})
|
||||
|
||||
lsp.elixirls.setup({
|
||||
on_attach = on_attach,
|
||||
})
|
||||
|
||||
lsp.jsonls.setup({
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
settings = {
|
||||
provideFormatter = false,
|
||||
json = {
|
||||
schemas = {
|
||||
{
|
||||
description = "TypeScript compiler configuration file",
|
||||
fileMatch = { "tsconfig.json", "tsconfig.*.json" },
|
||||
url = "http://json.schemastore.org/tsconfig",
|
||||
},
|
||||
{
|
||||
description = "ESLint config",
|
||||
fileMatch = { ".eslintrc.json", ".eslintrc" },
|
||||
url = "http://json.schemastore.org/eslintrc",
|
||||
},
|
||||
{
|
||||
description = "Prettier config",
|
||||
fileMatch = { ".prettierrc", ".prettierrc.json", "prettier.config.json" },
|
||||
url = "http://json.schemastore.org/prettierrc",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
lsp.svelte.setup({
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
})
|
||||
lsp.tsserver.setup({
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
})
|
||||
lsp.html.setup({
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
})
|
||||
lsp.phpactor.setup({
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
})
|
||||
lsp.intelephense.setup({
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
settings = {
|
||||
intelephense = {
|
||||
stubs = {
|
||||
"wordpress",
|
||||
"woocommerce",
|
||||
"wordpress-globals",
|
||||
"wp-cli",
|
||||
},
|
||||
environment = {
|
||||
includePaths = "/home/max/.composer/vendor/php-stubs/", -- this line forces the composer path for the stubs in case inteliphense don't find it...
|
||||
},
|
||||
files = {
|
||||
maxSize = 5000000,
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
lsp.cssls.setup({
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
})
|
||||
|
||||
lsp.zls.setup({
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
})
|
||||
|
||||
lsp.bashls.setup({
|
||||
capabilities = capabilities,
|
||||
filetypes = { "sh", "bash" },
|
||||
on_attach = on_attach,
|
||||
})
|
||||
|
||||
lsp.rust_analyzer.setup({
|
||||
on_attach = on_attach,
|
||||
settings = {
|
||||
["rust-analyzer"] = {
|
||||
imports = {
|
||||
granularity = {
|
||||
group = "module",
|
||||
},
|
||||
prefix = "self",
|
||||
},
|
||||
cargo = {
|
||||
buildScripts = {
|
||||
enable = true,
|
||||
},
|
||||
},
|
||||
procMacro = {
|
||||
enable = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
lsp.gopls.setup({
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
})
|
||||
|
||||
lsp.yamlls.setup({
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
settings = {
|
||||
yaml = {
|
||||
schemas = {
|
||||
["https://raw.githubusercontent.com/quantumblacklabs/kedro/develop/static/jsonschema/kedro-catalog-0.17.json"] = "conf/**/*catalog*",
|
||||
["https://json.schemastore.org/github-workflow.json"] = "/.github/workflows/*",
|
||||
["https://raw.githubusercontent.com/SchemaStore/schemastore/master/src/schemas/json/traefik-v2-file-provider.json"] = "rules.yml",
|
||||
["https://raw.githubusercontent.com/SchemaStore/schemastore/master/src/schemas/json/traefik-v2.json"] = "traefik.yml",
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
lsp.glslls.setup(require("configs.lsp-glsl"))
|
||||
|
||||
lsp.ltex.setup({
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
settings = {
|
||||
ltex = {
|
||||
language = "de",
|
||||
disabledRules = { ["en-US"] = { "PROFANITY" } },
|
||||
dictionary = {
|
||||
["en-US"] = { "perf", "ci", "neovim" },
|
||||
},
|
||||
hiddenFalsePositives = {
|
||||
"neovim",
|
||||
"Neovim",
|
||||
"waybar",
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
@ -1,13 +0,0 @@
|
||||
require("persistence").setup({
|
||||
autoload = true,
|
||||
use_git_branch = false,
|
||||
before_save = function()
|
||||
pcall(vim.cmd, ":NvimTreeClose")
|
||||
end,
|
||||
after_source = function()
|
||||
-- Reload the LSP servers
|
||||
vim.lsp.stop_client(vim.lsp.get_active_clients())
|
||||
pcall(vim.cmd, ":NvimTreeOpen");
|
||||
end,
|
||||
dir = vim.fn.stdpath('data') .. '/sessions/'
|
||||
})
|
@ -1,58 +0,0 @@
|
||||
local languages = require "configs.translate.languages";
|
||||
local pickers = require 'telescope.pickers'
|
||||
local finders = require 'telescope.finders'
|
||||
local actions = require 'telescope.actions'
|
||||
local action_state = require 'telescope.actions.state'
|
||||
local conf = require('telescope.config').values
|
||||
|
||||
return function()
|
||||
|
||||
-- This active_buf and active selection because telescope clears everything (i think)
|
||||
local active_buf = vim.api.nvim_get_current_buf();
|
||||
local mode = vim.api.nvim_get_mode().mode;
|
||||
vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes("<Esc>", true, false, true), 'x!', true)
|
||||
local start_mark = vim.api.nvim_buf_get_mark(active_buf, "<")
|
||||
local end_mark = vim.api.nvim_buf_get_mark(active_buf, ">")
|
||||
|
||||
pickers
|
||||
.new({}, {
|
||||
prompt_title = 'Translate',
|
||||
finder = finders.new_table {
|
||||
results = languages,
|
||||
entry_maker = function(entry)
|
||||
return {
|
||||
value = entry[2],
|
||||
ordinal = entry[1] .. " " .. entry[2],
|
||||
display = entry[3] .. entry[1],
|
||||
}
|
||||
end,
|
||||
},
|
||||
sorter = conf.generic_sorter {},
|
||||
attach_mappings = function(prompt_bufnr)
|
||||
actions.select_default:replace(function()
|
||||
actions.close(prompt_bufnr)
|
||||
|
||||
local selection = action_state.get_selected_entry()
|
||||
|
||||
vim.api.nvim_set_current_buf(active_buf)
|
||||
|
||||
vim.api.nvim_win_set_cursor(0, start_mark);
|
||||
vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes(mode, true, false, true), 'x!', true)
|
||||
vim.api.nvim_win_set_cursor(0, end_mark);
|
||||
|
||||
local timer = vim.loop.new_timer()
|
||||
timer:start(500, 0, vim.schedule_wrap(function()
|
||||
if mode == "v" or mode == "V" then
|
||||
vim.cmd("'<,'>Translate " .. selection.value)
|
||||
else
|
||||
vim.cmd("Translate " .. selection.value)
|
||||
end
|
||||
end))
|
||||
end)
|
||||
return true
|
||||
end,
|
||||
previewer = nil
|
||||
})
|
||||
:find()
|
||||
|
||||
end
|
@ -1,29 +0,0 @@
|
||||
local config_group = vim.api.nvim_create_augroup("Config", {})
|
||||
|
||||
vim.api.nvim_create_autocmd({ "TextYankPost" }, {
|
||||
group = config_group,
|
||||
callback = function()
|
||||
vim.highlight.on_yank()
|
||||
end,
|
||||
})
|
||||
|
||||
-- local rememberFoldsGroup = vim.api.nvim_create_augroup('RememberFolds', { clear = true })
|
||||
--
|
||||
-- vim.api.nvim_create_autocmd({ 'BufWinLeave', 'BufLeave' }, {
|
||||
-- pattern = "*",
|
||||
-- group = rememberFoldsGroup,
|
||||
-- command = 'mkview'
|
||||
-- })
|
||||
--
|
||||
-- vim.api.nvim_create_autocmd('BufWinEnter', {
|
||||
-- pattern = "*",
|
||||
-- group = rememberFoldsGroup,
|
||||
-- command = 'silent! loadview'
|
||||
-- })
|
||||
|
||||
vim.cmd([[
|
||||
augroup filetypedetect
|
||||
au BufNewFile,BufRead *.frag setl ft=glsl
|
||||
au BufNewFile,BufRead *.vert setl ft=glsl
|
||||
augroup END
|
||||
]])
|
@ -1,129 +0,0 @@
|
||||
-- local map = vim.api.nvim_set_keymap
|
||||
local map = vim.keymap.set
|
||||
local g = vim.g
|
||||
local translate = require("configs.translate")
|
||||
|
||||
local saga = require("lspsaga")
|
||||
saga.init_lsp_saga()
|
||||
|
||||
local options = { noremap = true, silent = true }
|
||||
local remap = { noremap = true }
|
||||
|
||||
g.mapleader = " "
|
||||
|
||||
-- Allows to easily exit terminal mode
|
||||
-- map('t', '<Esc>', [[<C-\><C-n>]], remap)
|
||||
|
||||
map("n", "<C-o>", ":Telescope find_files preview={timeout=1000}<CR>", options)
|
||||
map("n", "<C-f>", ":lua require'telescope.builtin'.live_grep{ cwd = vim.fn.getcwd() }<CR>", options)
|
||||
-- map("n", "<C-p>", ":Telescope command_center<CR>", options)
|
||||
map("n", "<Leader><Leader>", "za", remap)
|
||||
|
||||
-- LSP Functionality
|
||||
map("n", "<Leader>n", ":lua vim.diagnostic.goto_next()<CR>", options)
|
||||
map("n", "<Leader>p", ":lua vim.diagnostic.goto_prev()<CR>", options)
|
||||
map("n", "gD", "<Cmd>lua vim.lsp.buf.declaration()<CR>", options)
|
||||
map("n", "gd", "<Cmd>lua vim.lsp.buf.definition()<CR>", options)
|
||||
map("n", "gi", "<cmd>lua vim.lsp.buf.implementation()<CR>", options)
|
||||
|
||||
map("n", "K", "<cmd>Lspsaga hover_doc<CR>", { silent = true })
|
||||
-- map("n", "<leader>o", "<cmd>LSoutlineToggle<CR>", { silent = true })
|
||||
map("n", "<leader>e", "<cmd>lua vim.lsp.buf.hover()<CR>", { silent = true })
|
||||
map("n", "<Leader>rn", "<cmd>lua vim.lsp.buf.rename()<CR>", options)
|
||||
map({ "n", "v" }, "<leader>c", "<cmd>Lspsaga code_action<CR>", { silent = true })
|
||||
map({ "n", "v" }, "gr", "<cmd>Lspsaga lsp_finder<CR>", options)
|
||||
map("n", "<S-U>", ":UndotreeToggle<CR>", options)
|
||||
|
||||
map("n", "<leader>t", ":TroubleToggle<CR>", remap)
|
||||
|
||||
map({ "n", "v" }, "<leader>t", translate, remap)
|
||||
|
||||
-- DAP Functionality
|
||||
map("n", "<Leader>b", ":lua require('dap').toggle_breakpoint()<CR>", options)
|
||||
|
||||
-- Test Functionality
|
||||
map("n", "tt", ":lua require('neotest').run.run()<CR>", options)
|
||||
map("n", "to", ":lua require('neotest').summary.open()<CR>", options)
|
||||
|
||||
map({ "n", "v" }, "+", "<cmd>:Boole increment<CR>", options)
|
||||
map({ "n", "v" }, "-", "<cmd>:Boole decrement<CR>", options)
|
||||
|
||||
-- Navigate Buffers
|
||||
map("n", "<C-h>", "<C-w>h", options)
|
||||
map("n", "<C-j>", "<C-w>j", options)
|
||||
map("n", "<C-k>", "<C-w>k", options)
|
||||
map("n", "<C-l>", "<C-w>l", options)
|
||||
|
||||
map("n", "<Leader>1", "1gt", options)
|
||||
map("n", "<Leader>2", "2gt", options)
|
||||
map("n", "<Leader>3", "3gt", options)
|
||||
map("n", "<Leader>4", "4gt", options)
|
||||
map("n", "<Leader>0", ":tablast<CR>", options)
|
||||
|
||||
map("n", "m", ":lua require('harpoon.mark').add_file()<CR>", options)
|
||||
-- Navigate Files
|
||||
map("n", "<S-t>", ":Telescope harpoon marks<CR>", options)
|
||||
|
||||
-- Handling Splits
|
||||
map("n", "<C-w>h", ":sp<CR>", remap) -- horizontal
|
||||
map("n", "<C-w>v", ":vs<CR>", remap) -- vertical
|
||||
|
||||
-- Browser like next/previous
|
||||
map("n", "<A-Left>", ":bprevious<CR>", options)
|
||||
map("n", "<A-Right>", ":bnext<CR>", options)
|
||||
|
||||
-- Backspace Delete like Browser
|
||||
map("i", "<C-H>", "<Esc>dbxi", options)
|
||||
|
||||
-- Copy visual selection to keyboard
|
||||
map("v", "Y", '"+y', options)
|
||||
map("n", "<Leader>k", "{", options)
|
||||
map("n", "<Leader>j", "}", options)
|
||||
|
||||
-- I dont use macros at the moment, can disable this if i want to
|
||||
-- map('v', 'Q', 'q', {})
|
||||
-- map('v', 'Q', 'q', {})
|
||||
-- map('n', 'q', '<nop>', {})
|
||||
-- map('n', 'q', '<nop>', {})
|
||||
|
||||
-- Move lines vscode style
|
||||
map("n", "<A-j>", "<cmd>move +1<CR>", options)
|
||||
map("n", "<A-k>", "<cmd>move -2<CR>", options)
|
||||
map("i", "<A-j>", "<cmd>move +1<CR>", options)
|
||||
map("i", "<A-k>", "<cmd>move -2<CR>", options)
|
||||
map("v", "<A-j>", ":m '>+1<CR>gv=gv", options)
|
||||
map("v", "<A-k>", ":m '<-2<CR>gv=gv", options)
|
||||
map("n", "<A-S-k>", "YP", options)
|
||||
map("n", "<A-S-j>", "Yp", options)
|
||||
|
||||
-- Faster git merge
|
||||
map("n", "<Leader>gd", ":Gvdiffsplit!<CR>", options)
|
||||
map("n", "<Leader>gdl", ":diffget //3<CR>", options)
|
||||
map("n", "<Leader>gdh", ":diffget //2<CR>", options)
|
||||
|
||||
-- Find file in NvimTree
|
||||
map("n", "<Leader>f", ":NvimTreeFindFile<CR><c-w>", options)
|
||||
|
||||
map("n", "<C-->", ":vsplit<CR>", options)
|
||||
map("n", "<C-|>", ":split<CR>", options)
|
||||
|
||||
-- I aint no weak boy
|
||||
map("n", "<Left>", ":echo 'No Left for you'<CR><i><dw>", options)
|
||||
map("n", "<Right>", ":echo 'No Right for you'<CR><dw>", options)
|
||||
map("n", "<Up>", ":echo 'No Up for you'<CR><dw>", options)
|
||||
map("n", "<Down>", ":echo 'No Down for you'<CR><dw>", options)
|
||||
|
||||
-- Run Requests
|
||||
map("n", "<Leader>r", ":SnipRun<CR>", options)
|
||||
map("v", "<Leader>r", ":'<,'>SnipRun<CR>", options)
|
||||
|
||||
-- Close on q
|
||||
map("n", "<Leader>q", "<Esc>:q<CR>", options)
|
||||
map("n", "<Leader><C-q>", "<Esc>:qall<CR>", options)
|
||||
|
||||
-- Open Nerdtree
|
||||
map("n", "<C-n>", ":NvimTreeToggle<CR>", options)
|
||||
|
||||
-- Make ctrl+s work
|
||||
map("n", "<C-s>", "<Esc>:w<CR>", options)
|
||||
map("i", "<C-s>", "<Esc>:w<CR>i", options)
|
113
configs/nvim/lua/max/configs/autocomplete.lua
Normal file
113
configs/nvim/lua/max/configs/autocomplete.lua
Normal file
@ -0,0 +1,113 @@
|
||||
-- luasnip setup
|
||||
local luasnip = require("luasnip")
|
||||
|
||||
require("luasnip/loaders/from_vscode").lazy_load()
|
||||
|
||||
local lspkind = require("lspkind")
|
||||
local cmp = require("cmp")
|
||||
local cmp_autopairs = require("nvim-autopairs.completion.cmp")
|
||||
|
||||
local capabilities = require("cmp_nvim_lsp").default_capabilities()
|
||||
require("lspconfig").html.setup({
|
||||
capabilities = capabilities,
|
||||
})
|
||||
|
||||
require("nvim-autopairs").setup()
|
||||
require("copilot").setup()
|
||||
require("copilot_cmp").setup({
|
||||
clear_after_cursor = true,
|
||||
})
|
||||
|
||||
local check_backspace = function()
|
||||
local col = vim.fn.col(".") - 1
|
||||
return col == 0 or vim.fn.getline("."):sub(col, col):match("%s")
|
||||
end
|
||||
|
||||
cmp.setup({
|
||||
window = {
|
||||
documentation = cmp.config.window.bordered(),
|
||||
},
|
||||
experimental = {
|
||||
ghost_text = true,
|
||||
},
|
||||
completion = {
|
||||
completeopt = "menuone,noselect",
|
||||
},
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
luasnip.lsp_expand(args.body)
|
||||
end,
|
||||
},
|
||||
mapping = {
|
||||
["<C-Leader>"] = cmp.mapping.complete({}),
|
||||
["<C-Space>"] = cmp.mapping(cmp.mapping.complete(), { "i", "c" }),
|
||||
["<Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_next_item()
|
||||
elseif luasnip.expandable() then
|
||||
luasnip.expand()
|
||||
elseif luasnip.expand_or_jumpable() then
|
||||
luasnip.expand_or_jump()
|
||||
elseif check_backspace() then
|
||||
fallback()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, {
|
||||
"i",
|
||||
"s",
|
||||
}),
|
||||
["<S-Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_prev_item()
|
||||
elseif luasnip.jumpable(-1) then
|
||||
luasnip.jump(-1)
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, {
|
||||
"i",
|
||||
"s",
|
||||
}),
|
||||
["<CR>"] = cmp.mapping.confirm({
|
||||
behavior = cmp.ConfirmBehavior.Replace,
|
||||
select = true,
|
||||
}),
|
||||
},
|
||||
formatting = {
|
||||
format = lspkind.cmp_format({
|
||||
mode = "symbol_text",
|
||||
max_width = 50,
|
||||
symbol_map = { Copilot = "" },
|
||||
}),
|
||||
},
|
||||
sources = {
|
||||
{ name = "copilot" },
|
||||
{ name = "vim-dadbod-completion", filetype = "sql" },
|
||||
{ name = "nvim_lua" },
|
||||
{ name = "nvim_lsp" },
|
||||
{ name = "luasnip" },
|
||||
{ name = "emoji" },
|
||||
{ name = "path" },
|
||||
{ name = "buffer" },
|
||||
{ name = "calc" },
|
||||
},
|
||||
})
|
||||
|
||||
-- Use buffer source for `/` (if you enabled `native_menu`, this won't work anymore).
|
||||
cmp.setup.cmdline("/", {
|
||||
sources = {
|
||||
{ name = "buffer" },
|
||||
},
|
||||
})
|
||||
|
||||
-- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore).
|
||||
cmp.setup.cmdline(":", {
|
||||
sources = cmp.config.sources({
|
||||
{ name = "path" },
|
||||
}, {
|
||||
{ name = "cmdline" },
|
||||
}),
|
||||
})
|
||||
|
||||
cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done({ map_char = { tex = "" } }))
|
82
configs/nvim/lua/max/configs/dashboard.lua
Normal file
82
configs/nvim/lua/max/configs/dashboard.lua
Normal file
@ -0,0 +1,82 @@
|
||||
-----------------------------------
|
||||
-- Welcome Screen Configuration --
|
||||
-----------------------------------
|
||||
|
||||
-- Call Alpha With A pcall
|
||||
local status_ok, alpha = pcall(require, "alpha")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
-- Enable Alpha Dashboard
|
||||
local dashboard = require("alpha.themes.dashboard")
|
||||
|
||||
-- Remove These ~ ~ ~
|
||||
vim.opt.fillchars:append({ eob = " " })
|
||||
|
||||
-- Disable Status Line so that alpha dashboard look nice
|
||||
-- vim.cmd [[ au User AlphaReady if winnr('$') == 1 | set laststatus=1 ]]
|
||||
|
||||
-- Custom Footer
|
||||
dashboard.section.footer.val = {
|
||||
"Write Programs That Do One Thing And Do It Well.",
|
||||
}
|
||||
|
||||
-- Custom Section
|
||||
dashboard.section.buttons.val = {
|
||||
dashboard.button("n", " Create New file", ":set laststatus=3 | :ene <BAR> startinsert <CR>"),
|
||||
dashboard.button("e", " Open File Manager", ":set laststatus=3 | :NvimTreeOpen <CR>"),
|
||||
dashboard.button("s", "Δ Search Sessions", ":Telescope persisted<CR>"),
|
||||
dashboard.button("v", " Neovim Settings ", ":set laststatus=3 | e ~/.config/nvim/init.lua <CR>"),
|
||||
dashboard.button("b", "⟳ Recent Files", ":Telescope oldfiles<CR>"),
|
||||
-- dashboard.button("s", " Shell Configuration", ":set laststatus=3 | e ~/.config/zsh/.zshrc <CR>"),
|
||||
dashboard.button("u", " Update Nvim Plugins", ":Lazy update <CR>"),
|
||||
dashboard.button("q", " Quit Neovim", ":qa<CR>"),
|
||||
}
|
||||
|
||||
-- LuaVim Ascii Art
|
||||
dashboard.section.header.val = {
|
||||
[[███╗ ███╗ █████╗ ██╗ ██╗ ███╗ ██╗ ██╗ ██╗██╗███╗ ███╗]],
|
||||
[[████╗ ████║██╔══██╗╚██╗██╔╝ ████╗ ██║ ██║ ██║██║████╗ ████║]],
|
||||
[[██╔████╔██║███████║ ╚███╔╝ ██╔██╗ ██║ ██║ ██║██║██╔████╔██║]],
|
||||
[[██║╚██╔╝██║██╔══██║ ██╔██╗ ██║╚██╗██║ ╚██╗ ██╔╝██║██║╚██╔╝██║]],
|
||||
[[██║ ╚═╝ ██║██║ ██║██╔╝ ██╗ ██║ ╚████║ ╚████╔╝ ██║██║ ╚═╝ ██║]],
|
||||
[[╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝ ╚═╝ ╚═══╝ ╚═══╝ ╚═╝╚═╝ ╚═╝]],
|
||||
}
|
||||
|
||||
dashboard.section.header.val = {
|
||||
[[ __ ]],
|
||||
[[ /\ \ ]],
|
||||
[[ / /\ \ ]],
|
||||
[[/ /__\ \ ]],
|
||||
[[\/____\/ ]],
|
||||
}
|
||||
|
||||
-- dashboard.section.header.val = {
|
||||
-- [[ ____]],
|
||||
-- [[ /\ \]],
|
||||
-- [[ / \ \]],
|
||||
-- [[ / \ \]],
|
||||
-- [[ / \ \]],
|
||||
-- [[ / /\ \ \]],
|
||||
-- [[ / / \ \ \]],
|
||||
-- [[ / / \ \ \]],
|
||||
-- [[ / / / \ \ \]],
|
||||
-- [[ / / / \ \ \]],
|
||||
-- [[ / / /---------' \]],
|
||||
-- [[/ / /_______________\]],
|
||||
-- [[\ / /]],
|
||||
-- [[ \/_____________________/ ]],
|
||||
-- }
|
||||
|
||||
-- Layout For Luavim ascii art
|
||||
dashboard.config.layout = {
|
||||
{ type = "padding", val = 5 },
|
||||
dashboard.section.header,
|
||||
{ type = "padding", val = 2 },
|
||||
dashboard.section.buttons,
|
||||
{ type = "padding", val = 1 },
|
||||
dashboard.section.footer,
|
||||
}
|
||||
|
||||
alpha.setup(dashboard.opts)
|
15
configs/nvim/lua/max/configs/litee.lua
Normal file
15
configs/nvim/lua/max/configs/litee.lua
Normal file
@ -0,0 +1,15 @@
|
||||
require("litee.lib").setup({
|
||||
tree = {
|
||||
icon_set = "codicons",
|
||||
},
|
||||
panel = {
|
||||
orientation = "right",
|
||||
panel_size = 30,
|
||||
},
|
||||
})
|
||||
require("litee.symboltree").setup({
|
||||
icon_set = "codicons",
|
||||
})
|
||||
require("litee.calltree").setup({
|
||||
icon_set = "codicons",
|
||||
})
|
251
configs/nvim/lua/max/configs/lsp.lua
Normal file
251
configs/nvim/lua/max/configs/lsp.lua
Normal file
@ -0,0 +1,251 @@
|
||||
local mason = require("mason")
|
||||
local mason_lsp = require("mason-lspconfig")
|
||||
local lsp = require("lspconfig")
|
||||
|
||||
require("null-ls").setup({
|
||||
sources = {
|
||||
require("null-ls").builtins.formatting.stylua,
|
||||
require("null-ls").builtins.diagnostics.eslint,
|
||||
require("null-ls").builtins.code_actions.eslint_d,
|
||||
-- require("null-ls").builtins.completion.spell,
|
||||
},
|
||||
})
|
||||
|
||||
mason.setup()
|
||||
|
||||
mason_lsp.setup({
|
||||
ensure_installed = { "sumneko_lua", "jsonls", "tsserver", "svelte", "cssls" },
|
||||
})
|
||||
|
||||
local runtime_path = vim.split(package.path, ";")
|
||||
table.insert(runtime_path, "lua/?.lua")
|
||||
table.insert(runtime_path, "lua/?/init.lua")
|
||||
|
||||
local function on_attach(client, bufnr)
|
||||
if client.supports_method("textDocument/formatting") then
|
||||
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||
buffer = bufnr,
|
||||
callback = function()
|
||||
vim.lsp.buf.format()
|
||||
|
||||
if client.name == "tsserver" or client.name == "svelte" then
|
||||
-- params for the request
|
||||
local params = {
|
||||
command = "_typescript.organizeImports",
|
||||
arguments = { vim.api.nvim_buf_get_name(bufnr) },
|
||||
title = "",
|
||||
}
|
||||
|
||||
-- perform a syncronous request
|
||||
-- 500ms timeout depending on the size of file a bigger timeout may be needed
|
||||
vim.lsp.buf_request_sync(bufnr, "workspace/executeCommand", params, 500)
|
||||
end
|
||||
end,
|
||||
})
|
||||
else
|
||||
-- vim.notify("Lsp (" .. client.name .. ") doesnt support format")
|
||||
end
|
||||
end
|
||||
|
||||
lsp.sumneko_lua.setup({
|
||||
on_attach = on_attach,
|
||||
settings = {
|
||||
Lua = {
|
||||
runtime = {
|
||||
-- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim)
|
||||
version = "LuaJIT",
|
||||
-- Setup your lua path
|
||||
path = runtime_path,
|
||||
},
|
||||
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,
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
local capabilities = require("cmp_nvim_lsp").default_capabilities()
|
||||
|
||||
capabilities.textDocument.completion.completionItem.snippetSupport = true
|
||||
|
||||
lsp.prismals.setup({
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
})
|
||||
|
||||
lsp.emmet_ls.setup({
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
})
|
||||
|
||||
lsp.solargraph.setup({
|
||||
filetypes = { "ruby" },
|
||||
on_attach = on_attach,
|
||||
})
|
||||
|
||||
lsp.elixirls.setup({
|
||||
on_attach = on_attach,
|
||||
})
|
||||
|
||||
lsp.jsonls.setup({
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
settings = {
|
||||
provideFormatter = false,
|
||||
json = {
|
||||
schemas = {
|
||||
{
|
||||
description = "TypeScript compiler configuration file",
|
||||
fileMatch = { "tsconfig.json", "tsconfig.*.json" },
|
||||
url = "http://json.schemastore.org/tsconfig",
|
||||
},
|
||||
{
|
||||
description = "ESLint config",
|
||||
fileMatch = { ".eslintrc.json", ".eslintrc" },
|
||||
url = "http://json.schemastore.org/eslintrc",
|
||||
},
|
||||
{
|
||||
description = "Prettier config",
|
||||
fileMatch = { ".prettierrc", ".prettierrc.json", "prettier.config.json" },
|
||||
url = "http://json.schemastore.org/prettierrc",
|
||||
},
|
||||
{
|
||||
description = "JSON schema for Import Maps files",
|
||||
fileMatch = { "importmap.json", "import_map.json", "import-map.json" },
|
||||
name = "importmap.json",
|
||||
url = "https://json.schemastore.org/importmap.json",
|
||||
},
|
||||
{
|
||||
description = "NPM configuration file",
|
||||
fileMatch = { "package.json" },
|
||||
name = "package.json",
|
||||
url = "https://json.schemastore.org/package.json",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
lsp.svelte.setup({
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
})
|
||||
lsp.tsserver.setup({
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
})
|
||||
lsp.html.setup({
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
})
|
||||
lsp.phpactor.setup({
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
})
|
||||
lsp.intelephense.setup({
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
settings = {
|
||||
intelephense = {
|
||||
stubs = {
|
||||
"wordpress",
|
||||
"woocommerce",
|
||||
"wordpress-globals",
|
||||
"wp-cli",
|
||||
},
|
||||
environment = {
|
||||
includePaths = "/home/max/.composer/vendor/php-stubs/", -- this line forces the composer path for the stubs in case inteliphense don't find it...
|
||||
},
|
||||
files = {
|
||||
maxSize = 5000000,
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
lsp.cssls.setup({
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
})
|
||||
|
||||
lsp.zls.setup({
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
})
|
||||
|
||||
lsp.bashls.setup({
|
||||
capabilities = capabilities,
|
||||
filetypes = { "sh", "bash" },
|
||||
on_attach = on_attach,
|
||||
})
|
||||
|
||||
lsp.rust_analyzer.setup({
|
||||
on_attach = on_attach,
|
||||
settings = {
|
||||
["rust-analyzer"] = {
|
||||
imports = {
|
||||
granularity = {
|
||||
group = "module",
|
||||
},
|
||||
prefix = "self",
|
||||
},
|
||||
cargo = {
|
||||
buildScripts = {
|
||||
enable = true,
|
||||
},
|
||||
},
|
||||
procMacro = {
|
||||
enable = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
lsp.gopls.setup({
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
})
|
||||
|
||||
lsp.yamlls.setup({
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
settings = {
|
||||
yaml = {
|
||||
schemas = {
|
||||
["https://raw.githubusercontent.com/quantumblacklabs/kedro/develop/static/jsonschema/kedro-catalog-0.17.json"] = "conf/**/*catalog*",
|
||||
["https://json.schemastore.org/github-workflow.json"] = "/.github/workflows/*",
|
||||
["https://raw.githubusercontent.com/SchemaStore/schemastore/master/src/schemas/json/traefik-v2-file-provider.json"] = "rules.yml",
|
||||
["https://raw.githubusercontent.com/SchemaStore/schemastore/master/src/schemas/json/traefik-v2.json"] = "traefik.yml",
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
lsp.glslls.setup(require("max.configs.lsp-glsl"))
|
||||
|
||||
lsp.ltex.setup({
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
settings = {
|
||||
ltex = {
|
||||
language = "de",
|
||||
disabledRules = { ["en-US"] = { "PROFANITY" } },
|
||||
dictionary = {
|
||||
["en-US"] = { "perf", "ci", "neovim" },
|
||||
},
|
||||
hiddenFalsePositives = {
|
||||
"neovim",
|
||||
"Neovim",
|
||||
"waybar",
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
@ -92,7 +92,7 @@ end
|
||||
ins_left({
|
||||
-- mode component
|
||||
function()
|
||||
return ""
|
||||
return "◬"
|
||||
end,
|
||||
color = function()
|
||||
-- auto change color according to neovims mode
|
17
configs/nvim/lua/max/configs/session.lua
Normal file
17
configs/nvim/lua/max/configs/session.lua
Normal file
@ -0,0 +1,17 @@
|
||||
require("persisted").setup({
|
||||
autoload = true,
|
||||
before_save = function()
|
||||
local tree = pcall(require, "nvim-tree")
|
||||
if tree then
|
||||
vim.cmd("NvimTreeClose")
|
||||
end
|
||||
end,
|
||||
after_save = function()
|
||||
vim.cmd("NvimTreeOpen")
|
||||
end,
|
||||
after_source = function()
|
||||
vim.lsp.stop_client(vim.lsp.get_active_clients())
|
||||
vim.cmd("filetype detect")
|
||||
end,
|
||||
})
|
||||
require("telescope").load_extension("persisted") -- To load the telescope extension
|
60
configs/nvim/lua/max/configs/translate/init.lua
Normal file
60
configs/nvim/lua/max/configs/translate/init.lua
Normal file
@ -0,0 +1,60 @@
|
||||
local languages = require("max.configs.translate.languages")
|
||||
local pickers = require("telescope.pickers")
|
||||
local finders = require("telescope.finders")
|
||||
local actions = require("telescope.actions")
|
||||
local action_state = require("telescope.actions.state")
|
||||
local conf = require("telescope.config").values
|
||||
|
||||
return function()
|
||||
-- This active_buf and active selection because telescope clears everything (i think)
|
||||
local active_buf = vim.api.nvim_get_current_buf()
|
||||
local mode = vim.api.nvim_get_mode().mode
|
||||
vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes("<Esc>", true, false, true), "x!", true)
|
||||
local start_mark = vim.api.nvim_buf_get_mark(active_buf, "<")
|
||||
local end_mark = vim.api.nvim_buf_get_mark(active_buf, ">")
|
||||
|
||||
pickers
|
||||
.new({}, {
|
||||
prompt_title = "Translate",
|
||||
finder = finders.new_table({
|
||||
results = languages,
|
||||
entry_maker = function(entry)
|
||||
return {
|
||||
value = entry[2],
|
||||
ordinal = entry[1] .. " " .. entry[2],
|
||||
display = entry[3] .. entry[1],
|
||||
}
|
||||
end,
|
||||
}),
|
||||
sorter = conf.generic_sorter({}),
|
||||
attach_mappings = function(prompt_bufnr)
|
||||
actions.select_default:replace(function()
|
||||
actions.close(prompt_bufnr)
|
||||
|
||||
local selection = action_state.get_selected_entry()
|
||||
|
||||
vim.api.nvim_set_current_buf(active_buf)
|
||||
|
||||
vim.api.nvim_win_set_cursor(0, start_mark)
|
||||
vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes(mode, true, false, true), "x!", true)
|
||||
vim.api.nvim_win_set_cursor(0, end_mark)
|
||||
|
||||
local timer = vim.loop.new_timer()
|
||||
timer:start(
|
||||
500,
|
||||
0,
|
||||
vim.schedule_wrap(function()
|
||||
if mode == "v" or mode == "V" then
|
||||
vim.cmd("'<,'>Translate " .. selection.value)
|
||||
else
|
||||
vim.cmd("Translate " .. selection.value)
|
||||
end
|
||||
end)
|
||||
)
|
||||
end)
|
||||
return true
|
||||
end,
|
||||
previewer = nil,
|
||||
})
|
||||
:find()
|
||||
end
|
@ -37,3 +37,5 @@ require("nvim-tree").setup({
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
vim.cmd("NvimTreeOpen")
|
35
configs/nvim/lua/max/core/autocommands.lua
Normal file
35
configs/nvim/lua/max/core/autocommands.lua
Normal file
@ -0,0 +1,35 @@
|
||||
local config_group = vim.api.nvim_create_augroup("Config", {})
|
||||
|
||||
vim.api.nvim_create_autocmd({ "TextYankPost" }, {
|
||||
group = config_group,
|
||||
callback = function()
|
||||
vim.highlight.on_yank()
|
||||
end,
|
||||
})
|
||||
|
||||
local rememberFoldsGroup = vim.api.nvim_create_augroup("RememberFolds", { clear = true })
|
||||
|
||||
vim.api.nvim_create_autocmd({ "BufWinLeave", "BufLeave" }, {
|
||||
pattern = "*",
|
||||
group = rememberFoldsGroup,
|
||||
command = "mkview",
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd("BufWinEnter", {
|
||||
pattern = "*",
|
||||
group = rememberFoldsGroup,
|
||||
command = "silent! loadview",
|
||||
})
|
||||
|
||||
vim.cmd([[
|
||||
augroup filetypedetect
|
||||
au BufNewFile,BufRead *.frag setl ft=glsl
|
||||
au BufNewFile,BufRead *.vert setl ft=glsl
|
||||
augroup END
|
||||
]])
|
||||
|
||||
vim.api.nvim_create_autocmd({ "BufReadPost" }, {
|
||||
pattern = "*",
|
||||
group = config_group,
|
||||
command = "filetype detect",
|
||||
})
|
119
configs/nvim/lua/max/core/keymappings.lua
Normal file
119
configs/nvim/lua/max/core/keymappings.lua
Normal file
@ -0,0 +1,119 @@
|
||||
-- local map = vim.api.nvim_set_keymap
|
||||
local map = vim.keymap.set
|
||||
local opts = { noremap = true, silent = true }
|
||||
|
||||
local translate = require("max.configs.translate")
|
||||
local saga = require("lspsaga")
|
||||
saga.init_lsp_saga()
|
||||
|
||||
-- Set Leader key
|
||||
vim.g.mapleader = " "
|
||||
|
||||
map("n", "<C-o>", ":Telescope find_files preview={timeout=1000}<CR>", opts)
|
||||
map("n", "<C-f>", ":lua require'telescope.builtin'.live_grep{ cwd = vim.fn.getcwd() }<CR>", opts)
|
||||
map("n", "<Leader><leader>", "za", opts)
|
||||
|
||||
map("n", "<Leader>is", "<cmd>lua require('litee.lib.lsp.wrappers').buf_document_symbol()<CR>", opts)
|
||||
map("n", "<Leader>io", "<cmd>LSoutlineToggle<CR>", opts)
|
||||
|
||||
map("v", ">", ">gv", opts)
|
||||
map("v", "<", "<gv", opts)
|
||||
|
||||
-- LSP Functionality
|
||||
map("n", "<Leader>n", ":lua vim.diagnostic.goto_next()<CR>", opts)
|
||||
map("n", "<Leader>p", ":lua vim.diagnostic.goto_prev()<CR>", opts)
|
||||
map("n", "gD", "<Cmd>lua vim.lsp.buf.declaration()<CR>", opts)
|
||||
map("n", "gd", "<Cmd>lua vim.lsp.buf.definition()<CR>", opts)
|
||||
map("n", "gi", "<cmd>lua vim.lsp.buf.implementation()<CR>", opts)
|
||||
|
||||
map("n", "K", "<cmd>Lspsaga hover_doc<CR>", { silent = true })
|
||||
map("n", "<Leader>e", "<cmd>lua vim.lsp.buf.hover()<CR>", { silent = true })
|
||||
map("n", "<Leader>rn", "<cmd>lua vim.lsp.buf.rename()<CR>", opts)
|
||||
map({ "n", "v" }, "<Leader>c", "<cmd>Lspsaga code_action<CR>", { silent = true })
|
||||
map({ "n", "v" }, "gr", "<cmd>Lspsaga lsp_finder<CR>", opts)
|
||||
map("n", "<S-U>", ":UndotreeToggle<CR>", opts)
|
||||
|
||||
map("n", "<Leader>ip", ":TroubleToggle<CR>", opts)
|
||||
map({ "n", "v" }, "<Leader>t", translate, opts)
|
||||
|
||||
-- DAP Functionality
|
||||
map("n", "<Leader>b", ":lua require('dap').toggle_breakpoint()<CR>", opts)
|
||||
|
||||
-- Test Functionality
|
||||
map("n", "tt", ":lua require('neotest').run.run()<CR>", opts)
|
||||
map("n", "to", ":lua require('neotest').summary.open()<CR>", opts)
|
||||
|
||||
map({ "n", "v" }, "+", "<cmd>:Boole increment<CR>", opts)
|
||||
map({ "n", "v" }, "-", "<cmd>:Boole decrement<CR>", opts)
|
||||
|
||||
-- Navigate Buffers
|
||||
map("n", "<C-h>", "<C-w>h", opts)
|
||||
map("n", "<C-j>", "<C-w>j", opts)
|
||||
map("n", "<C-k>", "<C-w>k", opts)
|
||||
map("n", "<C-l>", "<C-w>l", opts)
|
||||
|
||||
map("n", "<Leader>1", "1gt", opts)
|
||||
map("n", "<Leader>2", "2gt", opts)
|
||||
map("n", "<Leader>3", "3gt", opts)
|
||||
map("n", "<Leader>4", "4gt", opts)
|
||||
map("n", "<Leader>0", ":tablast<CR>", opts)
|
||||
|
||||
-- Browser like next/previous
|
||||
map("n", "<A-Left>", ":bprevious<CR>", opts)
|
||||
map("n", "<A-Right>", ":bnext<CR>", opts)
|
||||
|
||||
-- Backspace Delete like Browser
|
||||
-- map("i", "<C-H>", "<Esc>dbxi", opts)
|
||||
|
||||
-- Copy visual selection to keyboard
|
||||
map("v", "Y", '"+y', opts)
|
||||
map("n", "<Leader>k", "{", opts)
|
||||
map("n", "<Leader>j", "}", opts)
|
||||
|
||||
-- I dont use macros at the moment, can disable this if i want to
|
||||
-- map('v', 'Q', 'q', {})
|
||||
-- map('v', 'Q', 'q', {})
|
||||
-- map('n', 'q', '<nop>', {})
|
||||
-- map('n', 'q', '<nop>', {})
|
||||
|
||||
-- Move lines vscode style
|
||||
map("n", "<A-j>", "<cmd>move +1<CR>", opts)
|
||||
map("n", "<A-k>", "<cmd>move -2<CR>", opts)
|
||||
map("i", "<A-j>", "<cmd>move +1<CR>", opts)
|
||||
map("i", "<A-k>", "<cmd>move -2<CR>", opts)
|
||||
map("v", "<A-j>", ":m '>+1<CR>gv=gv", opts)
|
||||
map("v", "<A-k>", ":m '<-2<CR>gv=gv", opts)
|
||||
|
||||
map("v", "p", '"_dP', opts)
|
||||
|
||||
-- Faster git merge
|
||||
map("n", "<Leader>gd", ":Gvdiffsplit!<CR>", opts)
|
||||
map("n", "<Leader>gdl", ":diffget //3<CR>", opts)
|
||||
map("n", "<Leader>gdh", ":diffget //2<CR>", opts)
|
||||
|
||||
-- Find file in NvimTree
|
||||
map("n", "<Leader>e", ":NvimTreeToggle<CR>", opts)
|
||||
map("n", "<Leader>f", ":NvimTreeFindFile<CR><c-w>", opts)
|
||||
|
||||
-- I aint no weak boy
|
||||
map("n", "<Left>", ":echo 'No Left for you'<CR><i><dw>", opts)
|
||||
map("n", "<Right>", ":echo 'No Right for you'<CR><dw>", opts)
|
||||
map("n", "<Up>", ":echo 'No Up for you'<CR><dw>", opts)
|
||||
map("n", "<Down>", ":echo 'No Down for you'<CR><dw>", opts)
|
||||
|
||||
-- Run Requests
|
||||
map("n", "<Leader>r", ":SnipRun<CR>", opts)
|
||||
map("v", "<Leader>r", ":'<,'>SnipRun<CR>", opts)
|
||||
|
||||
-- Close on q
|
||||
local function closeAll()
|
||||
vim.cmd("SessionSave")
|
||||
vim.cmd("qall")
|
||||
end
|
||||
|
||||
map("n", "<Leader>q", ":q<CR>", opts)
|
||||
map("n", "<Leader><C-q>", closeAll, opts)
|
||||
|
||||
-- Make ctrl+s work
|
||||
map("n", "<C-s>", "<Esc>:w<CR>", opts)
|
||||
map("i", "<C-s>", "<Esc>:w<CR>i", opts)
|
@ -3,10 +3,9 @@
|
||||
-------------
|
||||
local set = vim.opt
|
||||
local g = vim.g
|
||||
|
||||
set.swapfile = false -- Don't use swapfile
|
||||
set.updatetime = 0 -- Faster completion
|
||||
set.encoding = "utf-8" -- The encoding displayed
|
||||
set.fileencoding = "utf-8" -- The encoding written to file
|
||||
set.smartindent = true -- Makes indenting smart
|
||||
set.iskeyword:append("-") -- treat dash separated words as a word text object"
|
||||
set.clipboard = "unnamedplus" -- Copy paste between vim and everything else
|
||||
@ -15,15 +14,15 @@ set.expandtab = true -- Converts tabs to spaces
|
||||
set.autoindent = true -- Good auto indent
|
||||
set.autochdir = false -- Your working directory will always be the same as your working directory
|
||||
set.incsearch = true -- sets incremental search
|
||||
set.undofile = true;
|
||||
set.undodir = vim.fn.stdpath('data') .. '/undo'
|
||||
set.undofile = true
|
||||
set.undodir = vim.fn.stdpath("data") .. "/undo"
|
||||
set.shell = "/bin/zsh" -- Set your shell to bash or zsh
|
||||
set.shortmess:append("sI") -- Disable nvim intro
|
||||
vim.cmd([[set nobackup]]) -- creates a backup file
|
||||
vim.cmd([[set nowritebackup]]) -- creates a backup file i guess
|
||||
vim.cmd([[set formatoptions-=cro]]) -- Stop newline continution of comments
|
||||
vim.cmd([[set complete+=kspell]]) -- auto complete with spellcheck
|
||||
vim.cmd([[set completeopt=menuone,longest]]) -- auto complete menu (It's pretty great)
|
||||
vim.cmd([[set completeopt=menuone,noselect]]) -- auto complete menu (It's pretty great)
|
||||
vim.cmd([[set nocompatible]]) -- Disable compatibility to old-time vi
|
||||
set.mouse = "a" -- Enable mouse support
|
||||
set.foldmethod = "expr"
|
||||
@ -67,7 +66,7 @@ vim.cmd([[syntax enable]]) -- Enables syntax highlighing
|
||||
vim.cmd([[set t_Co=256]]) -- Support 256 colors
|
||||
-- vim.cmd "set whichwrap+=<,>,[,],h,l" -- Breaks Space-Time Continuum
|
||||
vim.diagnostic.config({
|
||||
virtual_text = false,
|
||||
virtual_text = false,
|
||||
})
|
||||
|
||||
-----------------
|
@ -8,16 +8,39 @@ local plugins = {
|
||||
"rktjmp/fwatch.nvim", -- d to check dark/light theme
|
||||
{ "catppuccin/nvim", name = "catppuccin" },
|
||||
|
||||
"nvim-lualine/lualine.nvim",
|
||||
{
|
||||
"nvim-lualine/lualine.nvim",
|
||||
config = function()
|
||||
require("max.configs.lualine")
|
||||
end,
|
||||
},
|
||||
|
||||
--------------------
|
||||
-- Layout Plugins --
|
||||
--------------------
|
||||
{
|
||||
"folke/which-key.nvim",
|
||||
event = "VimEnter",
|
||||
config = function()
|
||||
require("which-key").setup({})
|
||||
end,
|
||||
},
|
||||
{
|
||||
"ldelossa/litee.nvim",
|
||||
event = "BufRead",
|
||||
dependencies = {
|
||||
"ldelossa/litee-symboltree.nvim",
|
||||
"ldelossa/litee-calltree.nvim",
|
||||
},
|
||||
config = function()
|
||||
require("max.configs.litee")
|
||||
end,
|
||||
},
|
||||
{ "mbbill/undotree", lazy = false },
|
||||
{
|
||||
"petertriho/nvim-scrollbar",
|
||||
config = function()
|
||||
require("configs.scrollbar")
|
||||
require("max.configs.scrollbar")
|
||||
end,
|
||||
},
|
||||
{
|
||||
@ -30,26 +53,32 @@ local plugins = {
|
||||
{
|
||||
"akinsho/git-conflict.nvim",
|
||||
config = function()
|
||||
-- require("git-conflict").setup()
|
||||
require("git-conflict").setup()
|
||||
end,
|
||||
},
|
||||
{
|
||||
"rcarriga/nvim-notify",
|
||||
config = function()
|
||||
require("configs.notify")
|
||||
require("max.configs.notify")
|
||||
end,
|
||||
event = "VimEnter",
|
||||
},
|
||||
{
|
||||
"kyazdani42/nvim-tree.lua",
|
||||
cmd = "NvimTreeToggle",
|
||||
event = "VimEnter",
|
||||
-- lazy = false,
|
||||
dependencies = { "kyazdani42/nvim-web-devicons" },
|
||||
config = function()
|
||||
require("configs.tree")
|
||||
require("max.configs.tree")
|
||||
end,
|
||||
},
|
||||
"nvim-lua/popup.nvim",
|
||||
"goolord/alpha-nvim", -- startup screen
|
||||
{
|
||||
"goolord/alpha-nvim",
|
||||
config = function()
|
||||
require("max.configs.dashboard")
|
||||
end,
|
||||
}, -- startup screen
|
||||
{
|
||||
"numToStr/Comment.nvim",
|
||||
event = "BufReadPre",
|
||||
@ -73,7 +102,7 @@ local plugins = {
|
||||
{
|
||||
"nvim-telescope/telescope.nvim",
|
||||
config = function()
|
||||
require("configs.telescope")
|
||||
require("max.configs.telescope")
|
||||
end,
|
||||
},
|
||||
-- "ThePrimeagen/harpoon",
|
||||
@ -81,11 +110,16 @@ local plugins = {
|
||||
-- Lsp Setup --
|
||||
---------------
|
||||
"arkav/lualine-lsp-progress",
|
||||
"neovim/nvim-lspconfig",
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
lazy = false,
|
||||
config = function()
|
||||
require("max.configs.lsp")
|
||||
end,
|
||||
},
|
||||
"williamboman/mason.nvim",
|
||||
"williamboman/mason-lspconfig.nvim",
|
||||
"jose-elias-alvarez/null-ls.nvim",
|
||||
-- "folke/lsp-colors.nvim",
|
||||
{
|
||||
"folke/trouble.nvim",
|
||||
event = "BufRead",
|
||||
@ -105,7 +139,7 @@ local plugins = {
|
||||
-------------------
|
||||
-- Autocomplete --
|
||||
-------------------
|
||||
"tpope/vim-surround",
|
||||
{ "tpope/vim-surround", event = "InsertEnter" },
|
||||
{
|
||||
"hrsh7th/nvim-cmp",
|
||||
dependencies = {
|
||||
@ -127,8 +161,8 @@ local plugins = {
|
||||
event = "InsertEnter",
|
||||
config = function()
|
||||
vim.schedule(function()
|
||||
require("configs.autocomplete")
|
||||
require("configs.snippets")
|
||||
require("max.configs.autocomplete")
|
||||
require("max.configs.snippets")
|
||||
end)
|
||||
end,
|
||||
},
|
||||
@ -156,7 +190,7 @@ local plugins = {
|
||||
"nvim-treesitter/nvim-treesitter-textobjects",
|
||||
},
|
||||
config = function()
|
||||
require("configs.treesitter")
|
||||
require("max.configs.treesitter")
|
||||
end,
|
||||
run = ":TSUpdate",
|
||||
},
|
||||
@ -179,20 +213,26 @@ local plugins = {
|
||||
"olimorris/persisted.nvim",
|
||||
lazy = false,
|
||||
config = function()
|
||||
require("persisted").setup()
|
||||
require("telescope").load_extension("persisted") -- To load the telescope extension
|
||||
require("max.configs.session")
|
||||
end,
|
||||
},
|
||||
-- Dap Debugger -- Have not yet been able to set this up
|
||||
"mfussenegger/nvim-dap",
|
||||
"rcarriga/nvim-dap-ui",
|
||||
{ "mxsdev/nvim-dap-vscode-js", requires = { "mfussenegger/nvim-dap" } },
|
||||
{
|
||||
"mfussenegger/nvim-dap",
|
||||
dependencies = {
|
||||
"rcarriga/nvim-dap-ui",
|
||||
"mxsdev/nvim-dap-vscode-js",
|
||||
},
|
||||
config = function()
|
||||
require("max.configs.dap")
|
||||
end,
|
||||
},
|
||||
"editorconfig/editorconfig-vim",
|
||||
{
|
||||
"michaelb/sniprun",
|
||||
event = "BufReadPost",
|
||||
command = "SnipRun",
|
||||
config = function()
|
||||
require("configs.sniprun")
|
||||
require("max.configs.sniprun")
|
||||
end,
|
||||
run = "bash ./install.sh",
|
||||
},
|
||||
@ -207,7 +247,7 @@ local plugins = {
|
||||
"nvim-neotest/neotest",
|
||||
cmd = "NeoTest",
|
||||
config = function()
|
||||
require("configs.neotest")
|
||||
require("max.configs.neotest")
|
||||
end,
|
||||
requires = {
|
||||
"haydenmeade/neotest-jest",
|
@ -1,47 +1,47 @@
|
||||
local Terminal = require("toggleterm.terminal").Terminal
|
||||
local lazygit = Terminal:new({
|
||||
cmd = "lazygit",
|
||||
dir = "git_dir",
|
||||
direction = "float",
|
||||
float_opts = {
|
||||
winblend = 0,
|
||||
border = "shadow",
|
||||
},
|
||||
on_close = function()
|
||||
Terminal:close()
|
||||
end,
|
||||
cmd = "lazygit",
|
||||
dir = "git_dir",
|
||||
direction = "float",
|
||||
float_opts = {
|
||||
winblend = 0,
|
||||
border = "shadow",
|
||||
},
|
||||
on_close = function()
|
||||
Terminal:close()
|
||||
end,
|
||||
})
|
||||
|
||||
function _Lazygit_toggle()
|
||||
lazygit:toggle()
|
||||
lazygit:toggle()
|
||||
end
|
||||
|
||||
vim.api.nvim_set_keymap("n", "<C-g>", "<cmd>lua _Lazygit_toggle()<CR>", { noremap = true, silent = true })
|
||||
|
||||
local pnpm = Terminal:new({
|
||||
cmd = "pnpm dev",
|
||||
dir = "git_dir",
|
||||
size = 5,
|
||||
direction = "vertical",
|
||||
cmd = "pnpm dev",
|
||||
dir = "git_dir",
|
||||
size = 5,
|
||||
direction = "vertical",
|
||||
})
|
||||
|
||||
function _Pnpm_toggle()
|
||||
pnpm:toggle()
|
||||
pnpm:toggle()
|
||||
end
|
||||
|
||||
vim.api.nvim_set_keymap("n", "<Leader>d", "<cmd>lua _Pnpm_toggle()<CR>", { noremap = true, silent = true })
|
||||
|
||||
local chtConfig = Terminal:new({
|
||||
cmd = "cht",
|
||||
direction = "float",
|
||||
cmd = "cht",
|
||||
direction = "float",
|
||||
})
|
||||
|
||||
function _ChtConfig_toggle()
|
||||
chtConfig:toggle()
|
||||
chtConfig:toggle()
|
||||
end
|
||||
|
||||
vim.api.nvim_set_keymap("n", "<Leader><C-l>", "<cmd>lua _ChtConfig_toggle()<CR>", { noremap = true, silent = true })
|
||||
|
||||
require("toggleterm").setup({
|
||||
shade_terminals = true,
|
||||
shade_terminals = true,
|
||||
})
|
@ -39,6 +39,3 @@ cat.setup({
|
||||
})
|
||||
|
||||
vim.cmd("colorscheme catppuccin")
|
||||
|
||||
require("utils.theme-reloader")
|
||||
require("configs.lualine")
|
Reference in New Issue
Block a user