feat(nvim): add neodev

This commit is contained in:
Maciej Jur 2023-11-15 21:39:37 +01:00
parent b86aa2d2a2
commit 3af14c7fa5
Signed by: kamov
GPG key ID: 191CBFF5F72ECAFD
5 changed files with 109 additions and 83 deletions

View file

@ -4,12 +4,12 @@ if vim.loader then
end end
-- Setup default options -- Setup default options
require("options") require "options"
require("keymaps") require "keymaps"
-- Are we inside Neovide? -- Are we inside Neovide?
if vim.g.neovide then if vim.g.neovide then
require("neovide") require "neovide"
end end
-- Are we outside VSCode? -- Are we outside VSCode?
@ -22,7 +22,7 @@ if not vim.g.vscode then
"clone", "clone",
"--filter=blob:none", "--filter=blob:none",
"https://github.com/folke/lazy.nvim.git", "https://github.com/folke/lazy.nvim.git",
"--branch=stable", -- latest stable release "--branch=stable",
lazypath, lazypath,
}) })
end end
@ -30,14 +30,15 @@ if not vim.g.vscode then
-- Load lazy -- Load lazy
local ok, err = pcall(function() local ok, err = pcall(function()
local plugins, lazy = require("plugins"), require("lazy") local plugins = require "plugins"
local lazy = require "lazy"
lazy.setup(plugins) lazy.setup(plugins)
vim.keymap.set('n', '<leader>pm', lazy.home, { desc = "Package manager: open" })
end) end)
if not ok then if not ok and err then
-- save my eyes vim.cmd "colorscheme slate"
vim.cmd("colorscheme slate")
vim.schedule(function() vim.schedule(function()
vim.notify(err, vim.log.levels.ERROR) vim.notify(err, vim.log.levels.ERROR)
end) end)

View file

