chore(nvim): Massive restructure and cleanup

This commit is contained in:
Afonso Franco 2024-06-01 03:53:39 +01:00
parent 5c5eed7581
commit a796af3510
Signed by: afonso
SSH key fingerprint: SHA256:gkVPzsQQJzqi21ntQBV6pXTx4bYI53rFGI4XtvCpwd4
27 changed files with 558 additions and 917 deletions

View file

@ -14,4 +14,5 @@ end
vim.opt.rtp:prepend(lazypath)
--Call lazy config here
require('plugins.lazy')
local lazy = require("lazy")
lazy.setup("plugins")

View file

@ -25,8 +25,8 @@ vim.opt.softtabstop = 4
vim.opt.shiftwidth = 4
vim.opt.expandtab = true
--quickfix keybinds
vim.keymap.set("n", "<C-k>", "<cmd>cprev<CR>zz")
vim.keymap.set("n", "<C-j>", "<cmd>cnext<CR>zz")
vim.keymap.set("n", "<C-p>", "<cmd>cprev<CR>zz")
vim.keymap.set("n", "<C-n>", "<cmd>cnext<CR>zz")
--buffer keybinds
vim.keymap.set("n", "<A-h>", "<cmd>bp<CR>")
vim.keymap.set("n", "<A-l>", "<cmd>bn<CR>")
@ -47,3 +47,4 @@ vim.g.jukit_mappings = 0
--Format Options
vim.opt.formatoptions:remove("ro")
--Sign gutter always on
vim.opt.signcolumn = "yes"

View file

@ -1,10 +0,0 @@
local Rule = require('nvim-autopairs.rule')
local npairs = require('nvim-autopairs')
npairs.setup({
map_cr = true,
map_bs = true,
check_ts = true,
enable_check_bracket_line = true,
ignored_next_char = "[%w]"
})

View file

@ -1,107 +1,112 @@
local cmp_status_ok, cmp = pcall(require, "cmp")
if not cmp_status_ok then
return
end
local snip_status_ok, luasnip = pcall(require, "luasnip")
if not snip_status_ok then
return
end
require("luasnip/loaders/from_vscode").lazy_load()
local check_backspace = function()
local col = vim.fn.col(".") - 1
return col == 0 or vim.fn.getline("."):sub(col, col):match("%s")
end
local lspkind_status_ok, lspkind = pcall(require, "lspkind")
if not lspkind_status_ok then
return
end
cmp.setup({
snippet = {
expand = function(args)
luasnip.lsp_expand(args.body) -- For `luasnip` users.
end,
},
mapping = {
["<C-n>"] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Insert }),
["<C-p>"] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Insert }),
["<C-u>"] = cmp.mapping.scroll_docs(-4),
["<C-d>"] = cmp.mapping.scroll_docs(4),
["<C-e>"] = cmp.mapping.abort(),
["<C-y>"] = cmp.mapping(
cmp.mapping.confirm({
behavior = cmp.ConfirmBehavior.Insert,
select = true,
}),
{ "i", "c" }
),
["<C-Space>"] = cmp.mapping(cmp.mapping.complete(), { "i", "c" }),
["<C-l>"] = cmp.mapping(function()
if luasnip.expand_or_jumpable() then
luasnip.expand_or_jump()
end
end),
["<C-h>"] = cmp.mapping(function()
if luasnip.jumpable(-1) then
luasnip.jump(-1)
end
end),
},
formatting = {
fields = { "kind", "abbr", "menu" },
format = lspkind.cmp_format({
mode = "symbol_text",
maxwidth = 50,
ellipsis_char = "...",
show_labelDetails = true,
before = function(entry, vim_item)
vim_item.menu = ({
nvim_lsp = "[LSP]",
nvim_lua = "[LSP]",
path = "[Path]",
})[entry.source.name]
return vim_item
end,
}),
},
preselect = cmp.PreselectMode.None,
sorting = {
priority_weight = 2,
comparators = {
cmp.config.compare.offset,
cmp.config.compare.exact,
cmp.config.compare.score,
cmp.config.compare.kind,
cmp.config.compare.recently_used,
cmp.config.compare.locality,
--Make entries that start with underline appear after
function(entry1, entry2)
local _, entry1_under = entry1.completion_item.label:find("^_+")
local _, entry2_under = entry2.completion_item.label:find("^_+")
entry1_under = entry1_under or 0
entry2_under = entry2_under or 0
if entry1_under > entry2_under then
return false
elseif entry1_under < entry2_under then
return true
end
end,
return {
{
"hrsh7th/nvim-cmp",
event = "VeryLazy",
dependencies = {
"hrsh7th/cmp-nvim-lsp", -- lsp
"hrsh7th/cmp-nvim-lua", -- Nvim API completions
"hrsh7th/cmp-nvim-lsp-signature-help", -- Show function signatures
"hrsh7th/cmp-buffer", --buffer completions
"hrsh7th/cmp-path", --path completions
"hrsh7th/cmp-cmdline", --cmdline completions
"L3MON4D3/LuaSnip",
"rafamadriz/friendly-snippets",
"saadparwaiz1/cmp_luasnip",
"onsails/lspkind.nvim", --lspkind icons
},
},
sources = cmp.config.sources({
{ name = "nvim_lua" },
{ name = "nvim_lsp" },
{ name = "luasnip" },
{ name = "path" },
}, {
{ name = "buffer", keyword_length = 5 },
}),
})
config = function()
local cmp = require("cmp")
local cmp_autopairs = require("nvim-autopairs.completion.cmp")
cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done())
local luasnip = require("luasnip")
require("luasnip/loaders/from_vscode").lazy_load()
local lspkind = require("lspkind")
cmp.setup({
snippet = {
expand = function(args)
luasnip.lsp_expand(args.body)
end,
},
mapping = {
["<C-n>"] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Insert }),
["<C-p>"] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Insert }),
["<C-u>"] = cmp.mapping.scroll_docs(-4),
["<C-d>"] = cmp.mapping.scroll_docs(4),
["<C-y>"] = cmp.mapping(
cmp.mapping.confirm({
behavior = cmp.ConfirmBehavior.Insert,
select = true,
}),
{ "i", "c" }
),
["<C-Space>"] = cmp.mapping(cmp.mapping.complete(), { "i", "c" }),
["<C-l>"] = cmp.mapping(function()
if luasnip.expand_or_jumpable() then
luasnip.expand_or_jump()
end
end),
["<C-h>"] = cmp.mapping(function()
if luasnip.jumpable(-1) then
luasnip.jump(-1)
end
end),
},
formatting = {
fields = { "kind", "abbr", "menu" },
format = lspkind.cmp_format({
mode = "symbol_text",
maxwidth = 50,
ellipsis_char = "...",
show_labelDetails = true,
before = function(entry, vim_item)
vim_item.menu = ({
nvim_lsp = "[LSP]",
nvim_lua = "[NVIM LSP]",
path = "[Path]",
})[entry.source.name]
return vim_item
end,
}),
},
preselect = cmp.PreselectMode.None,
sorting = {
priority_weight = 2,
comparators = {
cmp.config.compare.offset,
cmp.config.compare.exact,
cmp.config.compare.score,
cmp.config.compare.kind,
cmp.config.compare.recently_used,
cmp.config.compare.locality,
--Make entries that start with underline appear after
function(entry1, entry2)
local _, entry1_under = entry1.completion_item.label:find("^_+")
local _, entry2_under = entry2.completion_item.label:find("^_+")
entry1_under = entry1_under or 0
entry2_under = entry2_under or 0
if entry1_under > entry2_under then
return false
elseif entry1_under < entry2_under then
return true
end
end,
},
},
sources = cmp.config.sources({
{ name = "nvim_lua" },
{ name = "nvim_lsp" },
{ name = "luasnip" },
{ name = "path" },
}, {
{ name = "buffer", keyword_length = 5 },
}),
})
local cmp_autopairs = require("nvim-autopairs.completion.cmp")
cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done())
end
}
}

