vim: everything is module...

This commit is contained in:
Fernando Schauenburg 2023-08-17 22:05:07 +02:00
parent a869818ad2
commit 7a293c6024
23 changed files with 587 additions and 551 deletions

View file

@ -1,14 +1,16 @@
return { local M = { 'norcalli/nvim-colorizer.lua' }
'norcalli/nvim-colorizer.lua',
cond = vim.opt.termguicolors:get(), M.cond = vim.opt.termguicolors:get()
event = {
M.event = {
'BufReadPost', 'BufReadPost',
'BufNewFile' 'BufNewFile'
}, }
config = function()
M.config = function()
require('colorizer').setup(nil, { require('colorizer').setup(nil, {
css = true, css = true,
}) })
end, end
}
return M

View file

@ -1,5 +1,8 @@
local gruvbox = { 'fschauen/gruvbox.nvim', dev = true, lazy = true }
local solarized = { 'fschauen/solarized.nvim', dev = true, lazy =true }
return { return {
{ 'fschauen/solarized.nvim', dev = true, lazy =true }, gruvbox,
{ 'fschauen/gruvbox.nvim', dev = true, lazy = true }, solarized,
} }

View file

@ -1,9 +1,12 @@
return { local M = { 'tpope/vim-commentary' }
'tpope/vim-commentary',
cmd = 'Commentary', M.cmd = 'Commentary'
keys = {
M.keys = {
{ 'gc', '<Plug>Commentary', mode = { 'n', 'x', 'o' }, desc = 'Comment in/out' }, { 'gc', '<Plug>Commentary', mode = { 'n', 'x', 'o' }, desc = 'Comment in/out' },
{ 'gcc', '<Plug>CommentaryLine', desc = 'Comment in/out line' }, { 'gcc', '<Plug>CommentaryLine', desc = 'Comment in/out line' },
{ 'gcu', '<Plug>Commentary<Plug>Commentary', desc = 'Undo comment in/out' }, { 'gcu', '<Plug>Commentary<Plug>Commentary', desc = 'Undo comment in/out' },
},
} }
return M

View file

@ -1,3 +1,17 @@
local M = { 'hrsh7th/nvim-cmp' }
M.dependencies = {
'hrsh7th/cmp-nvim-lsp',
'hrsh7th/cmp-nvim-lua',
'hrsh7th/cmp-path',
'hrsh7th/cmp-buffer',
'hrsh7th/cmp-cmdline',
'onsails/lspkind-nvim',
'L3MON4D3/LuaSnip',
'saadparwaiz1/cmp_luasnip',
}
local repeat_mapping = function(value, keys) local repeat_mapping = function(value, keys)
local tbl = {} local tbl = {}
for _, k in ipairs(keys) do tbl[k] = value end for _, k in ipairs(keys) do tbl[k] = value end
@ -20,7 +34,7 @@ local cond = function(condition, yes, no)
end end
end end
local config = function() M.config = function()
local cmp = require 'cmp' local cmp = require 'cmp'
local map = cmp.mapping local map = cmp.mapping
@ -154,21 +168,5 @@ local config = function()
cmp.setup.filetype('TelescopePrompt', { enabled = false }) cmp.setup.filetype('TelescopePrompt', { enabled = false })
end end
return { return M
'hrsh7th/nvim-cmp',
config = config,
dependencies = {
'hrsh7th/cmp-nvim-lsp',
'hrsh7th/cmp-nvim-lua',
'hrsh7th/cmp-path',
'hrsh7th/cmp-buffer',
'hrsh7th/cmp-cmdline',
'onsails/lspkind-nvim',
'L3MON4D3/LuaSnip',
'saadparwaiz1/cmp_luasnip',
},
}

View file

@ -1,9 +1,11 @@
return { local M = { 'tpope/vim-fugitive' }
'tpope/vim-fugitive',
cmd = { M.cmd = {
'G', 'G',
'Git', 'Git',
},
keys = require('fschauen.keymap').fugitive
} }
M.keys = require('fschauen.keymap').fugitive
return M

View file

