feat(nvim): cleanup

This commit is contained in:
Maciej Jur 2023-08-20 14:27:47 +02:00
parent 1c62cb8812
commit b7b6c40c01
Signed by: kamov
GPG key ID: 191CBFF5F72ECAFD
13 changed files with 81 additions and 116 deletions

View file

@ -1,7 +0,0 @@
{
1 "rebelot/kanagawa.nvim"
:lazy false
:priority 1000
:config (fn [] (vim.cmd "colorscheme kanagawa"))
}

View file

@ -1,11 +0,0 @@
{
1 "nvim-lualine/lualine.nvim"
:dependencies [
"nvim-tree/nvim-web-devicons"
]
:config (fn []
(local lualine (require "lualine"))
(lualine.setup)
)
}

View file

@ -1,33 +0,0 @@
local ht = require('haskell-tools')
local def_opts = { noremap = true, silent = true, }
ht.start_or_attach {
hls = {
on_attach = function(_, bufnr)
local opts = vim.tbl_extend('keep', def_opts, { buffer = bufnr, })
-- haskell-language-server relies heavily on codeLenses,
-- so auto-refresh (see advanced configuration) is enabled by default
vim.keymap.set('n', '<space>ca', vim.lsp.codelens.run, opts)
vim.keymap.set('n', '<space>hs', ht.hoogle.hoogle_signature, opts)
vim.keymap.set('n', '<space>ea', ht.lsp.buf_eval_all, opts)
end,
},
}
-- Suggested keymaps that do not depend on haskell-language-server:
local bufnr = vim.api.nvim_get_current_buf()
-- set buffer = bufnr in ftplugin/haskell.lua
local opts = { noremap = true, silent = true, buffer = bufnr }
-- Toggle a GHCi repl for the current package
vim.keymap.set('n', '<leader>rr', ht.repl.toggle, opts)
-- Toggle a GHCi repl for the current buffer
vim.keymap.set('n', '<leader>rf', function()
ht.repl.toggle(vim.api.nvim_buf_get_name(0))
end, def_opts)
vim.keymap.set('n', '<leader>rq', ht.repl.quit, opts)
-- Detect nvim-dap launch configurations
-- (requires nvim-dap and haskell-debug-adapter)
-- ht.dap.discover_configurations(bufnr)

View file

@ -1,5 +1,4 @@
-- New bytecode cache
vim.loader.enable()
if vim.loader then vim.loader.enable() end
-- Setup global config
require("global")
@ -25,31 +24,11 @@ do
vim.opt.rtp:prepend(lazypath)
end
-- Bootstrap Fennel
do
local hotpotpath = vim.fn.stdpath("data") .. "/lazy/hotpot.nvim"
if not vim.loop.fs_stat(hotpotpath) then
vim.notify("Bootstrapping hotpot.nvim...", vim.log.levels.INFO)
vim.fn.system({
"git",
"clone",
"--filter=blob:none",
"--single-branch",
-- You may with to pin a known version tag with `--branch vX.Y.Z`
"https://github.com/rktjmp/hotpot.nvim.git",
hotpotpath,
})
end
vim.opt.rtp:prepend(hotpotpath)
end
-- Load Fennel
require("hotpot")
-- Load lazy
local lazy_ok, lazy = pcall(require, "lazy")
if lazy_ok then
lazy.setup(require("plugins"))
local plugins = require("plugins")
lazy.setup(plugins)
vim.keymap.set('n', '<leader>pm', lazy.home, { desc = "Package manager: open" })
else
print("(init) Couldn't load Lazy")

View file

@ -9,11 +9,10 @@
"diffview.nvim": { "branch": "main", "commit": "db97e667e03294bfa9f15e544e78f3082247bf79" },
"gitsigns.nvim": { "branch": "main", "commit": "749267aaa863c30d721c9913699c5d94e0c07dd3" },
"haskell-tools.nvim": { "branch": "1.x.x", "commit": "2c3cbdf386ecb03210b56962db96e601705c5118" },
"hotpot.nvim": { "branch": "master", "commit": "cfe493572fd80678855c3fd3c4cba9f2fec840de" },
"kanagawa.nvim": { "branch": "master", "commit": "1749cea392acb7d1548a946fcee1e6f1304cd3cb" },
"lazy.nvim": { "branch": "main", "commit": "dac844ed617dda4f9ec85eb88e9629ad2add5e05" },
"lualine.nvim": { "branch": "master", "commit": "45e27ca739c7be6c49e5496d14fcf45a303c3a63" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "7e8208a4d936f93303cc229af865a2cd226c807f" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "2997f467881ac4faa6f8c5e7065e3a672297c8ad" },
"mason-nvim-dap.nvim": { "branch": "main", "commit": "6148b51db945b55b3b725da39eaea6441e59dff8" },
"mason.nvim": { "branch": "main", "commit": "a51c2d063c5377ee9e58c5f9cda7c7436787be72" },
"neo-tree.nvim": { "branch": "v3.x", "commit": "cac2e1bfa1ecd5bd0ce7ae29e12efb3ba5a7347d" },
@ -22,10 +21,9 @@
"nvim-dap": { "branch": "master", "commit": "1c63f37f95cd4fb54512898168138d9a75d1516a" },
"nvim-dap-ui": { "branch": "master", "commit": "85b16ac2309d85c88577cd8ee1733ce52be8227e" },
"nvim-lspconfig": { "branch": "master", "commit": "67f151e84daddc86cc65f5d935e592f76b9f4496" },
"nvim-treesitter": { "branch": "master", "commit": "8fa7ce35afe88b8294e6ced757aa14ec98414568" },
"nvim-treesitter": { "branch": "master", "commit": "43b2153d26da8308e3d58ac0db911111c7c35395" },
"nvim-web-devicons": { "branch": "master", "commit": "cfc8824cc1db316a276b36517f093baccb8e799a" },
"plenary.nvim": { "branch": "master", "commit": "267282a9ce242bbb0c5dc31445b6d353bed978bb" },
"presence.nvim": { "branch": "main", "commit": "87c857a56b7703f976d3a5ef15967d80508df6e6" },
"rust-tools.nvim": { "branch": "master", "commit": "0cc8adab23117783a0292a0c8a2fbed1005dc645" },
"telescope.nvim": { "branch": "0.1.x", "commit": "776b509f80dd49d8205b9b0d94485568236d1192" }
}