View file

@ -0,0 +1,7 @@
return {
{
"sainnhe/gruvbox-material",
event = "VeryLazy",
priority = 1000,
},
}

View file

@ -1,10 +0,0 @@
require("conform").setup({
formatters_by_ft = {
python = { "black" },
haskell = { "fourmolu" },
javascript = { "prettierd" },
markdown = { "mdformat" },
go = { "gofmt" },
json = {"jq"}
}
})

View file

@ -1,47 +0,0 @@
local dap = require("dap")
dap.adapters.lldb = {
type = 'server',
port = "${port}",
executable = {
command = '/Users/afonso/.local/share/nvim/mason/bin/codelldb',
args = { "--port", "${port}" },
}
}
dap.adapters.codelldb = {
type = 'server',
host = '127.0.0.1',
port = 13000
}
dap.configurations.c = {
{
name = "Manually start codelldb",
type = "codelldb",
request = "launch",
program = function()
return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file')
end,
args = function()
local args = vim.fn.input('Arguments: ')
return args ~= '' and { args } or nil
end,
cwd = '${workspaceFolder}',
stopOnEntry = false,
},
{
name = "Auto start codelldb",
type = "lldb",
request = "launch",
program = function()
return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file')
end,
args = function()
local args = vim.fn.input('Arguments: ')
return args ~= '' and { args } or nil
end,
cwd = '${workspaceFolder}',
stopOnEntry = false,
},
}

View file

@ -0,0 +1,25 @@
return {
{
"tpope/vim-surround",
event = "VeryLazy",
},
{
"mbbill/undotree",
event = "VeryLazy",
},
{
"windwp/nvim-autopairs",
event = "VeryLazy",
config = function()
local npairs = require('nvim-autopairs')
npairs.setup({
map_cr = true,
map_bs = true,
check_ts = true,
enable_check_bracket_line = true,
ignored_next_char = "[%w]"
})
end,
},
}

View file