@ -1,11 +1,13 @@
local M = { 'lukas-reineke/indent-blankline.nvim' }
M.keys = require('fschauen.keymap').indent_blankline
M.lazy = false -- trows an error when lazy loading
local chars = { '', '¦', '', '', '', '', '', '', '', '' } local chars = { '', '¦', '', '', '', '', '', '', '', '' }
local show_first_level = false local show_first_level = false
return { M.opts = {
'lukas-reineke/indent-blankline.nvim',
keys = require('fschauen.keymap').indent_blankline,
lazy = false, -- trows an error when lazy loading
opts = {
enabled = false, enabled = false,
use_treesitter = true, use_treesitter = true,
show_first_indent_level = show_first_level, show_first_indent_level = show_first_level,
@ -14,6 +16,6 @@ return {
char_list = chars, char_list = chars,
context_char_list = chars, context_char_list = chars,
indent_level = #chars + (not show_first_level and 1 or 0), indent_level = #chars + (not show_first_level and 1 or 0),
},
} }
return M

View file

@ -1,4 +1,11 @@
local config = function() local M = { 'neovim/nvim-lspconfig' }
M.dependencies = {
'williamboman/mason.nvim',
'williamboman/mason-lspconfig.nvim',
}
M.config = function()
-- Enable rounded borders for LSP handlers and :LspInfo windows. -- Enable rounded borders for LSP handlers and :LspInfo windows.
local border = 'rounded' local border = 'rounded'
for request, handler in pairs { for request, handler in pairs {
@ -86,13 +93,5 @@ local config = function()
} }
end end
return { return M
'neovim/nvim-lspconfig',
config = config,
dependencies = {
'williamboman/mason.nvim',
'williamboman/mason-lspconfig.nvim',
},
}

View file

@ -1,9 +1,9 @@
local orange = '#d65d0e' local orange = '#d65d0e'
local bright = '#ffffff' -- alternative: '#f9f5d7' local bright = '#ffffff' -- alternative: '#f9f5d7'
return { local M = { 'nvim-lualine/lualine.nvim' }
'nvim-lualine/lualine.nvim',
config = function() M.config = function()
local window = require 'fschauen.window' local window = require 'fschauen.window'
local colored_if_focused = require('fschauen.lualine').colored_if_focused local colored_if_focused = require('fschauen.lualine').colored_if_focused
@ -102,5 +102,6 @@ return {
}, },
} }
end end
}
return M

View file

@ -1,10 +1,14 @@
return { local M = { 'iamcco/markdown-preview.nvim' }
'iamcco/markdown-preview.nvim',
build = 'cd app && npm install', M.build = 'cd app && npm install'
init = function(_)
M.init = function(_)
vim.g.mkdp_theme = 'dark' vim.g.mkdp_theme = 'dark'
end, end
event = {
M.event = {
'FileType markdown', 'FileType markdown',
},
} }
return M

View file

@ -1,7 +1,8 @@
return { local M = { 'NeogitOrg/neogit' }
'NeogitOrg/neogit',
keys = require('fschauen.keymap').neogit, M.keys = require('fschauen.keymap').neogit
opts = {
M.opts = {
disable_hint = true, disable_hint = true,
signs = { signs = {
section = { '', '' }, section = { '', '' },
@ -14,5 +15,7 @@ return {
['<space>'] = 'Toggle', ['<space>'] = 'Toggle',
}, },
}, },
},
} }
return M

View file

@ -1,5 +1,6 @@
return { local M = { 'chr4/nginx.vim' }
'chr4/nginx.vim',
ft = 'nginx', M.ft = 'nginx'
}
return M

View file

@ -1,10 +1,12 @@
return { local M = { 'nvim-tree/nvim-tree.lua' }
'nvim-tree/nvim-tree.lua',
dependencies = { M.dependencies = {
'nvim-tree/nvim-web-devicons' 'nvim-tree/nvim-web-devicons'
}, }
keys = require('fschauen.keymap').nvim_tree,
opts = { M.keys = require('fschauen.keymap').nvim_tree
M.opts = {
disable_netrw = true, -- replace netrw with nvim-tree disable_netrw = true, -- replace netrw with nvim-tree
hijack_cursor = true, -- keep the cursor on begin of the filename hijack_cursor = true, -- keep the cursor on begin of the filename
sync_root_with_cwd = true, -- watch for `DirChanged` and refresh the tree sync_root_with_cwd = true, -- watch for `DirChanged` and refresh the tree
@ -65,6 +67,7 @@ return {
}, },
}, },
}, },
},
} }
return M

View file

@ -1,5 +1,6 @@
return { local M = { 'keith/swift.vim' }
'keith/swift.vim',
ft = 'swift', M.ft = 'swift'
}
return M

View file