@ -1,5 +1,5 @@
{ {
"LuaSnip": { "branch": "master", "commit": "0b4950a237ce441a6a3a947d501622453f6860ea" }, "LuaSnip": { "branch": "master", "commit": "1f4ad8bb72bdeb60975e98652636b991a9b7475d" },
"bufferline.nvim": { "branch": "main", "commit": "6ecd37e0fa8b156099daedd2191130e083fb1490" }, "bufferline.nvim": { "branch": "main", "commit": "6ecd37e0fa8b156099daedd2191130e083fb1490" },
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
"cmp-cmdline": { "branch": "main", "commit": "8ee981b4a91f536f52add291594e89fb6645e451" }, "cmp-cmdline": { "branch": "main", "commit": "8ee981b4a91f536f52add291594e89fb6645e451" },
@ -12,18 +12,19 @@
"kanagawa.nvim": { "branch": "master", "commit": "c19b9023842697ec92caf72cd3599f7dd7be4456" }, "kanagawa.nvim": { "branch": "master", "commit": "c19b9023842697ec92caf72cd3599f7dd7be4456" },
"lazy.nvim": { "branch": "main", "commit": "96584866b9c5e998cbae300594d0ccfd0c464627" }, "lazy.nvim": { "branch": "main", "commit": "96584866b9c5e998cbae300594d0ccfd0c464627" },
"lualine.nvim": { "branch": "master", "commit": "2248ef254d0a1488a72041cfb45ca9caada6d994" }, "lualine.nvim": { "branch": "master", "commit": "2248ef254d0a1488a72041cfb45ca9caada6d994" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "40301e1c74bc0946eece13edf2b1c561cc497491" }, "mason-lspconfig.nvim": { "branch": "main", "commit": "faeb361507aa1ef1b0e5645781e2aa0d36a4aa84" },
"mason-nvim-dap.nvim": { "branch": "main", "commit": "f0cd12f7a8a310c58cecebddb6b219ffad1cfd0f" }, "mason-nvim-dap.nvim": { "branch": "main", "commit": "f0cd12f7a8a310c58cecebddb6b219ffad1cfd0f" },
"mason.nvim": { "branch": "main", "commit": "eabf6d347fdb75be360d4c0ced1145670a171453" }, "mason.nvim": { "branch": "main", "commit": "41e75af1f578e55ba050c863587cffde3556ffa6" },
"neo-tree.nvim": { "branch": "v3.x", "commit": "f053f09962819c1558cd93639aa80edf7c314c17" }, "neo-tree.nvim": { "branch": "v3.x", "commit": "f053f09962819c1558cd93639aa80edf7c314c17" },
"neodev.nvim": { "branch": "main", "commit": "b2881eeb395d2b268de5fe9b5e201a8f1816beb8" },
"nui.nvim": { "branch": "main", "commit": "c0c8e347ceac53030f5c1ece1c5a5b6a17a25b32" }, "nui.nvim": { "branch": "main", "commit": "c0c8e347ceac53030f5c1ece1c5a5b6a17a25b32" },
"nvim-cmp": { "branch": "main", "commit": "0b751f6beef40fd47375eaf53d3057e0bfa317e4" }, "nvim-cmp": { "branch": "main", "commit": "0b751f6beef40fd47375eaf53d3057e0bfa317e4" },
"nvim-dap": { "branch": "master", "commit": "4048f37bc8b1a36fe1f5fde0df7d84aef71380e4" }, "nvim-dap": { "branch": "master", "commit": "9d81c11fd185a131f81841e64941859305f6c42d" },
"nvim-dap-ui": { "branch": "master", "commit": "34160a7ce6072ef332f350ae1d4a6a501daf0159" }, "nvim-dap-ui": { "branch": "master", "commit": "34160a7ce6072ef332f350ae1d4a6a501daf0159" },
"nvim-lspconfig": { "branch": "master", "commit": "37457f268af5cd6765e589b0dcd7cbd192d8da00" }, "nvim-lspconfig": { "branch": "master", "commit": "d5d7412ff267b92a11a94e6559d5507c43670a52" },
"nvim-notify": { "branch": "master", "commit": "e4a2022f4fec2d5ebc79afa612f96d8b11c627b3" }, "nvim-notify": { "branch": "master", "commit": "e4a2022f4fec2d5ebc79afa612f96d8b11c627b3" },
"nvim-treesitter": { "branch": "master", "commit": "9a746b4b6a1ef215943f07e6aa2ec35fb14097d4" }, "nvim-treesitter": { "branch": "master", "commit": "8b9f99660294dcd11d42572c84ee33a1e284f70d" },
"nvim-web-devicons": { "branch": "master", "commit": "5de460ca7595806044eced31e3c36c159a493857" }, "nvim-web-devicons": { "branch": "master", "commit": "11eb26fc166742db8d1e8a6f5a7de9df37b09aae" },
"plenary.nvim": { "branch": "master", "commit": "50012918b2fc8357b87cff2a7f7f0446e47da174" }, "plenary.nvim": { "branch": "master", "commit": "50012918b2fc8357b87cff2a7f7f0446e47da174" },
"presence.nvim": { "branch": "main", "commit": "87c857a56b7703f976d3a5ef15967d80508df6e6" }, "presence.nvim": { "branch": "main", "commit": "87c857a56b7703f976d3a5ef15967d80508df6e6" },
"rust-tools.nvim": { "branch": "master", "commit": "0cc8adab23117783a0292a0c8a2fbed1005dc645" }, "rust-tools.nvim": { "branch": "master", "commit": "0cc8adab23117783a0292a0c8a2fbed1005dc645" },

View file

@ -3,27 +3,27 @@ local map, augroup, autocmd = U.keymap, U.augroup, U.autocmd
local n, t, nv = map 'n', map 't', map {'n', 'v'} local n, t, nv = map 'n', map 't', map {'n', 'v'}
n "<leader>mn" ":Explore ~/.config/nvim/<cr>" "Meta: open Neovim config" n "<leader>mn" ":Explore ~/.config/nvim/<cr>" "Meta: open Neovim config"
n "<Leader>ex" ":Explore<CR>" "Netrw: open" n "<Leader>ex" ":Explore<CR>" "Netrw: open"
n "<Leader>hl" ":nohl<CR>" "Hide highlights" n "<Leader>hl" ":nohl<CR>" "Hide highlights"
n "j" "gj" "Move: down by line" n "j" "gj" "Move: down by line"
n "k" "gk" "Move: up by line" n "k" "gk" "Move: up by line"
n "<Leader>bn" ":bn<CR>" "Buffer: next" n "<Leader>bn" ":bn<CR>" "Buffer: next"
n "<Leader>bp" ":bp<CR>" "Buffer: previous" n "<Leader>bp" ":bp<CR>" "Buffer: previous"
n "<Leader>bd" ":bd<CR>" "Buffer: delete" n "<Leader>bd" ":bd<CR>" "Buffer: delete"
t "<Esc><Esc>" [[<C-\><C-n>]] "Exit from terminal mode" t "<Esc><Esc>" [[<C-\><C-n>]] "Exit from terminal mode"
n "<C-h>" "<C-w>h" "Window: move left" n "<C-h>" "<C-w>h" "Window: move left"
n "<C-j>" "<C-w>j" "Window: move down" n "<C-j>" "<C-w>j" "Window: move down"
n "<C-k>" "<C-w>k" "Window: move up" n "<C-k>" "<C-w>k" "Window: move up"
n "<C-l>" "<C-w>l" "Window: move right" n "<C-l>" "<C-w>l" "Window: move right"
-- Diagnostic -- Diagnostics
n "<leader>de" (vim.diagnostic.open_float) "Diagnostic: open float" n "<leader>e" (vim.diagnostic.open_float) "Open error diagnostics"
n "[d" (vim.diagnostic.goto_prev) "Previous diagnostic message" n "[d" (vim.diagnostic.goto_prev) "Previous diagnostic message"
n "]d" (vim.diagnostic.goto_next) "Next diagnostic message" n "]d" (vim.diagnostic.goto_next) "Next diagnostic message"
n "<leader>dl" (vim.diagnostic.setloclist) "Diagnostic: list messages" n "<leader>dl" (vim.diagnostic.setloclist) "Diagnostic: list messages"

View file

@ -39,14 +39,11 @@ autocmd "BufWritePre" {} (function()
end) end)
-- Additional filetypes -- Additional filetypes
vim.filetype.add({ vim.filetype.add {
extension = { extension = {
mdx = "mdx", mdx = "mdx",
typ = "typst", typ = "typst",
purs = "purescript", purs = "purescript",
} }
}) }
-- Keymap
vim.keymap.set('n', "<leader>e", vim.diagnostic.open_float, {})

View file

@ -1,7 +1,8 @@
local U = require("utility") local U = require "utility"
local n = U.keymap 'n' local n = U.keymap "n"
---@type LazySpec
return { return {
-- Editor theme -- Editor theme
@ -21,8 +22,8 @@ return {
"nvim-tree/nvim-web-devicons", "nvim-tree/nvim-web-devicons",
}, },
config = function() config = function()
local lualine = require("lualine") local lualine = require "lualine"
lualine.setup({}) lualine.setup {}
end end
}, },
@ -32,13 +33,16 @@ return {
branch = "0.1.x", branch = "0.1.x",
dependencies = { dependencies = {
"nvim-lua/plenary.nvim", "nvim-lua/plenary.nvim",
{"nvim-telescope/telescope-fzf-native.nvim", build = "make"} { "nvim-telescope/telescope-fzf-native.nvim", build = "make" }
}, },
config = function() config = function()
local telescope = require "telescope" local telescope = require "telescope"
local builtin = require "telescope.builtin" local builtin = require "telescope.builtin"
local ext = telescope.extensions local ext = telescope.extensions
telescope.setup({
telescope.load_extension "fzf"
telescope.load_extension "notify"
telescope.setup {
extensions = { extensions = {
fzf = { fzf = {
fuzzy = true, fuzzy = true,
@ -47,9 +51,8 @@ return {
case_mode = "smart_case", case_mode = "smart_case",
} }
} }
}) }
telescope.load_extension("fzf")
telescope.load_extension("notify")
n "<leader>ff" (builtin.find_files) "Telescope: find files" n "<leader>ff" (builtin.find_files) "Telescope: find files"
n "<leader>fb" (builtin.buffers) "Telescope: find buffers" n "<leader>fb" (builtin.buffers) "Telescope: find buffers"
n "<leader>fg" (builtin.live_grep) "Telescope: grep content" n "<leader>fg" (builtin.live_grep) "Telescope: grep content"
@ -90,13 +93,13 @@ return {
-- Bufferline -- Bufferline
{ {
'akinsho/bufferline.nvim', "akinsho/bufferline.nvim",
version = "*", version = "*",
dependencies = { dependencies = {
'nvim-tree/nvim-web-devicons' "nvim-tree/nvim-web-devicons"
}, },
config = function() config = function()
local config = require("bufferline") local config = require "bufferline"
config.setup() config.setup()
end end
}, },
@ -114,15 +117,17 @@ return {
{ {
"lewis6991/gitsigns.nvim", "lewis6991/gitsigns.nvim",
config = function() config = function()
local gitsigns = require("gitsigns") local gitsigns = require "gitsigns"
gitsigns.setup({}) gitsigns.setup()
end, end,
}, },
{ {
"andweeb/presence.nvim", "andweeb/presence.nvim",
config = function() config = function()
require("presence").setup { local presence = require "presence"
presence.setup {
main_image = "file", main_image = "file",
show_time = false, show_time = false,
buttons = false, buttons = false,
@ -135,9 +140,13 @@ return {
"nvim-treesitter/nvim-treesitter", "nvim-treesitter/nvim-treesitter",
build = ":TSUpdate", build = ":TSUpdate",
config = function() config = function()
local configs = require("nvim-treesitter.configs"); local config = require "nvim-treesitter.configs"
configs.setup({
sync_install = false, config.setup {
modules = {},
auto_install = false,
sync_install = false,
ignore_install = {},
ensure_installed = { ensure_installed = {
-- nvim -- nvim
"vim", "vimdoc", "lua", "vim", "vimdoc", "lua",
@ -168,11 +177,13 @@ return {
indent = { indent = {
enable = true, enable = true,
}, },
}) }
end, end,
init = function() init = function()
vim.treesitter.language.register("markdown", "mdx") local lang = vim.treesitter.language
vim.treesitter.language.register("haskell", "purescript")
lang.register("markdown", "mdx")
lang.register("haskell", "purescript")
end, end,
}, },
@ -204,6 +215,7 @@ return {
"mfussenegger/nvim-dap", "mfussenegger/nvim-dap",
config = function() config = function()
local dap = require "dap" local dap = require "dap"
n "<leader>b" (dap.toggle_breakpoint) "DAP: Toggle breakpoint" n "<leader>b" (dap.toggle_breakpoint) "DAP: Toggle breakpoint"
end, end,
}, },
@ -220,12 +232,12 @@ return {
{ {
"williamboman/mason.nvim", "williamboman/mason.nvim",
config = function() config = function()
local mason = require("mason") local mason = require "mason"
mason.setup() mason.setup()
end, end,
}, },
-- Automatic language server install -- Automatic LSP server setup for Mason
{ {
"williamboman/mason-lspconfig.nvim", "williamboman/mason-lspconfig.nvim",
dependencies = { dependencies = {
@ -233,8 +245,11 @@ return {
"neovim/nvim-lspconfig", "neovim/nvim-lspconfig",
}, },
config = function() config = function()
local config = require("mason-lspconfig") local config = require "mason-lspconfig"
config.setup({ local lsp = require "lspconfig"
local cmp = require "cmp_nvim_lsp"
config.setup {
automatic_installation = true, automatic_installation = true,
-- NOTE -- NOTE
-- Haskell: Use GHCup installation instead of hls -- Haskell: Use GHCup installation instead of hls
@ -252,25 +267,16 @@ return {
"purescriptls", -- Purescript "purescriptls", -- Purescript
"ltex", -- Literate - LaTeX, Markdown, etc. "ltex", -- Literate - LaTeX, Markdown, etc.
}, },
}) }
local lspconfig = require("lspconfig") config.setup_handlers {
local capabilities = require("cmp_nvim_lsp").default_capabilities()
config.setup_handlers({
function(server) function(server)
lspconfig[server].setup({ lsp[server].setup({
single_file_support = true, single_file_support = true,
capabilities = capabilities, capabilities = cmp.default_capabilities(),
}) })
end, end,
["lua_ls"] = function() }
lspconfig.lua_ls.setup({
single_file_support = true,
capabilities = capabilities,
settings = { Lua = { diagnostics = { globals = { "vim" } } } },
})
end,
})
end, end,
}, },
@ -282,16 +288,37 @@ return {
"williamboman/mason.nvim", "williamboman/mason.nvim",
}, },
config = function() config = function()
local config = require("mason-nvim-dap") local config = require "mason-nvim-dap"
config.setup({
config.setup {
automatic_installation = true, automatic_installation = true,
ensure_installed = { ensure_installed = {
"codelldb", -- Rust "codelldb",
}, },
}) }
end, end,
}, },
-- Tools for Neovim
{
"folke/neodev.nvim",
ft = "lua",
dependencies = {
"neovim/nvim-lspconfig",
},
config = function()
local neodev = require "neodev"
local lsp = require "lspconfig"
neodev.setup()
lsp.lua_ls.setup {
settings = {
Lua = { completion = { callSnippet = "Replace" } }
}
}
end
},
-- Tools for Rust -- Tools for Rust
require "plugins.rust-tools" { require "plugins.rust-tools" {
"simrat39/rust-tools.nvim", "simrat39/rust-tools.nvim",
@ -302,7 +329,7 @@ return {
require "plugins.haskell-tools" { require "plugins.haskell-tools" {
"mrcjkb/haskell-tools.nvim", "mrcjkb/haskell-tools.nvim",
version = "^3", version = "^3",
ft = {"haskell", "lhaskell", "cabal", "cabalproject"}, ft = { "haskell", "lhaskell", "cabal", "cabalproject" },
dependencies = { dependencies = {
"nvim-lua/plenary.nvim", "nvim-lua/plenary.nvim",
"nvim-telescope/telescope.nvim", "nvim-telescope/telescope.nvim",