@ -1,34 +1,42 @@
local fzflua = require('fzf-lua')
fzflua.register_ui_select()
fzflua.setup({
defaults = {
headers = false,
formatter = "path.filename_first",
winopts = {
border = "single",
width = 0.6,
height = 0.5,
},
},
files = {
previewer = false,
winopts = {
width = 0.5,
height = 0.3,
}
},
grep = {
winopts = {
width = 0.7,
preview = {
layout = "horizontal",
horizontal = "right:40%"
}
},
return {
{
"ibhagwan/fzf-lua",
event = "VeryLazy",
dependencies = { "nvim-tree/nvim-web-devicons" },
config = function()
local fzflua = require('fzf-lua')
fzflua.register_ui_select()
fzflua.setup({
defaults = {
headers = false,
winopts = {
border = "single",
width = 0.6,
height = 0.5,
},
},
files = {
previewer = false,
winopts = {
width = 0.5,
height = 0.3,
}
},
grep = {
winopts = {
width = 0.7,
preview = {
layout = "horizontal",
horizontal = "right:40%"
}
},
}
})
vim.keymap.set('n', '<leader>ff', fzflua.files, {})
vim.keymap.set('n', '<leader>fe', fzflua.diagnostics_workspace, {})
vim.keymap.set('n', '<leader>fg', fzflua.live_grep, {})
vim.keymap.set('n', '<leader>fb', fzflua.buffers, {})
vim.keymap.set('n', '<leader>fh', fzflua.help_tags, {})
end
}
})
vim.keymap.set('n', '<leader>ff', fzflua.files, {})
vim.keymap.set('n', '<leader>fe', fzflua.diagnostics_workspace, {})
vim.keymap.set('n', '<leader>fg', fzflua.live_grep, {})
vim.keymap.set('n', '<leader>fb', fzflua.buffers, {})
vim.keymap.set('n', '<leader>fh', fzflua.help_tags, {})
}

View file

@ -0,0 +1,9 @@
return {
{
"FabijanZulj/blame.nvim",
event = "VeryLazy",
config = function()
require("blame").setup()
end
},
}

View file

@ -1,13 +0,0 @@
local harpoon = require("harpoon")
-- REQUIRED
harpoon:setup()
-- REQUIRED
vim.keymap.set("n", "<leader>a", function() harpoon:list():add() end)
vim.keymap.set("n", "<C-e>", function() harpoon.ui:toggle_quick_menu(harpoon:list()) end)
vim.keymap.set("n", "<C-h>", function() harpoon:list():select(1) end)
vim.keymap.set("n", "<C-j>", function() harpoon:list():select(2) end)
vim.keymap.set("n", "<C-k>", function() harpoon:list():select(3) end)
vim.keymap.set("n", "<C-l>", function() harpoon:list():select(4) end)

View file

@ -1,27 +0,0 @@
local opts = { noremap = true, silent = true, buffer = true }
--Convert between py and ipynb
vim.keymap.set('n', '<leader>jnp', '<cmd>call jukit#convert#notebook_convert()<CR>', opts)
-- Create new code cell below. Argument: Whether to create code cell (0) or markdown cell (1)
vim.keymap.set('n', '<leader>jco', '<cmd>call jukit#cells#create_below(0)<CR>', opts)
-- Create new code cell above. Argument: Whether to create code cell (0) or markdown cell (1)
vim.keymap.set('n', '<leader>jcO', '<cmd>call jukit#cells#create_above(0)<CR>', opts)
-- Create new text (markdown) cell below. Argument: Whether to create code cell (0) or markdown cell (1)
vim.keymap.set('n', '<leader>jct', '<cmd>call jukit#cells#create_below(1)<CR>', opts)
-- Create new text (markdown) cell above. Argument: Whether to create code cell (0) or markdown cell (1)
vim.keymap.set('n', '<leader>jcT', '<cmd>call jukit#cells#create_above(1)<CR>', opts)
-- Deletes the current cell
vim.keymap.set('n', '<leader>jcd', '<cmd>call jukit#cells#delete()<CR>', opts)
-- Send current section (argument: 0 indicates the current section)
vim.keymap.set('n', '<leader>jcc', '<cmd>call jukit#send#section(0)<CR>', opts)
-- Send all sections up to the current section
vim.keymap.set('n', '<leader>jcac', '<cmd>call jukit#send#until_current_section()<CR>', opts)
-- Send all sections
vim.keymap.set('n', '<leader>jca', '<cmd>call jukit#send#all()<CR>', opts)
-- Open an output split
vim.keymap.set('n', '<leader>jos', '<cmd>call jukit#splits#output()<CR>', opts)

View file

@ -1,345 +0,0 @@
local lazy = require("lazy")
lazy.setup({
-------------------------------------------THEMES------------------------------------------
{
"catppuccin/nvim",
name = "catppuccin",
event = "VeryLazy",
lazy = false,
priority = 1000,
opts = {},
},
{
"sainnhe/gruvbox-material",
event = "VeryLazy",
priority = 1000,
},
-------------------------------------------------------QOL---------------------------------
{
"jbyuki/instant.nvim",
event = "VeryLazy",
config = function()
vim.g.instant_username = "afonso"
end,
},
{
"iamcco/markdown-preview.nvim",
event = "VeryLazy",
cmd = { "MarkdownPreviewToggle", "MarkdownPreview", "MarkdownPreviewStop" },
ft = { "markdown" },
build = function() vim.fn["mkdp#util#install"]() end,
},
{
"ThePrimeagen/harpoon",
event = "VeryLazy",
branch = "harpoon2",
dependencies = { "nvim-lua/plenary.nvim" },
config = function()
require("plugins.harpoon")
end
},
{
"vimpostor/vim-tpipeline",
config = function()
vim.g.tpipeline_restore = 1
end
},
{
"FabijanZulj/blame.nvim",
event = "VeryLazy",
config = function()
require("blame").setup()
end
},
{
"TobinPalmer/pastify.nvim",
event = "VeryLazy",
cmd = { "Pastify" },
opts = {},
},
--Python notebooks
{
"luk400/vim-jukit",
event = "VeryLazy",
config = function()
require("plugins.jukit")
end,
ft = { "python", "json" },
},
--Nvim to browser
--"subnut/nvim-ghost.nvim",
{
"declancm/cinnamon.nvim",
opts = {
scroll_limit = 10000,
always_scroll = true,
},
},
{
"folke/todo-comments.nvim",
event = "VeryLazy",
dependencies = { "nvim-lua/plenary.nvim" },
opts = {
vim.keymap.set("n", "]t", function()
require("todo-comments").jump_next()
end, { desc = "Next todo comment" }),
vim.keymap.set("n", "[t", function()
require("todo-comments").jump_prev()
end, { desc = "Previous todo comment" })
},
},
{
"folke/zen-mode.nvim",
event = "VeryLazy",
opts = {
vim.keymap.set("n", "<leader>z", "<Cmd> ZenMode <CR>", { noremap = true, silent = true }),
},
},
--Change add and remove surroundings from words
"tpope/vim-surround",
{
"NvChad/nvim-colorizer.lua",
opts = {},
},
"mbbill/undotree",
--Tmux navigation
{
"alexghergh/nvim-tmux-navigation",
opts = {
disable_when_zoomed = true, -- defaults to false
keybindings = {
left = "<F5>",
down = "<F6>",
up = "<F7>",
right = "<F8>",
},
},
},
-- Rename variable pop up
{
"stevearc/dressing.nvim",
event = "VeryLazy",
},
{
"windwp/nvim-autopairs",
event = "VeryLazy",
config = function()
require("plugins.autopairs")
end,
},
{
"nvim-lualine/lualine.nvim",
dependencies = { "nvim-tree/nvim-web-devicons", opt = true },
config = function()
require("plugins.lualine")
end,
},
{
"stevearc/oil.nvim",
opts = {},
},
-------------------------------------------------------LSP----------------------------------------------
{
"hrsh7th/nvim-cmp",
event = "VeryLazy",
dependencies = {
"hrsh7th/cmp-nvim-lsp", -- lsp
"hrsh7th/cmp-nvim-lua", -- Nvim API completions
"hrsh7th/cmp-nvim-lsp-signature-help", -- Show function signatures
"hrsh7th/cmp-buffer", --buffer completions
"hrsh7th/cmp-path", --path completions
"hrsh7th/cmp-cmdline", --cmdline completions
"L3MON4D3/LuaSnip",
"rafamadriz/friendly-snippets",
"saadparwaiz1/cmp_luasnip",
"onsails/lspkind.nvim", --lspkind icons
},
config = function()
require("plugins.cmp")
end,
},
--LSP Status
"j-hui/fidget.nvim",
{
"rcarriga/nvim-dap-ui",
event = "VeryLazy",
dependencies = { "mfussenegger/nvim-dap", "nvim-neotest/nvim-nio" },
config = function()
local dap = require("dap")
local dapui = require("dapui")
dapui.setup()
dap.listeners.after.event_initialized["dapui_config"] = function()
dapui.open()
end
dap.listeners.before.event_terminated["dapui_config"] = function()
dapui.close()
end
dap.listeners.before.event_exited["dapui_config"] = function()
dapui.close()
end
end,
},
{
"jay-babu/mason-nvim-dap.nvim",
event = "VeryLazy",
dependencies = {
"williamboman/mason.nvim",
"mfussenegger/nvim-dap",
},
opts = {
handlers = {},
},
},
{
"mfussenegger/nvim-dap",
event = "VeryLazy",
config = function()
require("plugins.dap")
end,
},
{
'leoluz/nvim-dap-go',
event = "VeryLazy",
opts = {}
},
{
"neovim/nvim-lspconfig",
event = { "BufReadPost", "BufNewFile" },
dependencies = {
{
"williamboman/mason-lspconfig.nvim",
dependencies = {
{
"williamboman/mason.nvim",
config = function()
require("plugins.mason")
end,
},
},
config = function()
require("plugins.mason-lspconfig")
end
},
},
config = function()
require("plugins.lspconfig")
end,
},
--Better quick fix
{
'kevinhwang91/nvim-bqf',
event = "VeryLazy",
ft = 'qf'
},
{
"stevearc/conform.nvim",
event = "VeryLazy",
config = function()
require("plugins.conform")
end,
},
{
"lervag/vimtex",
event = "VeryLazy",
config = function()
require("plugins.vimtex")
end,
},
--'tpope/vim-commentary',
-- {
-- "mrcjkb/rustaceanvim",
-- version = "^4", -- Recommended
-- ft = { "rust" },
-- },
{
"barreiroleo/ltex-extra.nvim",
event = "VeryLazy",
},
-------------------------------------------------------------------------------------------
-- Syntax Highlighting
{
"nvim-treesitter/nvim-treesitter",
event = { "BufReadPost", "BufNewFile" },
dependencies = {
'nvim-treesitter/nvim-treesitter-textobjects'
},
config = function()
require("plugins.treesitter")
end,
},
--Sticky headers
{
"nvim-treesitter/nvim-treesitter-context",
config = function()
require("plugins.treesitter-context")
end,
},
{
"ibhagwan/fzf-lua",
event = "VeryLazy",
dependencies = { "nvim-tree/nvim-web-devicons" },
config = function()
require('plugins.fzf-lua')
end
},
--Discord Rich Presence
"andweeb/presence.nvim",
--Vim be good
{
'ThePrimeagen/vim-be-good',
event = "VeryLazy",
},
--JQ
{
'jrop/jq.nvim',
event = "VeryLazy",
},
-- {
-- 'BooleanCube/keylab.nvim',
-- opts = {}
-- }
})

View file

@ -0,0 +1,222 @@
return {
-- Rename variable pop up
{
"stevearc/dressing.nvim",
event = "VeryLazy",
},
{
"williamboman/mason.nvim",
config = function()
local mason = require("mason")
vim.api.nvim_create_augroup("_mason", { clear = true })
local options = {
PATH = "skip",
ui = {
icons = {
package_pending = "",
package_installed = "󰄳 ",
package_uninstalled = "",
},
keymaps = {
toggle_server_expand = "<CR>",
install_server = "i",
update_server = "u",
check_server_version = "c",
update_all_servers = "U",
check_outdated_servers = "C",
uninstall_server = "X",
cancel_installation = "<C-c>",
},
},
max_concurrent_installers = 10,
}
mason.setup(options)
end,
},
{
"williamboman/mason-lspconfig.nvim",
dependencies = {
"williamboman/mason.nvim"
},
config = function()
local mason_lspconfig = require("mason-lspconfig")
local lspconfig = require("lspconfig")
mason_lspconfig.setup({
automatic_installation = false,
})
local lsp_defaults = lspconfig.util.default_config
local capabilities =
vim.tbl_deep_extend("force", lsp_defaults.capabilities, require("cmp_nvim_lsp").default_capabilities())
mason_lspconfig.setup_handlers({
-- This is a default handler that will be called for each installed server (also for new servers that are installed during a session)
function(server_name)
lspconfig[server_name].setup({
capabilities = capabilities,
})
end,
["gopls"] = function()
lspconfig["gopls"].setup({
capabilities = capabilities,
settings = {
gopls = {
["ui.completion.usePlaceholders"] = true,
["ui.diagnostic.staticcheck"] = true,
["ui.inlayhint.hints"] = {
assignVariablesTypes = true,
compositeLiteralFields = true,
compositeLiteralTypes = true,
constantValues = true,
functionTypeParameters = true,
parameterNames = true,
rangeVariableTypes = true
},
}
}
})
end,
["lua_ls"] = function()
lspconfig["lua_ls"].setup({
capabilities = capabilities,
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" },
},
workspace = {
-- Make the server aware of Neovim runtime files
library = vim.api.nvim_get_runtime_file("", true),
},
hint = { enable = true }
},
},
})
end,
["ltex"] = function()
lspconfig["ltex"].setup({
capabilities = capabilities,
--Local on attach
on_attach = function(_, _)
-- rest of your on_attach process.
require("ltex_extra").setup()
end,
settings = {
ltex = {
language = "pt-PT",
},
},
})
end,
["basedpyright"] = function()
lspconfig["basedpyright"].setup({
capabilities = capabilities,
settings = {
verboseOutput = true,
autoImportCompletion = true,
basedpyright = {
analysis = {
typeCheckingMode = "all",
autoSearchPaths = true,
useLibraryCodeForTypes = true,
diagnosticMode = "openFilesOnly",
indexing = true,
},
},
},
})
end,
})
end
},
{
"neovim/nvim-lspconfig",
event = { "BufReadPost", "BufNewFile" },
dependencies = {
"williamboman/mason-lspconfig.nvim"
},
config = function()
local lspconfig = require("lspconfig")
-- Use an on_attach function to only map the following keys
-- after the language server attaches to the current buffer
vim.api.nvim_create_autocmd("LspAttach", {
group = vim.api.nvim_create_augroup("UserLspConfig", {}),
callback = function(ev)
-- Enable completion triggered by <c-x><c-o>
vim.bo[ev.buf].omnifunc = "v:lua.vim.lsp.omnifunc"
local fzflua = require("fzf-lua")
local conform = require("conform")
local client = vim.lsp.get_client_by_id(ev.data.client_id)
if client ~= nil then
client.server_capabilities.semanticTokensProvider = nil
end
-- Mappings.
local bufopts = { noremap = true, silent = true, buffer = ev.buf }
vim.keymap.set("n", "<space>e", vim.diagnostic.open_float, bufopts)
vim.keymap.set("n", "<space>q", vim.diagnostic.setloclist, bufopts)
vim.keymap.set("n", "gD", vim.lsp.buf.declaration, bufopts)
vim.keymap.set("n", "gd", vim.lsp.buf.definition, bufopts)
vim.keymap.set("n", "gr", fzflua.lsp_references, bufopts)
vim.keymap.set("n", "K", vim.lsp.buf.hover, bufopts)
vim.keymap.set("n", "gi", fzflua.lsp_implementations, bufopts)
vim.keymap.set("n", "<space>k", vim.lsp.buf.signature_help, bufopts)
vim.keymap.set("n", "<space>D", vim.lsp.buf.type_definition, bufopts)
vim.keymap.set("n", "<space>rn", vim.lsp.buf.rename, bufopts)
vim.keymap.set("n", "<space>ca", vim.lsp.buf.code_action, bufopts)
vim.keymap.set("n", "<space>ge", vim.diagnostic.goto_next, bufopts)
vim.keymap.set("n", "<space>gE", vim.diagnostic.goto_prev, bufopts)
vim.keymap.set("n", "<space>fo", function() conform.format({ lsp_fallback = true }) end, bufopts)
end,
})
-- ADD NVIM CMP AS A CAPABILITY
local lsp_defaults = lspconfig.util.default_config
local capabilities =
vim.tbl_deep_extend("force", lsp_defaults.capabilities, require("cmp_nvim_lsp").default_capabilities())
lspconfig["hls"].setup({
capabilities = capabilities,
filetypes = { 'haskell', 'lhaskell', 'cabal' },
})
end,
},
{
"stevearc/conform.nvim",
event = "VeryLazy",
config = function()
require("conform").setup({
formatters_by_ft = {
python = { "black" },
haskell = { "fourmolu" },
javascript = { "prettierd" },
markdown = { "mdformat" },
go = { "gofmt" },
json = { "jq" }
}
})
end,
},
{
"lervag/vimtex",
event = "VeryLazy",
config = function()
vim.g.vimtex_view_method = 'skim'
vim.g.vimtex_compiler_methor = 'pdflatex'
end,
},
{
"barreiroleo/ltex-extra.nvim",
event = "VeryLazy",
},
}

