nvim: refactor config
This commit is contained in:
parent
225b1b37f2
commit
61578424eb
|
@ -1,7 +1,6 @@
|
||||||
{
|
{
|
||||||
"Comment.nvim": { "branch": "master", "commit": "0236521ea582747b58869cb72f70ccfa967d2e89" },
|
"Comment.nvim": { "branch": "master", "commit": "0236521ea582747b58869cb72f70ccfa967d2e89" },
|
||||||
"LuaSnip": { "branch": "master", "commit": "8ae1dedd988eb56441b7858bd1e8554dfadaa46d" },
|
"LuaSnip": { "branch": "master", "commit": "8ae1dedd988eb56441b7858bd1e8554dfadaa46d" },
|
||||||
"bufferline.nvim": { "branch": "main", "commit": "6c456b888823d9e4832aa91c482bccd19445c009" },
|
|
||||||
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
|
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
|
||||||
"cmp-cmdline": { "branch": "main", "commit": "8ee981b4a91f536f52add291594e89fb6645e451" },
|
"cmp-cmdline": { "branch": "main", "commit": "8ee981b4a91f536f52add291594e89fb6645e451" },
|
||||||
"cmp-nvim-lsp": { "branch": "main", "commit": "5af77f54de1b16c34b23cba810150689a3a90312" },
|
"cmp-nvim-lsp": { "branch": "main", "commit": "5af77f54de1b16c34b23cba810150689a3a90312" },
|
||||||
|
@ -15,19 +14,19 @@
|
||||||
"lualine.nvim": { "branch": "master", "commit": "566b7036f717f3d676362742630518a47f132fff" },
|
"lualine.nvim": { "branch": "master", "commit": "566b7036f717f3d676362742630518a47f132fff" },
|
||||||
"mason-lspconfig.nvim": { "branch": "main", "commit": "3ba1b92b771f33256b4969d696b82c8ae7075364" },
|
"mason-lspconfig.nvim": { "branch": "main", "commit": "3ba1b92b771f33256b4969d696b82c8ae7075364" },
|
||||||
"mason-nvim-dap.nvim": { "branch": "main", "commit": "3614a39aae98ccd34124b072939d6283853b3dd2" },
|
"mason-nvim-dap.nvim": { "branch": "main", "commit": "3614a39aae98ccd34124b072939d6283853b3dd2" },
|
||||||
"mason.nvim": { "branch": "main", "commit": "bce96d2fd483e71826728c6f9ac721fc9dd7d2cf" },
|
"mason.nvim": { "branch": "main", "commit": "9c9416817c9f4e6f333c749327a1ed5355cfab61" },
|
||||||
"neo-tree.nvim": { "branch": "v3.x", "commit": "2f2d08894bbc679d4d181604c16bb7079f646384" },
|
"neo-tree.nvim": { "branch": "v3.x", "commit": "2f2d08894bbc679d4d181604c16bb7079f646384" },
|
||||||
"neodev.nvim": { "branch": "main", "commit": "aaeb44589cab39c2545a328661af355622d68479" },
|
"neodev.nvim": { "branch": "main", "commit": "5bbbeda6a9c672f314c95ca47a8b495cf6de17f9" },
|
||||||
"nui.nvim": { "branch": "main", "commit": "35da9ca1de0fc4dda96c2e214d93d363c145f418" },
|
"nui.nvim": { "branch": "main", "commit": "35da9ca1de0fc4dda96c2e214d93d363c145f418" },
|
||||||
"nvim-cmp": { "branch": "main", "commit": "538e37ba87284942c1d76ed38dd497e54e65b891" },
|
"nvim-cmp": { "branch": "main", "commit": "538e37ba87284942c1d76ed38dd497e54e65b891" },
|
||||||
"nvim-dap": { "branch": "master", "commit": "9adbfdca13afbe646d09a8d7a86d5d031fb9c5a5" },
|
"nvim-dap": { "branch": "master", "commit": "9adbfdca13afbe646d09a8d7a86d5d031fb9c5a5" },
|
||||||
"nvim-dap-ui": { "branch": "master", "commit": "a62e86b124a94ad1f34a3f936ea146d00aa096d1" },
|
"nvim-dap-ui": { "branch": "master", "commit": "d845ebd798ad1cf30aa4abd4c4eff795cdcfdd4f" },
|
||||||
"nvim-lspconfig": { "branch": "master", "commit": "8917d2c830e04bf944a699b8c41f097621283828" },
|
"nvim-lspconfig": { "branch": "master", "commit": "8917d2c830e04bf944a699b8c41f097621283828" },
|
||||||
"nvim-notify": { "branch": "master", "commit": "80b67b265530632505193553d05127ae7fe09ddd" },
|
"nvim-notify": { "branch": "master", "commit": "80b67b265530632505193553d05127ae7fe09ddd" },
|
||||||
"nvim-treesitter": { "branch": "master", "commit": "94bd4bcc5bbce8334303727627b628ece72e798d" },
|
"nvim-treesitter": { "branch": "master", "commit": "cd4e0909948eb33d3959e133c16f837e4db122c6" },
|
||||||
"nvim-web-devicons": { "branch": "master", "commit": "140edfcf25093e8b321d13e154cbce89ee868ca0" },
|
"nvim-web-devicons": { "branch": "master", "commit": "140edfcf25093e8b321d13e154cbce89ee868ca0" },
|
||||||
"plenary.nvim": { "branch": "master", "commit": "663246936325062427597964d81d30eaa42ab1e4" },
|
"plenary.nvim": { "branch": "master", "commit": "663246936325062427597964d81d30eaa42ab1e4" },
|
||||||
"rustaceanvim": { "branch": "master", "commit": "b0c03f052d24a2bfc4cc681075c2d81d3c3ac2f7" },
|
"rustaceanvim": { "branch": "master", "commit": "a095a1f9397310d108ead239edc068b2624695b6" },
|
||||||
"telescope-fzf-native.nvim": { "branch": "main", "commit": "6c921ca12321edaa773e324ef64ea301a1d0da62" },
|
"telescope-fzf-native.nvim": { "branch": "main", "commit": "6c921ca12321edaa773e324ef64ea301a1d0da62" },
|
||||||
"telescope.nvim": { "branch": "0.1.x", "commit": "d90956833d7c27e73c621a61f20b29fdb7122709" },
|
"telescope.nvim": { "branch": "0.1.x", "commit": "d90956833d7c27e73c621a61f20b29fdb7122709" },
|
||||||
"which-key.nvim": { "branch": "main", "commit": "4433e5ec9a507e5097571ed55c02ea9658fb268a" }
|
"which-key.nvim": { "branch": "main", "commit": "4433e5ec9a507e5097571ed55c02ea9658fb268a" }
|
||||||
|
|
38
nvim/lua/config/composer.lua
Normal file
38
nvim/lua/config/composer.lua
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
---@alias Tag
|
||||||
|
--- | 'standalone'
|
||||||
|
--- | 'linux'
|
||||||
|
|
||||||
|
---@type table<Tag, boolean>
|
||||||
|
local env = {
|
||||||
|
standalone = not vim.g.vscode,
|
||||||
|
linux = jit.os == 'Linux',
|
||||||
|
}
|
||||||
|
|
||||||
|
---@param tags Tag | Tag[]
|
||||||
|
local function is(tags)
|
||||||
|
if type(tags) == 'string' then
|
||||||
|
return env[tags] or false
|
||||||
|
end
|
||||||
|
|
||||||
|
for _, tag in ipairs(tags) do
|
||||||
|
if not env[tag] then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
|
---@param tags Tag | Tag[]
|
||||||
|
local function when(tags)
|
||||||
|
local match = is(tags)
|
||||||
|
---@generic T
|
||||||
|
---@param table `T`
|
||||||
|
---@return T | nil
|
||||||
|
return function(table)
|
||||||
|
return match and table or nil
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return function()
|
||||||
|
return is, when
|
||||||
|
end
|
|
@ -16,7 +16,7 @@ end
|
||||||
vim.opt.rtp:prepend(path)
|
vim.opt.rtp:prepend(path)
|
||||||
|
|
||||||
-- Load
|
-- Load
|
||||||
local plugins = require 'plugins'
|
local plugins = require 'config.plugins'
|
||||||
local lazy = require 'lazy'
|
local lazy = require 'lazy'
|
||||||
|
|
||||||
-- Init
|
-- Init
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
local is, when = require 'config.composer' ()
|
||||||
local util = require 'config.utils'
|
local util = require 'config.utils'
|
||||||
local n = util.keymap 'n'
|
local n = util.keymap 'n'
|
||||||
|
|
||||||
|
@ -8,7 +9,7 @@ return {
|
||||||
-- Theme
|
-- Theme
|
||||||
{
|
{
|
||||||
'rebelot/kanagawa.nvim',
|
'rebelot/kanagawa.nvim',
|
||||||
enabled = not vim.g.vscode,
|
enabled = is 'standalone',
|
||||||
lazy = false,
|
lazy = false,
|
||||||
priority = math.huge,
|
priority = math.huge,
|
||||||
config = function()
|
config = function()
|
||||||
|
@ -19,32 +20,38 @@ return {
|
||||||
-- Status line
|
-- Status line
|
||||||
{
|
{
|
||||||
'nvim-lualine/lualine.nvim',
|
'nvim-lualine/lualine.nvim',
|
||||||
enabled = not vim.g.vscode,
|
enabled = is 'standalone',
|
||||||
dependencies = {
|
dependencies = {
|
||||||
'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 {
|
||||||
|
tabline = {
|
||||||
|
lualine_a = { 'buffers' },
|
||||||
|
}
|
||||||
|
}
|
||||||
end
|
end
|
||||||
},
|
},
|
||||||
|
|
||||||
-- Telescope
|
-- Telescope
|
||||||
{
|
{
|
||||||
'nvim-telescope/telescope.nvim',
|
'nvim-telescope/telescope.nvim',
|
||||||
enabled = not vim.g.vscode,
|
enabled = is 'standalone',
|
||||||
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' }
|
when 'linux' { '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.load_extension 'fzf'
|
if is 'linux' then telescope.load_extension 'fzf' end
|
||||||
telescope.load_extension 'notify'
|
if is 'standalone' then telescope.load_extension 'notify' end
|
||||||
|
|
||||||
telescope.setup {
|
telescope.setup {
|
||||||
extensions = {
|
extensions = {
|
||||||
fzf = {
|
fzf = {
|
||||||
|
@ -60,7 +67,10 @@ return {
|
||||||
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'
|
||||||
n '<leader>fh' (builtin.help_tags) 'Telescope: search docs'
|
n '<leader>fh' (builtin.help_tags) 'Telescope: search docs'
|
||||||
|
|
||||||
|
if is 'standalone' then
|
||||||
n '<leader>fn' (ext.notify.notify) 'Telescope: find notifications'
|
n '<leader>fn' (ext.notify.notify) 'Telescope: find notifications'
|
||||||
|
end
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -80,7 +90,7 @@ return {
|
||||||
-- neovim
|
-- neovim
|
||||||
'vimdoc', 'lua', 'query',
|
'vimdoc', 'lua', 'query',
|
||||||
-- data
|
-- data
|
||||||
'json', 'xml', 'yaml', 'toml', 'dhall',
|
'json', 'xml', 'yaml', 'toml',
|
||||||
-- markdown
|
-- markdown
|
||||||
'markdown', 'markdown_inline',
|
'markdown', 'markdown_inline',
|
||||||
-- latex
|
-- latex
|
||||||
|
@ -91,8 +101,6 @@ return {
|
||||||
'comment', 'dockerfile', 'regex',
|
'comment', 'dockerfile', 'regex',
|
||||||
-- shell
|
-- shell
|
||||||
'bash',
|
'bash',
|
||||||
-- julia
|
|
||||||
'julia',
|
|
||||||
-- python
|
-- python
|
||||||
'python',
|
'python',
|
||||||
-- rust
|
-- rust
|
||||||
|
@ -100,7 +108,7 @@ return {
|
||||||
-- webdev
|
-- webdev
|
||||||
'html', 'css', 'scss', 'javascript', 'jsdoc', 'typescript', 'tsx', 'astro', 'svelte',
|
'html', 'css', 'scss', 'javascript', 'jsdoc', 'typescript', 'tsx', 'astro', 'svelte',
|
||||||
-- haskell
|
-- haskell
|
||||||
'haskell', 'purescript', 'nix',
|
'haskell',
|
||||||
},
|
},
|
||||||
highlight = { enable = true },
|
highlight = { enable = true },
|
||||||
indent = { enable = true },
|
indent = { enable = true },
|
||||||
|
@ -126,11 +134,8 @@ return {
|
||||||
-- Git signs
|
-- Git signs
|
||||||
{
|
{
|
||||||
'lewis6991/gitsigns.nvim',
|
'lewis6991/gitsigns.nvim',
|
||||||
enabled = not vim.g.vscode,
|
enabled = is 'standalone',
|
||||||
config = function()
|
config = true,
|
||||||
local gitsigns = require 'gitsigns'
|
|
||||||
gitsigns.setup()
|
|
||||||
end,
|
|
||||||
},
|
},
|
||||||
|
|
||||||
-- Comments
|
-- Comments
|
||||||
|
@ -142,7 +147,7 @@ return {
|
||||||
-- Shortcut hints
|
-- Shortcut hints
|
||||||
{
|
{
|
||||||
'folke/which-key.nvim',
|
'folke/which-key.nvim',
|
||||||
enabled = not vim.g.vscode,
|
enabled = is 'standalone',
|
||||||
event = 'VeryLazy',
|
event = 'VeryLazy',
|
||||||
init = function()
|
init = function()
|
||||||
vim.o.timeout = true
|
vim.o.timeout = true
|
||||||
|
@ -154,7 +159,7 @@ return {
|
||||||
-- Notifications
|
-- Notifications
|
||||||
{
|
{
|
||||||
'rcarriga/nvim-notify',
|
'rcarriga/nvim-notify',
|
||||||
enabled = not vim.g.vscode,
|
enabled = is 'standalone',
|
||||||
config = function()
|
config = function()
|
||||||
vim.notify = require 'notify'
|
vim.notify = require 'notify'
|
||||||
end
|
end
|
||||||
|
@ -163,7 +168,7 @@ return {
|
||||||
-- File tree
|
-- File tree
|
||||||
{
|
{
|
||||||
'nvim-neo-tree/neo-tree.nvim',
|
'nvim-neo-tree/neo-tree.nvim',
|
||||||
enabled = not vim.g.vscode,
|
enabled = is 'standalone',
|
||||||
branch = 'v3.x',
|
branch = 'v3.x',
|
||||||
dependencies = {
|
dependencies = {
|
||||||
'nvim-lua/plenary.nvim',
|
'nvim-lua/plenary.nvim',
|
||||||
|
@ -172,44 +177,16 @@ return {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
-- Bufferline
|
|
||||||
{
|
|
||||||
'akinsho/bufferline.nvim',
|
|
||||||
enabled = not vim.g.vscode,
|
|
||||||
version = '*',
|
|
||||||
dependencies = {
|
|
||||||
'nvim-tree/nvim-web-devicons'
|
|
||||||
},
|
|
||||||
config = function()
|
|
||||||
local config = require 'bufferline'
|
|
||||||
config.setup()
|
|
||||||
end
|
|
||||||
},
|
|
||||||
|
|
||||||
-- Git diffviewer
|
-- Git diffviewer
|
||||||
{
|
{
|
||||||
'sindrets/diffview.nvim',
|
'sindrets/diffview.nvim',
|
||||||
enabled = not vim.g.vscode,
|
enabled = is 'standalone',
|
||||||
dependencies = {
|
dependencies = {
|
||||||
'nvim-lua/plenary.nvim',
|
'nvim-lua/plenary.nvim',
|
||||||
'nvim-tree/nvim-web-devicons',
|
'nvim-tree/nvim-web-devicons',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
-- LS configs
|
|
||||||
{
|
|
||||||
'neovim/nvim-lspconfig',
|
|
||||||
enabled = not vim.g.vscode,
|
|
||||||
opts = {
|
|
||||||
inlay_hints = { enabled = true },
|
|
||||||
},
|
|
||||||
config = function()
|
|
||||||
local lsp = require 'lspconfig'
|
|
||||||
|
|
||||||
lsp.nushell.setup {}
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
|
|
||||||
-- Snippet engine
|
-- Snippet engine
|
||||||
{
|
{
|
||||||
'L3MON4D3/LuaSnip',
|
'L3MON4D3/LuaSnip',
|
||||||
|
@ -228,10 +205,16 @@ return {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
-- LS configs
|
||||||
|
{
|
||||||
|
'neovim/nvim-lspconfig',
|
||||||
|
enabled = is { 'standalone', 'linux' },
|
||||||
|
},
|
||||||
|
|
||||||
-- Debugger adapter support
|
-- Debugger adapter support
|
||||||
{
|
{
|
||||||
'mfussenegger/nvim-dap',
|
'mfussenegger/nvim-dap',
|
||||||
enabled = not vim.g.vscode,
|
enabled = is { 'standalone', 'linux' },
|
||||||
config = function()
|
config = function()
|
||||||
local dap = require 'dap'
|
local dap = require 'dap'
|
||||||
|
|
||||||
|
@ -242,7 +225,7 @@ return {
|
||||||
-- Debugger UI
|
-- Debugger UI
|
||||||
require 'plugins.nvim-dap-ui' {
|
require 'plugins.nvim-dap-ui' {
|
||||||
'rcarriga/nvim-dap-ui',
|
'rcarriga/nvim-dap-ui',
|
||||||
enabled = not vim.g.vscode,
|
enabled = is { 'standalone', 'linux' },
|
||||||
dependencies = {
|
dependencies = {
|
||||||
'mfussenegger/nvim-dap',
|
'mfussenegger/nvim-dap',
|
||||||
},
|
},
|
||||||
|
@ -251,17 +234,14 @@ return {
|
||||||
-- Mason
|
-- Mason
|
||||||
{
|
{
|
||||||
'williamboman/mason.nvim',
|
'williamboman/mason.nvim',
|
||||||
enabled = not vim.g.vscode,
|
enabled = is { 'standalone', 'linux' },
|
||||||
config = function()
|
config = true,
|
||||||
local mason = require 'mason'
|
|
||||||
mason.setup()
|
|
||||||
end,
|
|
||||||
},
|
},
|
||||||
|
|
||||||
-- Automatic LSP server setup for Mason
|
-- Automatic LSP server setup for Mason
|
||||||
{
|
{
|
||||||
'williamboman/mason-lspconfig.nvim',
|
'williamboman/mason-lspconfig.nvim',
|
||||||
enabled = not vim.g.vscode,
|
enabled = is { 'standalone', 'linux' },
|
||||||
dependencies = {
|
dependencies = {
|
||||||
'williamboman/mason.nvim',
|
'williamboman/mason.nvim',
|
||||||
'neovim/nvim-lspconfig',
|
'neovim/nvim-lspconfig',
|
||||||
|
@ -309,7 +289,7 @@ return {
|
||||||
-- Automatic debugger install
|
-- Automatic debugger install
|
||||||
{
|
{
|
||||||
'jay-babu/mason-nvim-dap.nvim',
|
'jay-babu/mason-nvim-dap.nvim',
|
||||||
enabled = not vim.g.vscode,
|
enabled = is { 'standalone', 'linux' },
|
||||||
dependencies = {
|
dependencies = {
|
||||||
'mfussenegger/nvim-dap',
|
'mfussenegger/nvim-dap',
|
||||||
'williamboman/mason.nvim',
|
'williamboman/mason.nvim',
|
||||||
|
@ -329,7 +309,7 @@ return {
|
||||||
-- Tools for Neovim
|
-- Tools for Neovim
|
||||||
{
|
{
|
||||||
'folke/neodev.nvim',
|
'folke/neodev.nvim',
|
||||||
enabled = not vim.g.vscode,
|
enabled = is { 'standalone', 'linux' },
|
||||||
ft = 'lua',
|
ft = 'lua',
|
||||||
dependencies = {
|
dependencies = {
|
||||||
'neovim/nvim-lspconfig',
|
'neovim/nvim-lspconfig',
|
||||||
|
@ -350,7 +330,7 @@ return {
|
||||||
-- Tools for Rust
|
-- Tools for Rust
|
||||||
{
|
{
|
||||||
'mrcjkb/rustaceanvim',
|
'mrcjkb/rustaceanvim',
|
||||||
enabled = not vim.g.vscode,
|
enabled = is { 'standalone', 'linux' },
|
||||||
version = '^3',
|
version = '^3',
|
||||||
ft = { 'rust' },
|
ft = { 'rust' },
|
||||||
init = function()
|
init = function()
|
||||||
|
@ -361,7 +341,7 @@ return {
|
||||||
-- Tools for Haskell
|
-- Tools for Haskell
|
||||||
require 'plugins.haskell-tools' {
|
require 'plugins.haskell-tools' {
|
||||||
'mrcjkb/haskell-tools.nvim',
|
'mrcjkb/haskell-tools.nvim',
|
||||||
enabled = not vim.g.vscode,
|
enabled = is { 'standalone', 'linux' },
|
||||||
version = '^3',
|
version = '^3',
|
||||||
ft = { 'haskell', 'lhaskell', 'cabal', 'cabalproject' },
|
ft = { 'haskell', 'lhaskell', 'cabal', 'cabalproject' },
|
||||||
dependencies = {
|
dependencies = {
|
Loading…
Reference in a new issue