View file

@ -26,7 +26,7 @@ opt.list = true -- Show punctuation
opt.listchars = { -- Punctuation marks
trail = '·',
nbsp = '',
tab = '~',
tab = '',
}
-- Trailing whitespace

View file

@ -1,13 +1,29 @@
local U = require("utils")
return {
-- Fennel
{"rktjmp/hotpot.nvim"},
-- Editor theme
require("plugins.kanagawa"),
{
"rebelot/kanagawa.nvim",
lazy = false,
priority = 1000,
config = function()
vim.cmd("colorscheme kanagawa")
end,
},
-- Status line
require("plugins.lualine"),
{
"nvim-lualine/lualine.nvim",
dependencies = {
"nvim-tree/nvim-web-devicons",
},
config = function()
local lualine = require("lualine")
lualine.setup({})
end
},
-- File tree
{
@ -45,7 +61,7 @@ return {
},
config = function()
local config = require("bufferline")
config.setup({})
config.setup()
end
},
@ -63,20 +79,7 @@ return {
"lewis6991/gitsigns.nvim",
config = function()
local gitsigns = require("gitsigns")
gitsigns.setup()
end,
},
-- Discord presence
{
"andweeb/presence.nvim",
config = function()
local presence = require("presence")
presence.setup({
main_image = "file",
buttons = false,
show_time = false,
})
gitsigns.setup({})
end,
},
@ -127,9 +130,8 @@ return {
},
-- LS configs
{
U.plugin("plugins.lspconfig") {
"neovim/nvim-lspconfig",
config = require("configs/lsp"),
},
-- Snippet engine
@ -139,7 +141,7 @@ return {
},
-- Completion
{
U.plugin("plugins.cmp") {
"hrsh7th/nvim-cmp",
dependencies = {
"hrsh7th/cmp-cmdline",
@ -148,7 +150,6 @@ return {
"hrsh7th/cmp-nvim-lsp",
"saadparwaiz1/cmp_luasnip",
},
config = require("configs/cmp"),
},
-- Debugger adapter support
@ -161,9 +162,8 @@ return {
},
-- Debugger UI
{
U.plugin("plugins.dap-ui") {
"rcarriga/nvim-dap-ui",
config = require("configs/debugging"),
dependencies = {
"mfussenegger/nvim-dap",
},
@ -245,14 +245,13 @@ return {
},
-- Tools for Rust
{
U.plugin("plugins.rust-tools") {
"simrat39/rust-tools.nvim",
ft = "rust",
config = require("configs/rust-tools"),
},
-- Tools for Haskell
{
U.plugin("plugins.haskell-tools") {
"mrcjkb/haskell-tools.nvim",
branch = "1.x.x",
ft = "haskell",

View file

@ -1,5 +1,7 @@
local M = {}
-- Reference: https://github.com/hrsh7th/nvim-cmp#recommended-configuration
return function()
function M.config()
local cmp = require "cmp"
cmp.setup({
@ -62,3 +64,5 @@ return function()
})
end
return M

View file

@ -1,7 +1,10 @@
return function()
local M = {}
function M.config()
local dap = require "dap"
local dapui = require "dapui"
dapui.setup({
icons = { expanded = "", collapsed = "", current_frame = "" },
mappings = {
@ -83,6 +86,9 @@ return function()
-- end
-- dap.listeners.before.event_exited["dapui_config"] = function()
-- dapui.close()
-- end
-- end
end
return M

View file

@ -1,4 +1,6 @@
return function()
local M = {}
function M.config()
local ht = require('haskell-tools')
local def_opts = { noremap = true, silent = true, }
@ -31,5 +33,8 @@ return function()
-- Detect nvim-dap launch configurations
-- (requires nvim-dap and haskell-debug-adapter)
-- ht.dap.discover_configurations(bufnr)
return 1
end
return M

View file

@ -1,4 +1,7 @@
return function()
local M = {}
function M.config()
-- Global mappings.
-- See `:help vim.diagnostic.*` for documentation on any of the below functions
vim.keymap.set('n', '<space>e', vim.diagnostic.open_float)
@ -39,3 +42,6 @@ return function()
})
end
return M

View file

@ -1,4 +1,6 @@
return function()
local M = {}
function M.config()
local rt = require "rust-tools"
local mason = require "mason-registry"
local capabilities = require "cmp_nvim_lsp"
@ -34,3 +36,5 @@ return function()
rt.setup(opts)
end
return M

15
nvim/lua/utils.lua Normal file
View file

@ -0,0 +1,15 @@
local M = {}
--- Loads plugin config
---@param path string
---@return fun(meta: table): table
function M.plugin(path)
local loaded = require(path)
return function(meta)
return vim.tbl_extend("keep", meta, loaded)
end
end
return M