View file

@ -1,45 +0,0 @@
local lspconfig = require("lspconfig")
-- Use an on_attach function to only map the following keys
-- after the language server attaches to the current buffer
vim.api.nvim_create_autocmd("LspAttach", {
group = vim.api.nvim_create_augroup("UserLspConfig", {}),
callback = function(ev)
-- Enable completion triggered by <c-x><c-o>
vim.bo[ev.buf].omnifunc = "v:lua.vim.lsp.omnifunc"
vim.opt_local.signcolumn = numbers
local fzflua = require("fzf-lua")
local conform = require("conform")
local client = vim.lsp.get_client_by_id(ev.data.client_id)
client.server_capabilities.semanticTokensProvider = nil
-- Mappings.
local bufopts = { noremap = true, silent = true, buffer = ev.buf }
vim.keymap.set("n", "<space>e", vim.diagnostic.open_float, bufopts)
vim.keymap.set("n", "<space>q", vim.diagnostic.setloclist, bufopts)
vim.keymap.set("n", "gD", vim.lsp.buf.declaration, bufopts)
vim.keymap.set("n", "gd", vim.lsp.buf.definition, bufopts)
vim.keymap.set("n", "gr", fzflua.lsp_references, bufopts)
vim.keymap.set("n", "K", vim.lsp.buf.hover, bufopts)
vim.keymap.set("n", "gi", fzflua.lsp_implementations, bufopts)
vim.keymap.set("n", "<space>k", vim.lsp.buf.signature_help, bufopts)
vim.keymap.set("n", "<space>D", vim.lsp.buf.type_definition, bufopts)
vim.keymap.set("n", "<space>rn", vim.lsp.buf.rename, bufopts)
vim.keymap.set("n", "<space>ca", vim.lsp.buf.code_action, bufopts)
vim.keymap.set("n", "<space>ge", vim.diagnostic.goto_next, bufopts)
vim.keymap.set("n", "<space>gE", vim.diagnostic.goto_prev, bufopts)
vim.keymap.set("n", "<space>fo", function() conform.format({ lsp_fallback = true }) end, bufopts)
end,
})
-- ADD NVIM CMP AS A CAPABILITY
local lsp_defaults = lspconfig.util.default_config
local capabilities =
vim.tbl_deep_extend("force", lsp_defaults.capabilities, require("cmp_nvim_lsp").default_capabilities())
lspconfig["hls"].setup({
capabilities = capabilities,
filetypes = { 'haskell', 'lhaskell', 'cabal' },
})

