diff --git a/config/nvim/lua/fschauen/plugins/colorizer.lua b/config/nvim/lua/fschauen/plugins/colorizer.lua index d935efb..fb24f08 100644 --- a/config/nvim/lua/fschauen/plugins/colorizer.lua +++ b/config/nvim/lua/fschauen/plugins/colorizer.lua @@ -1,14 +1,16 @@ -return { - 'norcalli/nvim-colorizer.lua', - cond = vim.opt.termguicolors:get(), - event = { - 'BufReadPost', - 'BufNewFile' - }, - config = function() - require('colorizer').setup(nil, { - css = true, - }) - end, +local M = { 'norcalli/nvim-colorizer.lua' } + +M.cond = vim.opt.termguicolors:get() + +M.event = { + 'BufReadPost', + 'BufNewFile' } +M.config = function() + require('colorizer').setup(nil, { + css = true, + }) +end + +return M diff --git a/config/nvim/lua/fschauen/plugins/colorscheme.lua b/config/nvim/lua/fschauen/plugins/colorscheme.lua index ac61210..70055f0 100644 --- a/config/nvim/lua/fschauen/plugins/colorscheme.lua +++ b/config/nvim/lua/fschauen/plugins/colorscheme.lua @@ -1,5 +1,8 @@ +local gruvbox = { 'fschauen/gruvbox.nvim', dev = true, lazy = true } +local solarized = { 'fschauen/solarized.nvim', dev = true, lazy =true } + return { - { 'fschauen/solarized.nvim', dev = true, lazy =true }, - { 'fschauen/gruvbox.nvim', dev = true, lazy = true }, + gruvbox, + solarized, } diff --git a/config/nvim/lua/fschauen/plugins/comment.lua b/config/nvim/lua/fschauen/plugins/comment.lua index fca1a08..a05ae6f 100644 --- a/config/nvim/lua/fschauen/plugins/comment.lua +++ b/config/nvim/lua/fschauen/plugins/comment.lua @@ -1,9 +1,12 @@ -return { - 'tpope/vim-commentary', - cmd = 'Commentary', - keys = { - { 'gc', 'Commentary', mode = { 'n', 'x', 'o' }, desc = 'Comment in/out' }, - { 'gcc', 'CommentaryLine', desc = 'Comment in/out line' }, - { 'gcu', 'CommentaryCommentary', desc = 'Undo comment in/out' }, - }, +local M = { 'tpope/vim-commentary' } + +M.cmd = 'Commentary' + +M.keys = { + { 'gc', 'Commentary', mode = { 'n', 'x', 'o' }, desc = 'Comment in/out' }, + { 'gcc', 'CommentaryLine', desc = 'Comment in/out line' }, + { 'gcu', 'CommentaryCommentary', desc = 'Undo comment in/out' }, } + +return M + diff --git a/config/nvim/lua/fschauen/plugins/completion.lua b/config/nvim/lua/fschauen/plugins/completion.lua index 65e244b..7a625d4 100644 --- a/config/nvim/lua/fschauen/plugins/completion.lua +++ b/config/nvim/lua/fschauen/plugins/completion.lua @@ -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 tbl = {} for _, k in ipairs(keys) do tbl[k] = value end @@ -20,7 +34,7 @@ local cond = function(condition, yes, no) end end -local config = function() +M.config = function() local cmp = require 'cmp' local map = cmp.mapping @@ -154,21 +168,5 @@ local config = function() cmp.setup.filetype('TelescopePrompt', { enabled = false }) end -return { - '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', - }, -} +return M diff --git a/config/nvim/lua/fschauen/plugins/fugitive.lua b/config/nvim/lua/fschauen/plugins/fugitive.lua index 6612acc..8dd0b56 100644 --- a/config/nvim/lua/fschauen/plugins/fugitive.lua +++ b/config/nvim/lua/fschauen/plugins/fugitive.lua @@ -1,9 +1,11 @@ -return { - 'tpope/vim-fugitive', - cmd = { - 'G', - 'Git', - }, - keys = require('fschauen.keymap').fugitive +local M = { 'tpope/vim-fugitive' } + +M.cmd = { + 'G', + 'Git', } +M.keys = require('fschauen.keymap').fugitive + +return M + diff --git a/config/nvim/lua/fschauen/plugins/indent-blankline.lua b/config/nvim/lua/fschauen/plugins/indent-blankline.lua index 72d3c39..4382f6a 100644 --- a/config/nvim/lua/fschauen/plugins/indent-blankline.lua +++ b/config/nvim/lua/fschauen/plugins/indent-blankline.lua @@ -1,19 +1,21 @@ +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 show_first_level = false -return { - 'lukas-reineke/indent-blankline.nvim', - keys = require('fschauen.keymap').indent_blankline, - lazy = false, -- trows an error when lazy loading - opts = { - enabled = false, - use_treesitter = true, - show_first_indent_level = show_first_level, - show_current_context = true, - show_trailing_blankline_indent = false, - char_list = chars, - context_char_list = chars, - indent_level = #chars + (not show_first_level and 1 or 0), - }, +M.opts = { + enabled = false, + use_treesitter = true, + show_first_indent_level = show_first_level, + show_current_context = true, + show_trailing_blankline_indent = false, + char_list = chars, + context_char_list = chars, + indent_level = #chars + (not show_first_level and 1 or 0), } +return M diff --git a/config/nvim/lua/fschauen/plugins/lsp.lua b/config/nvim/lua/fschauen/plugins/lsp.lua index 2b0eb5f..47cf642 100644 --- a/config/nvim/lua/fschauen/plugins/lsp.lua +++ b/config/nvim/lua/fschauen/plugins/lsp.lua @@ -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. local border = 'rounded' for request, handler in pairs { @@ -86,13 +93,5 @@ local config = function() } end -return { - 'neovim/nvim-lspconfig', - - config = config, - dependencies = { - 'williamboman/mason.nvim', - 'williamboman/mason-lspconfig.nvim', - }, -} +return M diff --git a/config/nvim/lua/fschauen/plugins/lualine.lua b/config/nvim/lua/fschauen/plugins/lualine.lua index f320ac6..ea8429c 100644 --- a/config/nvim/lua/fschauen/plugins/lualine.lua +++ b/config/nvim/lua/fschauen/plugins/lualine.lua @@ -1,106 +1,107 @@ local orange = '#d65d0e' local bright = '#ffffff' -- alternative: '#f9f5d7' -return { - 'nvim-lualine/lualine.nvim', - config = function() - local window = require 'fschauen.window' - local colored_if_focused = require('fschauen.lualine').colored_if_focused +local M = { 'nvim-lualine/lualine.nvim' } - -- custom components - local C = { - diagnostics = { - colored_if_focused('diagnostics'), - }, - diff = { - colored_if_focused('diff'), - symbols = { - added = '', - modified = '', - removed = '', - }, - }, - branch = { - 'branch', - icon = '󰘬', - cond = window.is_medium, - }, - fileformat = { - 'fileformat', - cond = window.is_medium, - }, - filename = { - require('fschauen.lualine').filename, - padding = { - left = 1, - right = 0, - }, - }, - filetype = { - colored_if_focused('filetype'), - cond = window.is_medium, - }, - mode = require('fschauen.lualine').mode, - paste = { - colored_if_focused(function(has_focus) return has_focus and '' or ' ' end), - color = { - bg = orange, - }, - cond = function() return vim.o.paste end - }, - searchcount = require('fschauen.lualine').searchcount, - status = { - colored_if_focused(function(_) - local status = '' - if vim.bo.modified then status = status .. '' end - if vim.bo.readonly or not vim.bo.modifiable then status = status .. 'RO' end - return status - end), - color = { - fg = bright, - }, - }, - trailing_whitespace = { - colored_if_focused(require('fschauen.lualine').trailing_whitespace), - color = { - bg = orange, - }, - } - } +M.config = function() + local window = require 'fschauen.window' + local colored_if_focused = require('fschauen.lualine').colored_if_focused - local sections = { - lualine_a = { C.paste, C.mode }, - lualine_b = { C.branch }, - lualine_c = { C.filename, C.status }, - lualine_x = { C.diagnostics, C.searchcount, C.filetype }, - lualine_y = { C.fileformat, 'progress' }, - lualine_z = { 'location', C.trailing_whitespace }, - } - - require('lualine').setup { - options = { - icons_enabled = true, - component_separators = { - left = '', - right = '' - }, - section_separators = { - left = '', - right = '' - }, - theme = 'gruvbox', + -- custom components + local C = { + diagnostics = { + colored_if_focused('diagnostics'), + }, + diff = { + colored_if_focused('diff'), + symbols = { + added = '', + modified = '', + removed = '', }, - sections = sections, - inactive_sections = sections, - extensions = { - 'fugitive', - 'quickfix', - 'nvim-tree', - 'lazy', - 'man', - 'trouble', + }, + branch = { + 'branch', + icon = '󰘬', + cond = window.is_medium, + }, + fileformat = { + 'fileformat', + cond = window.is_medium, + }, + filename = { + require('fschauen.lualine').filename, + padding = { + left = 1, + right = 0, + }, + }, + filetype = { + colored_if_focused('filetype'), + cond = window.is_medium, + }, + mode = require('fschauen.lualine').mode, + paste = { + colored_if_focused(function(has_focus) return has_focus and '' or ' ' end), + color = { + bg = orange, + }, + cond = function() return vim.o.paste end + }, + searchcount = require('fschauen.lualine').searchcount, + status = { + colored_if_focused(function(_) + local status = '' + if vim.bo.modified then status = status .. '' end + if vim.bo.readonly or not vim.bo.modifiable then status = status .. 'RO' end + return status + end), + color = { + fg = bright, + }, + }, + trailing_whitespace = { + colored_if_focused(require('fschauen.lualine').trailing_whitespace), + color = { + bg = orange, }, } - end -} + } + + local sections = { + lualine_a = { C.paste, C.mode }, + lualine_b = { C.branch }, + lualine_c = { C.filename, C.status }, + lualine_x = { C.diagnostics, C.searchcount, C.filetype }, + lualine_y = { C.fileformat, 'progress' }, + lualine_z = { 'location', C.trailing_whitespace }, + } + + require('lualine').setup { + options = { + icons_enabled = true, + component_separators = { + left = '', + right = '' + }, + section_separators = { + left = '', + right = '' + }, + theme = 'gruvbox', + }, + sections = sections, + inactive_sections = sections, + extensions = { + 'fugitive', + 'quickfix', + 'nvim-tree', + 'lazy', + 'man', + 'trouble', + }, + } +end + +return M diff --git a/config/nvim/lua/fschauen/plugins/markdown-preview.lua b/config/nvim/lua/fschauen/plugins/markdown-preview.lua index d469988..802a2dc 100644 --- a/config/nvim/lua/fschauen/plugins/markdown-preview.lua +++ b/config/nvim/lua/fschauen/plugins/markdown-preview.lua @@ -1,10 +1,14 @@ -return { - 'iamcco/markdown-preview.nvim', - build = 'cd app && npm install', - init = function(_) - vim.g.mkdp_theme = 'dark' - end, - event = { - 'FileType markdown', - }, +local M = { 'iamcco/markdown-preview.nvim' } + +M.build = 'cd app && npm install' + +M.init = function(_) + vim.g.mkdp_theme = 'dark' +end + +M.event = { + 'FileType markdown', } + +return M + diff --git a/config/nvim/lua/fschauen/plugins/neogit.lua b/config/nvim/lua/fschauen/plugins/neogit.lua index d7e38b4..cb4e0dd 100644 --- a/config/nvim/lua/fschauen/plugins/neogit.lua +++ b/config/nvim/lua/fschauen/plugins/neogit.lua @@ -1,18 +1,21 @@ -return { - 'NeogitOrg/neogit', - keys = require('fschauen.keymap').neogit, - opts = { - disable_hint = true, - signs = { - section = { '', '' }, - item = { '', '' }, - hunk = { '', '' }, - }, - mappings = { - status = { - o = 'GoToFile', - [''] = 'Toggle', - }, +local M = { 'NeogitOrg/neogit' } + +M.keys = require('fschauen.keymap').neogit + +M.opts = { + disable_hint = true, + signs = { + section = { '', '' }, + item = { '', '' }, + hunk = { '', '' }, + }, + mappings = { + status = { + o = 'GoToFile', + [''] = 'Toggle', }, }, } + +return M + diff --git a/config/nvim/lua/fschauen/plugins/nginx.lua b/config/nvim/lua/fschauen/plugins/nginx.lua index 943c9c6..63e561a 100644 --- a/config/nvim/lua/fschauen/plugins/nginx.lua +++ b/config/nvim/lua/fschauen/plugins/nginx.lua @@ -1,5 +1,6 @@ -return { - 'chr4/nginx.vim', - ft = 'nginx', -} +local M = { 'chr4/nginx.vim' } + +M.ft = 'nginx' + +return M diff --git a/config/nvim/lua/fschauen/plugins/nvim-tree.lua b/config/nvim/lua/fschauen/plugins/nvim-tree.lua index aed77c8..e3ca327 100644 --- a/config/nvim/lua/fschauen/plugins/nvim-tree.lua +++ b/config/nvim/lua/fschauen/plugins/nvim-tree.lua @@ -1,70 +1,73 @@ -return { - 'nvim-tree/nvim-tree.lua', - dependencies = { - 'nvim-tree/nvim-web-devicons' +local M = { 'nvim-tree/nvim-tree.lua' } + +M.dependencies = { + 'nvim-tree/nvim-web-devicons' +} + +M.keys = require('fschauen.keymap').nvim_tree + +M.opts = { + disable_netrw = true, -- replace netrw with nvim-tree + hijack_cursor = true, -- keep the cursor on begin of the filename + sync_root_with_cwd = true, -- watch for `DirChanged` and refresh the tree + + on_attach = function(bufnr) + local api = require('nvim-tree.api') + api.config.mappings.default_on_attach(bufnr) + + local opts = function(desc) + return { desc = 'nvim-tree: ' .. desc, buffer = bufnr, silent = true } + end + + vim.keymap.set('n', 'l', api.node.open.edit, opts('open')) + vim.keymap.set('n', '', api.node.open.edit, opts('open')) + vim.keymap.set('n', 'o', api.node.open.edit, opts('open')) + vim.keymap.set('n', 'h', api.node.navigate.parent_close, opts('close directory')) + end, + + git = { + ignore = false, -- don't hide files from .gitignore }, - keys = require('fschauen.keymap').nvim_tree, - opts = { - disable_netrw = true, -- replace netrw with nvim-tree - hijack_cursor = true, -- keep the cursor on begin of the filename - sync_root_with_cwd = true, -- watch for `DirChanged` and refresh the tree - - on_attach = function(bufnr) - local api = require('nvim-tree.api') - api.config.mappings.default_on_attach(bufnr) - - local opts = function(desc) - return { desc = 'nvim-tree: ' .. desc, buffer = bufnr, silent = true } - end - - vim.keymap.set('n', 'l', api.node.open.edit, opts('open')) - vim.keymap.set('n', '', api.node.open.edit, opts('open')) - vim.keymap.set('n', 'o', api.node.open.edit, opts('open')) - vim.keymap.set('n', 'h', api.node.navigate.parent_close, opts('close directory')) - end, - - git = { - ignore = false, -- don't hide files from .gitignore - }, - view = { - adaptive_size = true, -- resize the window based on the longest line - width = 35, -- a little wider than the default 30 - }, - filters = { - dotfiles = false, -- show files starting with a . - custom = { '^\\.git' }, -- don't show .git directory - }, - renderer = { - add_trailing = true, -- add trailing / to folders - highlight_git = true, -- enable highlight based on git attributes - icons = { - git_placement = 'after', - glyphs = { - default = '', - symlink = '', - modified = '●', - folder = { - arrow_closed = '', --    - arrow_open = '', --    - default = '', --   - open = '', --   - empty = '', - empty_open = '', - symlink = '', - symlink_open = '', - }, - git = { - untracked = '?', -- ★ - unstaged = '✶', -- ✗ - staged = '', -- ✓ - deleted = '', - unmerged = '', - renamed = '➜', - ignored = '◌', - }, + view = { + adaptive_size = true, -- resize the window based on the longest line + width = 35, -- a little wider than the default 30 + }, + filters = { + dotfiles = false, -- show files starting with a . + custom = { '^\\.git' }, -- don't show .git directory + }, + renderer = { + add_trailing = true, -- add trailing / to folders + highlight_git = true, -- enable highlight based on git attributes + icons = { + git_placement = 'after', + glyphs = { + default = '', + symlink = '', + modified = '●', + folder = { + arrow_closed = '', --    + arrow_open = '', --    + default = '', --   + open = '', --   + empty = '', + empty_open = '', + symlink = '', + symlink_open = '', + }, + git = { + untracked = '?', -- ★ + unstaged = '✶', -- ✗ + staged = '', -- ✓ + deleted = '', + unmerged = '', + renamed = '➜', + ignored = '◌', }, }, }, }, } +return M + diff --git a/config/nvim/lua/fschauen/plugins/swift.lua b/config/nvim/lua/fschauen/plugins/swift.lua index f3a2251..5feb714 100644 --- a/config/nvim/lua/fschauen/plugins/swift.lua +++ b/config/nvim/lua/fschauen/plugins/swift.lua @@ -1,5 +1,6 @@ - return { - 'keith/swift.vim', - ft = 'swift', - } +local M = { 'keith/swift.vim' } + +M.ft = 'swift' + +return M diff --git a/config/nvim/lua/fschauen/plugins/tabular.lua b/config/nvim/lua/fschauen/plugins/tabular.lua index fa09cce..f798f4e 100644 --- a/config/nvim/lua/fschauen/plugins/tabular.lua +++ b/config/nvim/lua/fschauen/plugins/tabular.lua @@ -1,16 +1,18 @@ -return { - 'godlygeek/tabular', - cmd ={ - 'AddTabularPattern', - 'AddTabularPipeline', - 'Tabularize', - }, - config = function() - if vim.fn.exists('g:tabular_loaded') == 1 then - vim.cmd [[ AddTabularPattern! first_comma /^[^,]*\zs,/ ]] - vim.cmd [[ AddTabularPattern! first_colon /^[^:]*\zs:/ ]] - vim.cmd [[ AddTabularPattern! first_equal /^[^=]*\zs=/ ]] - end - end, +local M = { 'godlygeek/tabular' } + +M.cmd ={ + 'AddTabularPattern', + 'AddTabularPipeline', + 'Tabularize', } +M.config = function() + if vim.fn.exists('g:tabular_loaded') == 1 then + vim.cmd [[ AddTabularPattern! first_comma /^[^,]*\zs,/ ]] + vim.cmd [[ AddTabularPattern! first_colon /^[^:]*\zs:/ ]] + vim.cmd [[ AddTabularPattern! first_equal /^[^=]*\zs=/ ]] + end +end + +return M + diff --git a/config/nvim/lua/fschauen/plugins/telescope-file-browser.lua b/config/nvim/lua/fschauen/plugins/telescope-file-browser.lua new file mode 100644 index 0000000..0996aa7 --- /dev/null +++ b/config/nvim/lua/fschauen/plugins/telescope-file-browser.lua @@ -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 + diff --git a/config/nvim/lua/fschauen/plugins/telescope.lua b/config/nvim/lua/fschauen/plugins/telescope.lua index 573b16a..58454fa 100644 --- a/config/nvim/lua/fschauen/plugins/telescope.lua +++ b/config/nvim/lua/fschauen/plugins/telescope.lua @@ -1,100 +1,93 @@ -return { - { - 'nvim-telescope/telescope.nvim', - dependencies = { - 'nvim-telescope/telescope-fzf-native.nvim', - build = 'cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release ' .. - '&& cmake --build build --config Release ' .. - '&& cmake --install build --prefix build', - }, - cmd = 'Telescope', - keys = require('fschauen.keymap').telescope, - opts = function() - local actions = require('telescope.actions') - local layout = require('telescope.actions.layout') - local trouble = vim.F.npcall(require, 'trouble.providers.telescope') or {} +local M = { 'nvim-telescope/telescope.nvim' } - local mappings = { - [''] = actions.cycle_history_next, - [''] = actions.cycle_history_prev, - [''] = actions.preview_scrolling_down, - [''] = actions.preview_scrolling_up, - [''] = layout.cycle_layout_next, - [''] = layout.toggle_mirror, - [''] = actions.close, - [''] = actions.smart_send_to_qflist + actions.open_qflist, - [''] = actions.smart_send_to_loclist + actions.open_loclist, - [''] = trouble.smart_open_with_trouble, - } - - return { - defaults = { - mappings = { - i = mappings, - n = mappings, - }, - - prompt_prefix = '  ', -- Alternatives:  ❯ - selection_caret = ' ', -- Alternatives:  ➔  - - multi_icon = '󰄬 ', -- Alternatives: 󰄬   - scroll_strategy = 'limit', -- Don't wrap around in results. - - dynamic_preview_title = true, - - layout_strategy = 'flex', - layout_config = { - width = 0.9, - height = 0.9, - flex = { flip_columns = 130 }, - horizontal = { preview_width = 0.5, preview_cutoff = 130 }, - vertical = { preview_height = 0.5 }, - }, - cycle_layout_list = { 'horizontal', 'vertical' }, - }, - pickers = { - buffers = { - mappings = { - n = { - x = actions.delete_buffer, - }, - }, - }, - colorscheme = { - theme = 'dropdown', - }, - spell_suggest = { - theme = 'cursor', - }, - }, - extensions = { - file_browser = { - theme = 'ivy' - }, - }, - } - end, - config = function(_, opts) - require('telescope').setup(opts) - require('telescope').load_extension 'fzf' - - vim.api.nvim_create_autocmd('User', { - desc = 'Enable line number in Telescope previewers.', - group = vim.api.nvim_create_augroup('fschauen.telescope', { clear = true } ), - pattern = 'TelescopePreviewerLoaded', - command = 'setlocal number' - }) - end - }, - { - '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, - }, +M.dependencies = { + 'nvim-telescope/telescope-fzf-native.nvim', + build = 'cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release ' .. + '&& cmake --build build --config Release ' .. + '&& cmake --install build --prefix build', } +M.cmd = 'Telescope' + +M.keys = require('fschauen.keymap').telescope + +M.opts = function() + local actions = require('telescope.actions') + local layout = require('telescope.actions.layout') + local trouble = vim.F.npcall(require, 'trouble.providers.telescope') or {} + + local mappings = { + [''] = actions.cycle_history_next, + [''] = actions.cycle_history_prev, + [''] = actions.preview_scrolling_down, + [''] = actions.preview_scrolling_up, + [''] = layout.cycle_layout_next, + [''] = layout.toggle_mirror, + [''] = actions.close, + [''] = actions.smart_send_to_qflist + actions.open_qflist, + [''] = actions.smart_send_to_loclist + actions.open_loclist, + [''] = trouble.smart_open_with_trouble, + } + + return { + defaults = { + mappings = { + i = mappings, + n = mappings, + }, + + prompt_prefix = '  ', -- Alternatives:  ❯ + selection_caret = ' ', -- Alternatives:  ➔  + + multi_icon = '󰄬 ', -- Alternatives: 󰄬   + scroll_strategy = 'limit', -- Don't wrap around in results. + + dynamic_preview_title = true, + + layout_strategy = 'flex', + layout_config = { + width = 0.9, + height = 0.9, + flex = { flip_columns = 130 }, + horizontal = { preview_width = 0.5, preview_cutoff = 130 }, + vertical = { preview_height = 0.5 }, + }, + cycle_layout_list = { 'horizontal', 'vertical' }, + }, + pickers = { + buffers = { + mappings = { + n = { + x = actions.delete_buffer, + }, + }, + }, + colorscheme = { + theme = 'dropdown', + }, + spell_suggest = { + theme = 'cursor', + }, + }, + extensions = { + file_browser = { + theme = 'ivy' + }, + }, + } +end + +M.config = function(_, opts) + require('telescope').setup(opts) + require('telescope').load_extension 'fzf' + + vim.api.nvim_create_autocmd('User', { + desc = 'Enable line number in Telescope previewers.', + group = vim.api.nvim_create_augroup('fschauen.telescope', { clear = true } ), + pattern = 'TelescopePreviewerLoaded', + command = 'setlocal number' + }) +end + +return M + diff --git a/config/nvim/lua/fschauen/plugins/todo-comments.lua b/config/nvim/lua/fschauen/plugins/todo-comments.lua index eafccbd..fc84c31 100644 --- a/config/nvim/lua/fschauen/plugins/todo-comments.lua +++ b/config/nvim/lua/fschauen/plugins/todo-comments.lua @@ -1,23 +1,27 @@ -return { - 'folke/todo-comments.nvim', - dependencies = { - 'nvim-lua/plenary.nvim' - }, - keys = require('fschauen.keymap').todo_comments, - event = { - 'BufReadPost', - 'BufNewFile' - }, - opts = { - keywords = { - TODO = { icon = '󰄬 ' }, - FIX = { icon = ' ' }, - HACK = { icon = ' ' }, - WARN = { icon = ' ' }, - PERF = { icon = '󰓅 ' }, - NOTE = { icon = '' }, - TEST = { icon = '󰙨 ' }, - }, +local M = { 'folke/todo-comments.nvim' } + +M.dependencies = { + 'nvim-lua/plenary.nvim' +} + +M.keys = require('fschauen.keymap').todo_comments + +M.event = { + 'BufReadPost', + 'BufNewFile' +} + +M.opts = { + keywords = { + TODO = { icon = '󰄬 ' }, + FIX = { icon = ' ' }, + HACK = { icon = ' ' }, + WARN = { icon = ' ' }, + PERF = { icon = '󰓅 ' }, + NOTE = { icon = '' }, + TEST = { icon = '󰙨 ' }, }, } +return M + diff --git a/config/nvim/lua/fschauen/plugins/treesitter.lua b/config/nvim/lua/fschauen/plugins/treesitter.lua index 46151b3..a909322 100644 --- a/config/nvim/lua/fschauen/plugins/treesitter.lua +++ b/config/nvim/lua/fschauen/plugins/treesitter.lua @@ -1,100 +1,106 @@ -return { - 'nvim-treesitter/nvim-treesitter', - dependencies = { - 'nvim-treesitter/nvim-treesitter-refactor', - 'nvim-treesitter/nvim-treesitter-textobjects', - 'nvim-treesitter/playground', +local M = { 'nvim-treesitter/nvim-treesitter' } + +M.dependencies = { + 'nvim-treesitter/nvim-treesitter-refactor', + 'nvim-treesitter/nvim-treesitter-textobjects', + 'nvim-treesitter/playground', +} + +M.keys = require('fschauen.keymap').treesitter + +M.event = { + 'BufReadPost', + 'BufNewFile' +} + +M.cmd = { + 'TSInstall', + 'TSUninstall', + 'TSUpdate', + 'TSUpdateSync', + 'TSInstallInfo', + 'TSInstallSync', + 'TSInstallFromGrammar', +} + +M.main = 'nvim-treesitter.configs' + +M.opts = { + ensure_installed = { + 'bash', + 'c', + 'cpp', + 'haskell', + 'html', + 'javascript', + 'latex', + 'lua', + 'make', + 'markdown', + 'markdown_inline', + 'python', + 'query', + 'toml', + 'vim', + 'vimdoc', + 'yaml', }, - keys = require('fschauen.keymap').treesitter, - event = { - 'BufReadPost', - 'BufNewFile' - }, - cmd = { - 'TSInstall', - 'TSUninstall', - 'TSUpdate', - 'TSUpdateSync', - 'TSInstallInfo', - 'TSInstallSync', - 'TSInstallFromGrammar', - }, - main = 'nvim-treesitter.configs', - opts = { - ensure_installed = { - 'bash', - 'c', - 'cpp', - 'haskell', - 'html', - 'javascript', - 'latex', - 'lua', - 'make', - 'markdown', - 'markdown_inline', - 'python', - 'query', - 'toml', - 'vim', + highlight = { + enable = true, + disable = { 'vimdoc', - 'yaml', }, - highlight = { - enable = true, - disable = { - 'vimdoc', - }, + }, + incremental_selection = { + enable = true, + keymaps = { + init_selection = 'gnn', -- mapped in normal mode + node_incremental = '', -- mapped in visual mode + node_decremental = '', -- mapped in visual mode + scope_incremental = nil, -- disabled, normally mapped in visual mode }, - incremental_selection = { + }, + refactor = { + highlight_definitions = { enable = true }, + highlight_current_scope = { enable = false }, + smart_rename = { enable = true, keymaps = { - init_selection = 'gnn', -- mapped in normal mode - node_incremental = '', -- mapped in visual mode - node_decremental = '', -- mapped in visual mode - scope_incremental = nil, -- disabled, normally mapped in visual mode + smart_rename = 'grr', }, }, - refactor = { - highlight_definitions = { enable = true }, - highlight_current_scope = { enable = false }, - smart_rename = { - enable = true, - keymaps = { - smart_rename = 'grr', - }, - }, - navigation = { - enable = true, - keymaps = { - goto_definition = 'gd', -- default: 'gnd' - list_definitions = nil, -- disabled, default: 'gnD' - list_definitions_toc = 'gO', - goto_next_usage = '', - goto_previous_usage = '', - }, - }, - }, - textobjects = { - select = { - enable = true, - keymaps = { - ['ab'] = '@block.outer', - ['ib'] = '@block.inner', - ['ac'] = '@conditional.outer', - ['ic'] = '@conditional.inner', - ['af'] = '@function.outer', - ['if'] = '@function.inner', - ['al'] = '@loop.outer', - ['il'] = '@loop.inner', - ['aa'] = '@parameter.outer', - ['ia'] = '@parameter.inner', - }, - }, - }, - playground = { + navigation = { enable = true, + keymaps = { + goto_definition = 'gd', -- default: 'gnd' + list_definitions = nil, -- disabled, default: 'gnD' + list_definitions_toc = 'gO', + goto_next_usage = '', + goto_previous_usage = '', + }, }, }, + textobjects = { + select = { + enable = true, + keymaps = { + ['ab'] = '@block.outer', + ['ib'] = '@block.inner', + ['ac'] = '@conditional.outer', + ['ic'] = '@conditional.inner', + ['af'] = '@function.outer', + ['if'] = '@function.inner', + ['al'] = '@loop.outer', + ['il'] = '@loop.inner', + ['aa'] = '@parameter.outer', + ['ia'] = '@parameter.inner', + }, + }, + }, + playground = { + enable = true, + }, } +return M + diff --git a/config/nvim/lua/fschauen/plugins/trouble.lua b/config/nvim/lua/fschauen/plugins/trouble.lua index ec2facf..129a1e2 100644 --- a/config/nvim/lua/fschauen/plugins/trouble.lua +++ b/config/nvim/lua/fschauen/plugins/trouble.lua @@ -1,11 +1,15 @@ -return { - 'folke/trouble.nvim', - dependencies = { - 'nvim-tree/nvim-web-devicons' - }, - keys = require('fschauen.keymap').trouble, - opts = { - padding = false, -- don't add an extra new line of top of the list - auto_preview = false, -- don't preview automatically - }, +local M = { 'folke/trouble.nvim' } + +M.dependencies = { + 'nvim-tree/nvim-web-devicons' } + +M.keys = require('fschauen.keymap').trouble + +M.opts = { + padding = false, -- don't add an extra new line of top of the list + auto_preview = false, -- don't preview automatically +} + +return M + diff --git a/config/nvim/lua/fschauen/plugins/undotree.lua b/config/nvim/lua/fschauen/plugins/undotree.lua index 3a1f3eb..f163f03 100644 --- a/config/nvim/lua/fschauen/plugins/undotree.lua +++ b/config/nvim/lua/fschauen/plugins/undotree.lua @@ -1,15 +1,18 @@ -return { - 'mbbill/undotree', - init = function() - vim.g.undotree_WindowLayout = 2 -- tree: left, diff: bottom - vim.g.undotree_DiffAutoOpen = 0 -- don't open diff by default - vim.g.undotree_SetFocusWhenToggle = 1 - vim.g.undotree_TreeNodeShape = '' - vim.g.undotree_TreeVertShape = '│' - vim.g.undotree_TreeSplitShape = '╱' - vim.g.undotree_TreeReturnShape = '╲' - end, - keys = require('fschauen.keymap').undotree, - config = false, -} +local M = { 'mbbill/undotree' } + +M.init = function() + vim.g.undotree_WindowLayout = 2 -- tree: left, diff: bottom + vim.g.undotree_DiffAutoOpen = 0 -- don't open diff by default + vim.g.undotree_SetFocusWhenToggle = 1 + vim.g.undotree_TreeNodeShape = '' + vim.g.undotree_TreeVertShape = '│' + vim.g.undotree_TreeSplitShape = '╱' + vim.g.undotree_TreeReturnShape = '╲' +end + +M.keys = require('fschauen.keymap').undotree + +M.config = false + +return M diff --git a/config/nvim/lua/fschauen/plugins/virt-column.lua b/config/nvim/lua/fschauen/plugins/virt-column.lua index c02e521..3c0829d 100644 --- a/config/nvim/lua/fschauen/plugins/virt-column.lua +++ b/config/nvim/lua/fschauen/plugins/virt-column.lua @@ -1,12 +1,15 @@ -return { - 'lukas-reineke/virt-column.nvim', - event = { - 'BufReadPost', - 'BufNewFile' - }, - keys = require('fschauen.keymap').virt_column, - opts = { - char = '│', - }, +local M = { 'lukas-reineke/virt-column.nvim' } + +M.event = { + 'BufReadPost', + 'BufNewFile' } +M.keys = require('fschauen.keymap').virt_column + +M.opts = { + char = '│', +} + +return M + diff --git a/config/nvim/lua/fschauen/plugins/visual-multi.lua.disabled b/config/nvim/lua/fschauen/plugins/visual-multi.lua.disabled deleted file mode 100644 index 2af7692..0000000 --- a/config/nvim/lua/fschauen/plugins/visual-multi.lua.disabled +++ /dev/null @@ -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, - diff --git a/config/nvim/lua/fschauen/plugins/whitespace.lua b/config/nvim/lua/fschauen/plugins/whitespace.lua index 4cabbec..0e2bb75 100644 --- a/config/nvim/lua/fschauen/plugins/whitespace.lua +++ b/config/nvim/lua/fschauen/plugins/whitespace.lua @@ -1,19 +1,23 @@ -return { - 'ntpeters/vim-better-whitespace', - init = function() - vim.g.better_whitespace_filetypes_blacklist = { - 'diff', - 'fugitive', - 'git', - 'gitcommit', - 'help', - } - end, - keys = require('fschauen.keymap').whitespace, - event = { - 'BufReadPost', - 'BufNewFile' - }, - config = false, +local M = { 'ntpeters/vim-better-whitespace' } + +M.init = function() + vim.g.better_whitespace_filetypes_blacklist = { + 'diff', + 'fugitive', + 'git', + 'gitcommit', + 'help', + } +end + +M.keys = require('fschauen.keymap').whitespace + +M.event = { + 'BufReadPost', + 'BufNewFile' } +M.config = false + +return M +