@ -1,16 +1,18 @@
return { local M = { 'godlygeek/tabular' }
'godlygeek/tabular',
cmd ={ M.cmd ={
'AddTabularPattern', 'AddTabularPattern',
'AddTabularPipeline', 'AddTabularPipeline',
'Tabularize', 'Tabularize',
}, }
config = function()
M.config = function()
if vim.fn.exists('g:tabular_loaded') == 1 then if vim.fn.exists('g:tabular_loaded') == 1 then
vim.cmd [[ AddTabularPattern! first_comma /^[^,]*\zs,/ ]] vim.cmd [[ AddTabularPattern! first_comma /^[^,]*\zs,/ ]]
vim.cmd [[ AddTabularPattern! first_colon /^[^:]*\zs:/ ]] vim.cmd [[ AddTabularPattern! first_colon /^[^:]*\zs:/ ]]
vim.cmd [[ AddTabularPattern! first_equal /^[^=]*\zs=/ ]] vim.cmd [[ AddTabularPattern! first_equal /^[^=]*\zs=/ ]]
end end
end, end
}
return M

View file

@ -0,0 +1,14 @@
local M = { 'nvim-telescope/telescope-file-browser.nvim' }
M.dependencies = {
'nvim-telescope/telescope.nvim',
}
M.keys = require('fschauen.keymap').telescope_file_browser
M.config = function()
require('telescope').load_extension 'file_browser'
end
return M

View file

@ -1,15 +1,17 @@
return { local M = { 'nvim-telescope/telescope.nvim' }
{
'nvim-telescope/telescope.nvim', M.dependencies = {
dependencies = {
'nvim-telescope/telescope-fzf-native.nvim', 'nvim-telescope/telescope-fzf-native.nvim',
build = 'cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release ' .. build = 'cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release ' ..
'&& cmake --build build --config Release ' .. '&& cmake --build build --config Release ' ..
'&& cmake --install build --prefix build', '&& cmake --install build --prefix build',
}, }
cmd = 'Telescope',
keys = require('fschauen.keymap').telescope, M.cmd = 'Telescope'
opts = function()
M.keys = require('fschauen.keymap').telescope
M.opts = function()
local actions = require('telescope.actions') local actions = require('telescope.actions')
local layout = require('telescope.actions.layout') local layout = require('telescope.actions.layout')
local trouble = vim.F.npcall(require, 'trouble.providers.telescope') or {} local trouble = vim.F.npcall(require, 'trouble.providers.telescope') or {}
@ -73,8 +75,9 @@ return {
}, },
}, },
} }
end, end
config = function(_, opts)
M.config = function(_, opts)
require('telescope').setup(opts) require('telescope').setup(opts)
require('telescope').load_extension 'fzf' require('telescope').load_extension 'fzf'
@ -85,16 +88,6 @@ return {
command = 'setlocal number' command = 'setlocal number'
}) })
end end
},
{ return M
'nvim-telescope/telescope-file-browser.nvim',
dependencies = {
'nvim-telescope/telescope.nvim',
},
keys = require('fschauen.keymap').telescope_file_browser,
config = function()
require('telescope').load_extension 'file_browser'
end,
},
}

View file