View file

@ -1,40 +0,0 @@
require('lualine').setup {
options = {
icons_enabled = true,
theme = 'auto',
component_separators = { left = '', right = ''},
section_separators = { left = '', right = ''},
disabled_filetypes = {
statusline = {},
winbar = {},
},
ignore_focus = {},
always_divide_middle = true,
globalstatus = false,
refresh = {
statusline = 1000,
tabline = 1000,
winbar = 1000,
}
},
sections = {
lualine_a = {},
lualine_b = {},
lualine_c = {},
lualine_x = {'filetype'},
lualine_y = {},
lualine_z = {'location'}
},
inactive_sections = {
lualine_a = {},
lualine_b = {},
lualine_c = {'filename'},
lualine_x = {'location'},
lualine_y = {},
lualine_z = {}
},
tabline = {},
winbar = {},
inactive_winbar = {},
extensions = {}
}

View file

@ -1,94 +0,0 @@
local mason_lspconfig = require("mason-lspconfig")
local lspconfig = require("lspconfig")
mason_lspconfig.setup({
automatic_installation = false,
})
local lsp_defaults = lspconfig.util.default_config
local capabilities =
vim.tbl_deep_extend("force", lsp_defaults.capabilities, require("cmp_nvim_lsp").default_capabilities())
mason_lspconfig.setup_handlers({
-- This is a default handler that will be called for each installed server (also for new servers that are installed during a session)
function(server_name)
lspconfig[server_name].setup({
capabilities = capabilities,
})
end,
["gopls"] = function()
lspconfig["gopls"].setup({
capabilities = capabilities,
settings = {
gopls = {
["ui.completion.usePlaceholders"] = true,
["ui.diagnostic.staticcheck"] = true,
["ui.inlayhint.hints"] = {
assignVariablesTypes = true,
compositeLiteralFields = true,
compositeLiteralTypes = true,
constantValues = true,
functionTypeParameters = true,
parameterNames = true,
rangeVariableTypes = true
},
}
}
})
end,
["lua_ls"] = function()
lspconfig["lua_ls"].setup({
capabilities = capabilities,
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" },
},
workspace = {
-- Make the server aware of Neovim runtime files
library = vim.api.nvim_get_runtime_file("", true),
},
hint = { enable = true }
},
},
})
end,
["ltex"] = function()
lspconfig["ltex"].setup({
capabilities = capabilities,
--Local on attach
on_attach = function(_, _)
-- rest of your on_attach process.
require("ltex_extra").setup()
end,
settings = {
ltex = {
language = "en-US",
},
},
})
end,
["basedpyright"] = function()
lspconfig["basedpyright"].setup({
capabilities = capabilities,
settings = {
verboseOutput = true,
autoImportCompletion = true,
basedpyright = {
analysis = {
typeCheckingMode = "all",
autoSearchPaths = true,
useLibraryCodeForTypes = true,
diagnosticMode = "openFilesOnly",
indexing = true,
},
},
},
})
end,
})

