feat: some shit

This commit is contained in:
2022-11-16 23:37:05 +01:00
parent 7bf1d29cd6
commit 00822e03a4
11 changed files with 335 additions and 175 deletions

View File

@ -0,0 +1,32 @@
local status_ok, util = pcall(require, "lspconfig.util")
if not status_ok then
return
end
local default_capabilities = {
textDocument = {
completion = {
editsNearCursor = true,
},
},
offsetEncoding = { 'utf-8', 'utf-16' },
}
local default_config = {
cmd = { 'glslls' }, -- GLSL lsp executable from (https://github.com/svenstaro/glsl-language-server
filetypes = { 'glsl' },
root_dir = util.root_pattern('compile_commands.json', '.git'),
single_file_support = true,
capabilities = default_capabilities,
}
return {
default_configs = default_config,
commands = {},
docs = {
description = [[
Basic LSP support for GLSL using glslls --stdio
]]
},
}

View File

@ -187,17 +187,17 @@ lsp.yamlls.setup({
["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://github.com/SchemaStore/schemastore/blob/master/src/schemas/json/traefik-v2.json"] = "traefik.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,
cmd = { os.getenv("HOME") .. "/.local/share/nvim/lsp_servers/ltex/ltex-ls/bin/ltex-ls" },
settings = {
ltex = {
language = "de",

View File

@ -0,0 +1,68 @@
local Workspace = require("projections.workspace")
local Session = require("projections.session")
require("projections").setup({
workspaces = { "~/Projects" }, -- Default workspaces to search for
patterns = { ".git", ".svn", ".hg" }, -- Patterns to search for, these are NOT regexp
store_hooks = {
pre = function()
require("nvim-tree").close()
end,
},
restore_hooks = {
post = function()
require("nvim-tree").open()
end,
},
})
vim.keymap.set("n", "<leader>o", function()
local find_projects = require("telescope").extensions.projections.projections
find_projects({
action = function(selection)
-- chdir is required since there might not be a session file
vim.fn.chdir(selection.value)
Session.restore(selection.value)
end,
})
end, { desc = "Find projects" })
vim.api.nvim_create_autocmd({ "DirChangedPre", "VimLeavePre" }, {
callback = function()
Session.store(vim.loop.cwd())
end,
desc = "Store project session",
})
vim.api.nvim_create_autocmd({ "VimEnter" }, {
callback = function()
if 0 then
return
end
local session_info = Session.info(vim.loop.cwd())
if session_info == nil then
Session.restore_latest()
else
Session.restore(vim.loop.cwd())
end
end,
desc = "Restore last session automatically",
})
vim.api.nvim_create_user_command("RestoreSession", function()
local session_info = Session.info(vim.loop.cwd())
if session_info == nil then
Session.restore_latest()
else
Session.restore(vim.loop.cwd())
end
end, {})
vim.api.nvim_create_user_command("SaveSession", function()
Session.store(vim.loop.cwd())
end, {})
-- Add workspace command
vim.api.nvim_create_user_command("AddWorkspace", function()
Workspace.add(vim.loop.cwd())
end, {})

View File

@ -18,7 +18,7 @@ local default = {
"--column",
"--smart-case",
"--ignore-file",
"workerMain.js",
".gitignore",
},
prompt_prefix = "",
selection_caret = " ",
@ -41,7 +41,7 @@ local default = {
preview_cutoff = 120,
},
file_sorter = require("telescope.sorters").get_fuzzy_file,
file_ignore_patterns = { "node_modules" },
file_ignore_patterns = { "node_modules", "*pnpm-lock*" },
generic_sorter = require("telescope.sorters").get_generic_fuzzy_sorter,
path_display = { "truncate" },
winblend = 0,
@ -64,5 +64,6 @@ telescope.setup(default)
-- telescope.load_extension("themes");
--
telescope.load_extension("harpoon")
-- telescope.load_extension("command_center")
telescope.load_extension("projections")
telescope.load_extension("git_worktree")
telescope.load_extension("notify")

View File

@ -23,7 +23,7 @@ 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>o", "<cmd>LSoutlineToggle<CR>", { silent = true })
map("n", "<leader>e", "<cmd>Lspsaga show_cursor_diagnostics<CR>", { silent = true })
map("n", "<Leader>rn", "<cmd>Lspsaga rename<CR>", options)
map({ "n", "v" }, "<leader>c", "<cmd>Lspsaga code_action<CR>", { silent = true })

View File

@ -2,6 +2,7 @@
-- General --
-------------
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
@ -40,6 +41,7 @@ set.ruler = true -- Show the cursor position all the time
set.splitbelow = true -- Horizontal splits will automatically be below
set.splitright = true -- Vertical splits will automatically be to the right
set.conceallevel = 0 -- So that I can see `` in markdown files
g.markdown_fenced_languages = { "javascript", "typescript", "bash", "lua", "go", "rust", "c", "cpp" }
set.tabstop = 2 -- Insert 2 spaces for a tab
set.number = true -- Line numbers
set.background = "dark" -- tell vim what the background color looks like

View File

@ -73,15 +73,16 @@ return packer.startup(function(use)
---------------------
use("junegunn/fzf")
use({ "ggandor/leap.nvim",
use({
"ggandor/leap.nvim",
config = function()
local leap = require("leap")
leap.add_default_mappings()
leap.setup({})
end })
end,
})
use({
"nvim-telescope/telescope.nvim",
cmd = "Telescope",
config = function()
require("configs.telescope")
end,
@ -97,7 +98,6 @@ return packer.startup(function(use)
use("williamboman/mason-lspconfig.nvim")
use("jose-elias-alvarez/null-ls.nvim")
use("folke/lsp-colors.nvim")
-- use("kosayoda/nvim-lightbulb")
use({
"folke/trouble.nvim",
event = "BufRead",
@ -189,7 +189,17 @@ return packer.startup(function(use)
--------------------
-- IDE Type Stuff --
--------------------
use("ThePrimeagen/vim-be-good")
use({ "ThePrimeagen/git-worktree.nvim",
config = function()
require("git-worktree").setup()
end,
})
use({
"GnikDroy/projections.nvim",
config = function()
require("configs.sessions")
end,
})
-- Dap Debugger -- Have not yet been able to set this up
-- use({ "mfussenegger/nvim-dap" })