@ -1,14 +1,17 @@
return { local M = { 'folke/todo-comments.nvim' }
'folke/todo-comments.nvim',
dependencies = { M.dependencies = {
'nvim-lua/plenary.nvim' 'nvim-lua/plenary.nvim'
}, }
keys = require('fschauen.keymap').todo_comments,
event = { M.keys = require('fschauen.keymap').todo_comments
M.event = {
'BufReadPost', 'BufReadPost',
'BufNewFile' 'BufNewFile'
}, }
opts = {
M.opts = {
keywords = { keywords = {
TODO = { icon = '󰄬 ' }, TODO = { icon = '󰄬 ' },
FIX = { icon = '' }, FIX = { icon = '' },
@ -18,6 +21,7 @@ return {
NOTE = { icon = '' }, NOTE = { icon = '' },
TEST = { icon = '󰙨 ' }, TEST = { icon = '󰙨 ' },
}, },
},
} }
return M

View file

@ -1,16 +1,19 @@
return { local M = { 'nvim-treesitter/nvim-treesitter' }
'nvim-treesitter/nvim-treesitter',
dependencies = { M.dependencies = {
'nvim-treesitter/nvim-treesitter-refactor', 'nvim-treesitter/nvim-treesitter-refactor',
'nvim-treesitter/nvim-treesitter-textobjects', 'nvim-treesitter/nvim-treesitter-textobjects',
'nvim-treesitter/playground', 'nvim-treesitter/playground',
}, }
keys = require('fschauen.keymap').treesitter,
event = { M.keys = require('fschauen.keymap').treesitter
M.event = {
'BufReadPost', 'BufReadPost',
'BufNewFile' 'BufNewFile'
}, }
cmd = {
M.cmd = {
'TSInstall', 'TSInstall',
'TSUninstall', 'TSUninstall',
'TSUpdate', 'TSUpdate',
@ -18,9 +21,11 @@ return {
'TSInstallInfo', 'TSInstallInfo',
'TSInstallSync', 'TSInstallSync',
'TSInstallFromGrammar', 'TSInstallFromGrammar',
}, }
main = 'nvim-treesitter.configs',
opts = { M.main = 'nvim-treesitter.configs'
M.opts = {
ensure_installed = { ensure_installed = {
'bash', 'bash',
'c', 'c',
@ -95,6 +100,7 @@ return {
playground = { playground = {
enable = true, enable = true,
}, },
},
} }
return M

View file

@ -1,11 +1,15 @@
return { local M = { 'folke/trouble.nvim' }
'folke/trouble.nvim',
dependencies = { M.dependencies = {
'nvim-tree/nvim-web-devicons' 'nvim-tree/nvim-web-devicons'
}, }
keys = require('fschauen.keymap').trouble,
opts = { M.keys = require('fschauen.keymap').trouble
M.opts = {
padding = false, -- don't add an extra new line of top of the list padding = false, -- don't add an extra new line of top of the list
auto_preview = false, -- don't preview automatically auto_preview = false, -- don't preview automatically
},
} }
return M

View file

@ -1,6 +1,6 @@
return { local M = { 'mbbill/undotree' }
'mbbill/undotree',
init = function() M.init = function()
vim.g.undotree_WindowLayout = 2 -- tree: left, diff: bottom vim.g.undotree_WindowLayout = 2 -- tree: left, diff: bottom
vim.g.undotree_DiffAutoOpen = 0 -- don't open diff by default vim.g.undotree_DiffAutoOpen = 0 -- don't open diff by default
vim.g.undotree_SetFocusWhenToggle = 1 vim.g.undotree_SetFocusWhenToggle = 1
@ -8,8 +8,11 @@ return {
vim.g.undotree_TreeVertShape = '' vim.g.undotree_TreeVertShape = ''
vim.g.undotree_TreeSplitShape = '' vim.g.undotree_TreeSplitShape = ''
vim.g.undotree_TreeReturnShape = '' vim.g.undotree_TreeReturnShape = ''
end, end
keys = require('fschauen.keymap').undotree,
config = false, M.keys = require('fschauen.keymap').undotree
}
M.config = false
return M

View file

@ -1,12 +1,15 @@
return { local M = { 'lukas-reineke/virt-column.nvim' }
'lukas-reineke/virt-column.nvim',
event = { M.event = {
'BufReadPost', 'BufReadPost',
'BufNewFile' 'BufNewFile'
},
keys = require('fschauen.keymap').virt_column,
opts = {
char = '',
},
} }
M.keys = require('fschauen.keymap').virt_column
M.opts = {
char = '',
}
return M

View file

@ -1,19 +0,0 @@
return {
'mg979/vim-visual-multi',
init = function()
vim.g.VM_leader = '\\'
vim.g.VM_silent_exit = 1
end,
}
-- Component for lualine:
-- function()
-- local info = vim.F.npcall(vim.fn.VMInfos)
-- if info and info.status then
-- return info.current .. '/' .. info.total .. ' ' .. info.status
-- else
-- return ''
-- end
-- end,

View file

@ -1,6 +1,6 @@
return { local M = { 'ntpeters/vim-better-whitespace' }
'ntpeters/vim-better-whitespace',
init = function() M.init = function()
vim.g.better_whitespace_filetypes_blacklist = { vim.g.better_whitespace_filetypes_blacklist = {
'diff', 'diff',
'fugitive', 'fugitive',
@ -8,12 +8,16 @@ return {
'gitcommit', 'gitcommit',
'help', 'help',
} }
end, end
keys = require('fschauen.keymap').whitespace,
event = { M.keys = require('fschauen.keymap').whitespace
M.event = {
'BufReadPost', 'BufReadPost',
'BufNewFile' 'BufNewFile'
},
config = false,
} }
M.config = false
return M