View file

@ -1,24 +0,0 @@
local mason = require("mason")
vim.api.nvim_create_augroup("_mason", { clear = true })
local options = {
PATH = "skip",
ui = {
icons = {
package_pending = "",
package_installed = "󰄳 ",
package_uninstalled = "",
},
keymaps = {
toggle_server_expand = "<CR>",
install_server = "i",
update_server = "u",
check_server_version = "c",
update_all_servers = "U",
check_outdated_servers = "C",
uninstall_server = "X",
cancel_installation = "<C-c>",
},
},
max_concurrent_installers = 10,
}
mason.setup(options)

View file

@ -0,0 +1,29 @@
return {
{
"iamcco/markdown-preview.nvim",
event = "VeryLazy",
cmd = { "MarkdownPreviewToggle", "MarkdownPreview", "MarkdownPreviewStop" },
ft = { "markdown" },
build = function() vim.fn["mkdp#util#install"]() end,
},
{
"folke/todo-comments.nvim",
event = "VeryLazy",
dependencies = { "nvim-lua/plenary.nvim" },
opts = {
vim.keymap.set("n", "]t", function()
require("todo-comments").jump_next()
end, { desc = "Next todo comment" }),
vim.keymap.set("n", "[t", function()
require("todo-comments").jump_prev()
end, { desc = "Previous todo comment" })
},
},
{
"TobinPalmer/pastify.nvim",
event = "VeryLazy",
cmd = { "Pastify" },
opts = {},
},
}

View file

@ -0,0 +1,44 @@
return {
{
"ThePrimeagen/harpoon",
event = "VeryLazy",
branch = "harpoon2",
dependencies = { "nvim-lua/plenary.nvim" },
config = function()
local harpoon = require("harpoon")
harpoon.setup()
vim.keymap.set("n", "<leader>a", function() harpoon:list():add() end)
vim.keymap.set("n", "<C-e>", function() harpoon.ui:toggle_quick_menu(harpoon:list()) end)
vim.keymap.set("n", "<C-h>", function() harpoon:list():select(1) end)
vim.keymap.set("n", "<C-j>", function() harpoon:list():select(2) end)
vim.keymap.set("n", "<C-k>", function() harpoon:list():select(3) end)
vim.keymap.set("n", "<C-l>", function() harpoon:list():select(4) end)
end
},
{
"stevearc/oil.nvim",
opts = {},
},
{
"alexghergh/nvim-tmux-navigation",
event = "VeryLazy",
opts = {
disable_when_zoomed = true, -- defaults to false
keybindings = {
left = "<F5>",
down = "<F6>",
up = "<F7>",
right = "<F8>",
},
},
},
{
"declancm/cinnamon.nvim",
event = "VeryLazy",
opts = {
scroll_limit = 10000,
always_scroll = true,
},
},
}

View file

@ -1,28 +0,0 @@
local augroup = vim.api.nvim_create_augroup("LspFormatting",{})
local null_ls = require("null-ls")
null_ls.setup({
sources = {
null_ls.builtins.formatting.black,
null_ls.builtins.formatting.gofmt,
null_ls.builtins.formatting.prettierd.with({
filetypes = { "html", "json", "css", "js", "yaml", "markdown" },
}),
null_ls.builtins.diagnostics.golangci_lint,
},
on_attach = function(client,bufnr)
if client.supports_method("textDocument/formatting") then
vim.api.nvim_clear_autocmds({
group = augroup,
buffer = bufnr,
})
vim.api.nvim_create_autocmd("BufWritePre",{
group = augroup,
buffer = bufnr,
callback = function()
vim.lsp.buf.format({ bufnr = bufnr })
end
})
end
end,
})

View file

@ -1,3 +0,0 @@
{
"keywordCase": "upper"
}

View file

@ -1,42 +0,0 @@
local telescope = require('telescope')
local actions = require("telescope.actions")
telescope.setup {
defaults = {
layout_strategy = "horizontal",
path_display = { "filename_first" },
mappings = {
i = {
["<esc>"] = actions.close,
},
},
},
pickers = {
find_files = {
previewer = false,
layout_strategy = "center",
layout_config = {
height = 0.7,
width = 0.5
},
},
live_grep = {
only_sort_text = true,
previewer = true,
}
},
extensions = {
["ui-select"] = {
require("telescope.themes").get_cursor {}
}
}
}
telescope.load_extension('fzf')
telescope.load_extension("ui-select")
--local builtin = require('telescope.builtin')
--vim.keymap.set('n', '<leader>ff', builtin.find_files, {})
--vim.keymap.set('n', '<leader>fe', builtin.diagnostics, {})
--vim.keymap.set('n', '<leader>fg', builtin.live_grep, {})
--vim.keymap.set('n', '<leader>fb', builtin.buffers, {})
--vim.keymap.set('n', '<leader>fs', builtin.treesitter, {})
--vim.keymap.set('n', '<leader>fh', builtin.help_tags, {})

View file

@ -1,8 +0,0 @@
require'treesitter-context'.setup{
patterns = {
rust = {
'impl_item',
'match',
},
}
}

View file

@ -1,42 +1,44 @@
local present, treesitter = pcall(require, "nvim-treesitter.configs")
if not present then
return
end
return {
require('nvim-treesitter.install').update({ with_sync = true })
local options = {
ensure_installed = { "c", "lua", "haskell", "rust", "markdown", "org" },
highlight = {
enable = true,
use_languagetree = true,
additional_vim_regex_highlighting = { "org" },
},
indent = {
enable = true,
},
textobjects = {
select = {
enable = true,
-- Automatically jump forward to textobj, similar to targets.vim
lookahead = true,
keymaps = {
-- You can use the capture groups defined in textobjects.scm
["af"] = "@function.outer",
["if"] = "@function.inner",
["ab"] = "@block.outer",
["ib"] = "@block.inner",
},
selection_modes = {
['@block.outer'] = 'v', -- charwise
['@block.inner'] = 'v', -- charwise
['@function.outer'] = 'V', -- linewise
},
include_surrounding_whitespace = true,
{
"nvim-treesitter/nvim-treesitter",
event = { "BufReadPost", "BufNewFile" },
dependencies = {
'nvim-treesitter/nvim-treesitter-textobjects'
},
config = function()
local treesitter = require("nvim-treesitter.configs")
require('nvim-treesitter.install').update({ with_sync = true })
local options = {
ensure_installed = { "c", "lua", "haskell", "markdown" },
highlight = {
enable = true,
use_languagetree = true,
additional_vim_regex_highlighting = { "org" },
},
indent = {
enable = true,
},
}
treesitter.setup(options)
end
},
{
"nvim-treesitter/nvim-treesitter-context",
event = "VeryLazy",
config = function()
require 'treesitter-context'.setup()
end,
},
{
'echasnovski/mini.ai',
event = "VeryLazy",
version = false,
opts = {}
},
}
treesitter.setup(options)

View file

@ -0,0 +1,26 @@
return {
{
"vimpostor/vim-tpipeline",
config = function()
vim.g.tpipeline_restore = 1
vim.g.tpipeline_autoembed = 1
vim.o.laststatus = 0
vim.g.tpipeline_statusline = '%=%l:%c'
end
},
{
'echasnovski/mini.notify',
version = false,
config = function()
vim.api.nvim_set_hl(0, 'MiniNotifyNormal', { link = 'Normal' })
vim.api.nvim_set_hl(0, 'MiniNotifyBorder', { link = 'Normal' })
require("mini.notify").setup()
end
},
--Better quick fix
{
'kevinhwang91/nvim-bqf',
event = "VeryLazy",
ft = 'qf'
},
}

View file

@ -1,2 +0,0 @@
vim.g.vimtex_view_method = 'skim'
vim.g.vimtex_compiler_methor = 'pdflatex'