diff --git a/config/nvim/init.lua b/config/nvim/init.lua index 445ebf7..b0de764 100644 --- a/config/nvim/init.lua +++ b/config/nvim/init.lua @@ -1,13 +1,2 @@ -vim.g.mapleader = ' ' -vim.g.maplocalleader = ',' - -require 'fschauen.setup.globals' -require 'fschauen.setup.options' -require('fschauen.keymap').setup() -require 'fschauen.setup.autocmd' -require 'fschauen.setup.filetype' -require 'fschauen.setup.diagnostic' -require 'fschauen.setup.lazy' - -require('fschauen').colorscheme('gruvbox') +require('fschauen').setup() diff --git a/config/nvim/lua/fschauen/diagnostic.lua b/config/nvim/lua/fschauen/diagnostic.lua index 2f03ceb..055a8dc 100644 --- a/config/nvim/lua/fschauen/diagnostic.lua +++ b/config/nvim/lua/fschauen/diagnostic.lua @@ -1,4 +1,4 @@ -M = {} +local M = {} local diag_opts = { wrap = false, -- don't wrap around the begin/end of file @@ -41,5 +41,32 @@ M.hide = function(bufnr) vim.diagnostic.hide(nil, bufnr or 0) end +---Customize nvim's diagnostics display. +M.setup = function() + vim.diagnostic.config { + underline = false, + virtual_text = { + spacing = 6, + prefix = '●', + }, + float = { + border = 'rounded', + }, + severity_sort = true, + } + + local signs = { + Error = ' ', + Warn = ' ', + Info = ' ', + Hint = ' ', + } + + for type, icon in pairs(signs) do + local hl = 'DiagnosticSign' .. type + vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = hl }) + end +end + return M diff --git a/config/nvim/lua/fschauen/init.lua b/config/nvim/lua/fschauen/init.lua index 5b05146..69be5ab 100644 --- a/config/nvim/lua/fschauen/init.lua +++ b/config/nvim/lua/fschauen/init.lua @@ -1,53 +1,232 @@ local M = {} ---- Flip function arguments. ---- ---- flip(f)(a, b) == f(b, a) ---- ----@param f function: function to flip. ----@return function: function that takes `f`'s arguments flipped. -M.flip = function(f) - return function(a, b) - return f(b, a) - end +P = function(v) + print(vim.inspect(v)) + return v end ---- Concatenate lists. ---- ---- extend({'a', 'b'}, {'c', 'd'}) == {'a', 'b', 'c', 'd'} ---- extend({1, 2}, {3, 4}, {5, 6}) == {1, 2, 3, 4, 5, 6} ---- ----@param ... table: lists to concatenate. ----@return table: concatenation of arguments. -M.concat = function(...) - local result = {} - for _, tbl in ipairs {...} do - for _, v in pairs(tbl) do - result[#result+1] = v - end - end - return result +R = function(module) + require('plenary.reload').reload_module(module) + return require(module) end ---- Partial function application. ---- ---- partial(f, x)(...) == f(x, ...) ---- partial(f, x, y)(...) == f(x, y, ...) ---- ----@param f function: function to partially apply. ----@param ... any: arguments to bind. ----@return function: partially applied function. -M.partial = function(f, ...) - local argv = {...} - return function(...) - return f(unpack(M.concat(argv, {...}))) - end +local set_options = function() + vim.g.mapleader = ' ' + vim.g.maplocalleader = ',' + + vim.cmd [[let &t_8f = "\[38:2:%lu:%lu:%lum"]] + vim.cmd [[let &t_8b = "\[48:2:%lu:%lu:%lum"]] + + local o = vim.opt + + -- General + o.belloff = 'all' -- never ring bells + o.hidden = true -- hide abandoned buffers + o.clipboard = 'unnamedplus' -- synchronize with system clipboard + o.lazyredraw = true -- don't redraw screen during macros + o.modelines = 0 -- never use modelines + o.fileformats = 'unix,mac,dos' -- prioritize unix format + o.pastetoggle = '' -- toggle paste with P on Moonlander + + o.swapfile = false -- don't use swap files + o.writebackup = true -- Make a backup before writing a file... + o.backup = false -- ...but don't keep it around. + o.undofile = true -- write undo history + + o.shortmess:append 'I' -- no intro message when starting Vim + o.shada = { + "'1000", -- remember marks for this many files + "/1000", -- remember this many search patterns + ":1000", -- remember this many command line items + "<100", -- maximum number of lines to remember per register + "h", -- disable 'hlsearch' while reading shada file + "s100", -- limit size of remembered items to this many KiB + } + + -- Searching + o.ignorecase = true -- Ignore case when searching... + o.smartcase = true -- ...unless pattern contains uppercase characters. + o.wrapscan = false -- Don't wrap around the end of the file when searching. + + -- Editing + o.expandtab = true -- use spaces when is inserted + o.tabstop = 4 -- tabs are 4 spaces + o.shiftwidth = 0 -- (auto)indent using 'tabstop' spaces + o.smartindent = true -- use smart autoindenting + o.inccommand = 'split' -- preview command partial results + o.joinspaces = false -- use one space after a period whe joining lines + o.showmatch = true -- briefly jump to matching bracket if insert one + o.virtualedit = 'block' -- position the cursor anywhere in Visual Block mode + o.formatlistpat = [[^\s*\(\d\+[\]:.)}\t ]\|[-+*]\|[\[(][ x][\])]\)\s*]] + o.completeopt = { + 'menu', -- show completions in a popup menu + 'preview', -- show extra information about the selected match + 'noinsert', -- don't insert text until I select a match + 'noselect', -- don't pre-select the first match in the menu + } + + local fmt = o.formatoptions + fmt:remove 't' -- Don't auto-wrap on 'textwidth'... + fmt:append 'c' -- ...but do it within comment blocks... + fmt:append 'l' -- ...but not if line was already long before entering Insert mode. + fmt:append 'r' -- Insert comment leader when pressing Enter... + fmt:remove 'o' -- ...but not when opening a new line with o & O. + fmt:append 'q' -- allow formatting of comments with gq + fmt:remove 'a' -- don't auto-format every time text is inserted + fmt:append 'n' -- indent lists automatically acc. 'formatlistpat' + fmt:append 'j' -- remove comment leader when joining lines + fmt:append '1' -- don't break lines after a one letter word but rather before it + + -- Appearance + o.termguicolors = true -- use "gui" :higlight instead of "cterm" + o.showmode = false -- don't show mode (shown in statusline instead) + o.relativenumber = true -- Start off with relative line numbers... + o.number = true -- ...but real number for current line. + o.wrap = false -- don't wrap long lines initially + o.textwidth = 80 -- maximum width for text being inserted + o.colorcolumn = '+1' -- highlight column after 'textwidth' + o.cursorline = true -- highlight the line of the cursor... + o.cursorlineopt = 'number'-- ...but only the line number + o.showbreak = '⤷ ' -- prefix for wrapped lines + o.scrolloff = 3 -- min. # of lines above and below cursor + o.sidescrolloff = 3 -- min. # of columns to left and right of cursor + o.signcolumn = 'number' -- display signs in 'number' column + o.list = false -- don't show invisible characters initially + o.listchars = { + eol = '↲', + tab = '» ', + extends = '…', + precedes = '…', + trail = '·', + conceal = '┊', + } + o.fillchars = { + diff = '⋅', + } + + -- Wildcard Expansion + o.wildignore = { + '.git', + '.svn', + '__pycache__', + '**/tmp/**', + '*.DS_Store', + '*.dll', + '*.egg-info', + '*.exe', + '*.gif', + '*.jpeg', + '*.jpg', + '*.o', + '*.obj', + '*.out', + '*.png', + '*.pyc', + '*.so', + '*.zip', + '*~', + } + o.wildignorecase = true -- ignore case when completing file names + o.wildmode = 'longest:full' -- longest common prefix first, then wildmenu + + -- Window Splitting + o.splitbelow = true -- :split below current window + o.splitright = true -- :vsplit to the right of current window + o.equalalways = false -- don't resize all windows when splitting + + -- Folding + o.foldenable = true -- enable folding + o.foldlevelstart = 100 -- start with all folds open + o.foldmethod = 'syntax' -- fold based on syntax by default + o.foldnestmax = 10 -- limit nested folds to 10 levels + + -- Options for diff mode + o.diffopt = { -- better side-by-side diffs + 'filler', -- show filler lines (so text is vertically synced) + 'vertical', -- use vertical splits (files side-by-side) + 'closeoff', -- disable diff mode when one window is closed +} end -M.colorscheme = function(name) - vim.cmd('silent! colorscheme ' .. name) +local bootstrap_lazy = function(path) + if not vim.loop.fs_stat(path) then + vim.fn.system { + 'git', + 'clone', + '--filter=blob:none', + '--branch=stable', + 'https://github.com/folke/lazy.nvim.git', + path, + } + end + vim.opt.rtp:prepend(path) + return vim.F.npcall(require, 'lazy') +end + +local setup_plugins = function() + local lazy = bootstrap_lazy(vim.fn.stdpath('data') .. '/lazy/lazy.nvim') + if not lazy then + vim.notify('Lazy not installed and failed to bootstrap!', vim.log.levels.WARN) + return + end + + lazy.setup { + spec = 'fschauen.plugins', + -- defaults = { + -- lazy = true, + -- }, + dev = { + path = '~/Projects/nvim-plugins', + fallback = true, + }, + ui = { + border = 'rounded', + title = ' Lazy ', + }, + performance = { + rtp = { + disabled_plugins = { + 'gzip', + 'matchit', + 'matchparen', + 'netrwPlugin', + 'tarPlugin', + 'tohtml', + 'tutor', + 'zipPlugin', + }, + }, + }, + } +end + +M.setup = function() + set_options() + + require('fschauen.keymap').setup() + require('fschauen.diagnostic').setup() + + vim.api.nvim_create_autocmd('TextYankPost', { + desc = 'Briefly highlight yanked text.', + group = vim.api.nvim_create_augroup('fschauen.yank', { clear = true } ), + pattern = '*', + callback = function(_) vim.highlight.on_yank() end + }) + + vim.filetype.add { + pattern = { + ['${HOME}/.ssh/config.d/.*'] = 'sshconfig', + ['.*/ssh/config'] = 'sshconfig', + ['.*/git/config'] = 'gitconfig', + } + } + + setup_plugins() + + local colorscheme = 'gruvbox' + vim.cmd('silent! colorscheme ' .. colorscheme) if vim.v.errmsg ~= '' then - vim.notify(string.format('Colorscheme %s not found!', name), vim.log.levels.WARN) + vim.notify(('Colorscheme %s not found!'):format(colorscheme), vim.log.levels.WARN) end end diff --git a/config/nvim/lua/fschauen/keymap.lua b/config/nvim/lua/fschauen/keymap.lua index 645bb61..45f050e 100644 --- a/config/nvim/lua/fschauen/keymap.lua +++ b/config/nvim/lua/fschauen/keymap.lua @@ -24,73 +24,73 @@ end local keymap = { -- better navigation for wrapped lines - { 'j', 'gj' }, - { 'k', 'gk' }, + { 'j', 'gj' }, + { 'k', 'gk' }, -- maintain cursor position when joining lines - { 'J', 'mzJ`z' }, + { 'J', 'mzJ`z' }, -- retain selection when making changes in visual mode - { '', 'gv', 'v' }, - { '', 'gv', 'v' }, - { 'g', 'ggv', 'v' }, - { 'g', 'ggv', 'v' }, - { '>', '>gv', 'v' }, - { '<', '<gv', 'v' }, + { '', 'gv', mode = 'v' }, + { '', 'gv', mode = 'v' }, + { 'g', 'ggv', mode = 'v' }, + { 'g', 'ggv', mode = 'v' }, + { '>', '>gv', mode = 'v' }, + { '<', '<gv', mode = 'v' }, -- place destination of important movements in the center of the screen - { 'n', 'nzzzv' }, - { 'N', 'Nzzzv' }, - { '', 'zzzv' }, - { '', 'zzzv' }, + { 'n', 'nzzzv' }, + { 'N', 'Nzzzv' }, + { '', 'zzzv' }, + { '', 'zzzv' }, -- easier window navigation - { '', 'j' }, - { '', 'k' }, - { '', 'h' }, - { '', 'l' }, + { '', 'j' }, + { '', 'k' }, + { '', 'h' }, + { '', 'l' }, -- window resizing - { '', window.resize_up(2), desc = 'Resize window upward' }, - { '', window.resize_down(2), desc = 'Resize window downward' }, - { '', window.resize_left(2), desc = 'Resize window leftward' }, - { '', window.resize_right(2), desc = 'Resize window rightward' }, + { '', window.resize_up(2), desc = 'Resize window upward' }, + { '', window.resize_down(2), desc = 'Resize window downward' }, + { '', window.resize_left(2), desc = 'Resize window leftward' }, + { '', window.resize_right(2), desc = 'Resize window rightward' }, -- easy tab navigation - { '', 'tabnext' }, - { '', 'tabprevious' }, + { '', 'tabnext' }, + { '', 'tabprevious' }, -- move lines up and down - { '', [[:move .+1==]] }, - { '', [[:move .-2==]] }, - { '', [[:move '>+1gv=gv]], 'v' }, - { '', [[:move '<-2gv=gv]], 'v' }, - { '', [[:move .+1==gi]], 'i' }, - { '', [[:move .-2==gi]], 'i' }, + { '', [[:move .+1==]] }, + { '', [[:move .-2==]] }, + { '', [[:move '>+1gv=gv]], mode = 'v' }, + { '', [[:move '<-2gv=gv]], mode = 'v' }, + { '', [[:move .+1==gi]], mode = 'i' }, + { '', [[:move .-2==gi]], mode = 'i' }, -- move to begin/end of line in insert mode - { '', '^', 'i' }, - { '', '$', 'i' }, + { '', '^', mode = 'i' }, + { '', '$', mode = 'i' }, -- move to begin of line in command mode ( moves to end by default) - { '', '', 'c' }, + { '', '', mode = 'c' }, -- more convenient way of entering normal mode from terminal mode - { [[]], [[]], 't' }, + { [[]], [[]], mode = 't' }, -- recall older/recent command-line from history - { '', '', 'c' }, - { '', '', 'c' }, + { '', '', mode = 'c' }, + { '', '', mode = 'c' }, -- quickly change background - { 'bg', [[let &background = &background ==? 'light' ? 'dark' : 'light']] }, + { 'bg', [[let &background = &background ==? 'light' ? 'dark' : 'light']] }, -- navigate diagnostics - { 'dj', diagnostic.goto_next }, - { 'dk', diagnostic.goto_prev }, - { 'dd', diagnostic.toggle }, - { 'do', diagnostic.open_float }, - { 'dh', diagnostic.hide }, + { 'dj', diagnostic.goto_next }, + { 'dk', diagnostic.goto_prev }, + { 'dd', diagnostic.toggle }, + { 'do', diagnostic.open_float }, + { 'dh', diagnostic.hide }, telescope = { { 'fa', pickers.autocommands (' Autocommands' ), desc = ' [a]utocommands' }, @@ -126,7 +126,7 @@ local keymap = { --'fu' --'fv' { 'fw', pickers.selection (--[[dynamic]]) , desc = ' [w]word under cursor' }, - { 'fw', pickers.selection (--[[dynamic]]), 'v' , desc = ' visual [s]election' }, + { 'fw', pickers.selection (--[[dynamic]]), mode = 'v', desc = ' visual [s]election' }, --'fx' --'fy' { 'fz', pickers.spell_suggest ('󰓆 Spelling suggestions') , desc = ' [z] spell suggestions' }, @@ -152,17 +152,17 @@ local keymap = { }, -- disable highlight until next search - { 'h', 'nohlsearch' }, + { 'h', 'nohlsearch' }, -- navigate items in quickfix and location lists - { 'j', 'cnextzz' }, - { 'k', 'cpreviouszz' }, - { 'j', 'lnextzz' }, - { 'k', 'lpreviouszz' }, + { 'j', 'cnextzz' }, + { 'k', 'cpreviouszz' }, + { 'j', 'lnextzz' }, + { 'k', 'lpreviouszz' }, -- toggle quickfix and loclist - { 'll', window.toggle_quickfix, desc = 'Toggle quickfix' }, - { 'll', window.toggle_loclist, desc = 'Toggle loclist' }, + { 'll', window.toggle_quickfix, desc = 'Toggle quickfix' }, + { 'll', window.toggle_loclist, desc = 'Toggle loclist' }, trouble = { { 'lt', 'TroubleToggle' }, @@ -171,7 +171,7 @@ local keymap = { }, -- quickly open lazy.nvim plugin manager - { 'L', 'Lazy' }, + { 'L', 'Lazy' }, nvim_tree = { { 'nn', 'NvimTreeOpen' }, @@ -180,11 +180,11 @@ local keymap = { }, -- toggle options - { 'sn', toggle_number }, - { 'sr', toggle_relativenumber }, - { 'sl', 'set list! | set list?' }, - { 'sw', 'set wrap! | set wrap?' }, - { 'ss', 'set spell! | set spell?' }, + { 'sn', toggle_number }, + { 'sr', toggle_relativenumber }, + { 'sl', 'set list! | set list?' }, + { 'sw', 'set wrap! | set wrap?' }, + { 'ss', 'set spell! | set spell?' }, virt_column = { { 'sc', toggle_colorcolumn, desc = 'Toggle virtual colunn' }, @@ -213,16 +213,13 @@ local keymap = { } M.setup = function() - local keymap_set = vim.keymap.set - local set = function(opts) - local lhs, rhs, mode = opts[1], opts[2], opts[3] or 'n' - opts[1], opts[2], opts[3], opts.mode = nil, nil, nil, nil - opts.silent = opts.silent ~= false - keymap_set(mode, lhs, rhs, opts) - end + local set = vim.keymap.set - for _, mapping in ipairs(keymap) do - set(mapping) + for _, map in ipairs(keymap) do + local lhs, rhs, mode = map[1], map[2], map.mode or 'n' + map[1], map[2], map.mode = nil, nil, nil + map.silent = map.silent ~= false -- silent by default + set(mode, lhs, rhs, map) end end diff --git a/config/nvim/lua/fschauen/plugins/colorizer.lua b/config/nvim/lua/fschauen/plugins/colorizer.lua index 4e092f1..d935efb 100644 --- a/config/nvim/lua/fschauen/plugins/colorizer.lua +++ b/config/nvim/lua/fschauen/plugins/colorizer.lua @@ -1,10 +1,10 @@ return { 'norcalli/nvim-colorizer.lua', - cond = vim.opt.termguicolors:get(), - - event = { 'BufReadPost', 'BufNewFile' }, - + event = { + 'BufReadPost', + 'BufNewFile' + }, config = function() require('colorizer').setup(nil, { css = true, diff --git a/config/nvim/lua/fschauen/plugins/completion.lua b/config/nvim/lua/fschauen/plugins/completion.lua index 5efa4a9..65e244b 100644 --- a/config/nvim/lua/fschauen/plugins/completion.lua +++ b/config/nvim/lua/fschauen/plugins/completion.lua @@ -1,23 +1,29 @@ +local repeat_mapping = function(value, keys) + local tbl = {} + for _, k in ipairs(keys) do tbl[k] = value end + return tbl +end + +local transform_keymap = function(mappings, modes) + modes = modes or 'n' + modes = type(modes) == 'table' and modes or { modes } + local tbl = {} + for lhs, rhs in pairs(mappings) do + tbl[lhs] = repeat_mapping(rhs, modes) + end + return tbl +end + +local cond = function(condition, yes, no) + return function(fallback) + if condition() then yes(fallback) else no(fallback) end + end +end + local config = function() local cmp = require 'cmp' local map = cmp.mapping - local fs = require 'fschauen' - local flip, partial = fs.flip, fs.partial - - -- assign('i', { key = func, ... }) == { key = { i = func }, ... } - -- assign({'i', 'c'}, { key = func, ... }) == { key = { i = func, c = func }, ...} - local assign_keymap = function(modes, keymap) - modes = type(modes) == 'table' and modes or { modes } - return vim.tbl_map(partial(flip(map), modes), keymap) - end - - local cond = function(condition, yes, no) - return function(fallback) - if condition() then yes(fallback) else no(fallback) end - end - end - local keymap = { [''] = cond(cmp.visible, map.select_next_item { behavior = cmp.SelectBehavior.Select }, @@ -42,7 +48,7 @@ local config = function() } cmp.setup { - mapping = assign_keymap('i', keymap), + mapping = transform_keymap(keymap, 'i'), enabled = function() local c = require 'cmp.config.context' @@ -128,9 +134,11 @@ local config = function() } cmp.setup.cmdline(':', { - mapping = assign_keymap('c', vim.tbl_extend('force', keymap, { - [''] = cond(cmp.visible, map.confirm {select = true }, map.complete()), - })), + mapping = transform_keymap( + vim.tbl_extend('force', keymap, { + [''] = cond(cmp.visible, map.confirm {select = true }, map.complete()), + }), + 'c'), completion = { autocomplete = false, diff --git a/config/nvim/lua/fschauen/plugins/lualine.lua b/config/nvim/lua/fschauen/plugins/lualine.lua index 3c76d5f..e9ffabf 100644 --- a/config/nvim/lua/fschauen/plugins/lualine.lua +++ b/config/nvim/lua/fschauen/plugins/lualine.lua @@ -56,7 +56,6 @@ local config = function() local window_is_wide = window_is_at_least(80) local window_is_medium = window_is_at_least(50) - local fs = require 'fschauen' local my = { paste = { function() return '' end, @@ -92,7 +91,7 @@ local config = function() status = { function() - local flags = fs.concat( + local flags = vim.list_extend( vim.bo.modified and {'+'} or {}, (vim.bo.readonly or not vim.bo.modifiable) and {'RO'} or {}) return vim.fn.join(flags, ' ') @@ -141,8 +140,8 @@ local config = function() local active_sections = vim.tbl_extend('force', inactive_sections, { - lualine_a = fs.concat({ my.paste, my.mode }, inactive_sections.lualine_a), - lualine_x = fs.concat({ 'diagnostics' }, inactive_sections.lualine_x), + lualine_a = vim.list_extend({ my.paste, my.mode }, inactive_sections.lualine_a), + lualine_x = vim.list_extend({ 'diagnostics' }, inactive_sections.lualine_x), }) require('lualine').setup { diff --git a/config/nvim/lua/fschauen/plugins/nginx.lua b/config/nvim/lua/fschauen/plugins/nginx.lua index 6218ee0..943c9c6 100644 --- a/config/nvim/lua/fschauen/plugins/nginx.lua +++ b/config/nvim/lua/fschauen/plugins/nginx.lua @@ -1,5 +1,5 @@ return { 'chr4/nginx.vim', - ft = 'nginx', } + diff --git a/config/nvim/lua/fschauen/plugins/swift.lua b/config/nvim/lua/fschauen/plugins/swift.lua index 537e980..f3a2251 100644 --- a/config/nvim/lua/fschauen/plugins/swift.lua +++ b/config/nvim/lua/fschauen/plugins/swift.lua @@ -1,6 +1,5 @@ return { 'keith/swift.vim', - ft = 'swift', } diff --git a/config/nvim/lua/fschauen/plugins/tabular.lua b/config/nvim/lua/fschauen/plugins/tabular.lua index 97708c3..fa09cce 100644 --- a/config/nvim/lua/fschauen/plugins/tabular.lua +++ b/config/nvim/lua/fschauen/plugins/tabular.lua @@ -1,6 +1,10 @@ return { 'godlygeek/tabular', - + cmd ={ + 'AddTabularPattern', + 'AddTabularPipeline', + 'Tabularize', + }, config = function() if vim.fn.exists('g:tabular_loaded') == 1 then vim.cmd [[ AddTabularPattern! first_comma /^[^,]*\zs,/ ]] diff --git a/config/nvim/lua/fschauen/plugins/telescope.lua b/config/nvim/lua/fschauen/plugins/telescope.lua index 10163a4..e3deef0 100644 --- a/config/nvim/lua/fschauen/plugins/telescope.lua +++ b/config/nvim/lua/fschauen/plugins/telescope.lua @@ -78,6 +78,13 @@ return { require('telescope').setup(opts) require('telescope').load_extension 'fzf' require('telescope').load_extension 'file_browser' + + 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 } diff --git a/config/nvim/lua/fschauen/plugins/visual-multi.lua.disabled b/config/nvim/lua/fschauen/plugins/visual-multi.lua.disabled index 12ab6ef..57d294d 100644 --- a/config/nvim/lua/fschauen/plugins/visual-multi.lua.disabled +++ b/config/nvim/lua/fschauen/plugins/visual-multi.lua.disabled @@ -1,6 +1,5 @@ return { 'mg979/vim-visual-multi', - init = function() vim.g.VM_leader = '\\' vim.g.VM_silent_exit = 1 diff --git a/config/nvim/lua/fschauen/setup/autocmd.lua b/config/nvim/lua/fschauen/setup/autocmd.lua deleted file mode 100644 index 7b1bfa4..0000000 --- a/config/nvim/lua/fschauen/setup/autocmd.lua +++ /dev/null @@ -1,26 +0,0 @@ -local augroup = vim.api.nvim_create_augroup -local autocmd = vim.api.nvim_create_autocmd - -local id = augroup("my_autocmds", { clear = true} ) - -autocmd({'BufNewFile', 'BufRead'}, { - desc = 'Make it possible to use `gf` to jump to my neovim lua modules.', - group = id, - pattern = 'init.lua', - command = "setlocal path+=~/.config/nvim/lua includeexpr=substitute(v:fname,'\\\\.','/','g')" -}) - -autocmd('TextYankPost', { - desc = 'Briefly highlight yanked text.', - group = id, - pattern = '*', - callback = function(_) vim.highlight.on_yank() end -}) - -autocmd('User', { - desc = 'Enable line number in Telescope previewers.', - group = id, - pattern = 'TelescopePreviewerLoaded', - command = 'setlocal number' -}) - diff --git a/config/nvim/lua/fschauen/setup/diagnostic.lua b/config/nvim/lua/fschauen/setup/diagnostic.lua deleted file mode 100644 index 7f90313..0000000 --- a/config/nvim/lua/fschauen/setup/diagnostic.lua +++ /dev/null @@ -1,23 +0,0 @@ -vim.diagnostic.config { - underline = false, - virtual_text = { - spacing = 6, - prefix = '●', - }, - float = { - border = 'rounded', - }, - severity_sort = true, -} - -local signs = { - Error = ' ', - Warn = ' ', - Info = ' ', - Hint = ' ', -} - -for type, icon in pairs(signs) do - local hl = 'DiagnosticSign' .. type - vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = hl }) -end diff --git a/config/nvim/lua/fschauen/setup/filetype.lua b/config/nvim/lua/fschauen/setup/filetype.lua deleted file mode 100644 index 32bcdc5..0000000 --- a/config/nvim/lua/fschauen/setup/filetype.lua +++ /dev/null @@ -1,8 +0,0 @@ -vim.filetype.add { - pattern = { - ['${HOME}/.ssh/config.d/.*'] = 'sshconfig', - ['.*/ssh/config'] = 'sshconfig', - ['.*/git/config'] = 'gitconfig', - } -} - diff --git a/config/nvim/lua/fschauen/setup/globals.lua b/config/nvim/lua/fschauen/setup/globals.lua deleted file mode 100644 index 02b8963..0000000 --- a/config/nvim/lua/fschauen/setup/globals.lua +++ /dev/null @@ -1,19 +0,0 @@ -P = function(v) - print(vim.inspect(v)) - return v -end - -PP = function(v) - vim.print(v) - return v -end - -RELOAD = function(...) - return require('plenary.reload').reload_module(...) -end - -R = function(name) - RELOAD(name) - return require(name) -end - diff --git a/config/nvim/lua/fschauen/setup/lazy.lua b/config/nvim/lua/fschauen/setup/lazy.lua deleted file mode 100644 index 1a1bc8c..0000000 --- a/config/nvim/lua/fschauen/setup/lazy.lua +++ /dev/null @@ -1,49 +0,0 @@ -local lazy = (function() - local path = vim.fn.stdpath('data') .. '/lazy/lazy.nvim' - if not vim.loop.fs_stat(path) then - vim.fn.system { - 'git', - 'clone', - '--filter=blob:none', - '--branch=stable', - 'https://github.com/folke/lazy.nvim.git', - path, - } - end - vim.opt.rtp:prepend(path) - return vim.F.npcall(require, 'lazy') -end)() - -if lazy then - lazy.setup { - spec = 'fschauen.plugins', - -- defaults = { - -- lazy = true, - -- }, - dev = { - path = '~/Projects/nvim-plugins', - fallback = true, - }, - ui = { - border = 'rounded', - title = ' Lazy ', - }, - performance = { - rtp = { - disabled_plugins = { - 'gzip', - 'matchit', - 'matchparen', - 'netrwPlugin', - 'tarPlugin', - 'tohtml', - 'tutor', - 'zipPlugin', - }, - }, - }, - } -else - vim.notify('Lazy not installed and failed to bootstrap!', vim.log.levels.WARN) -end - diff --git a/config/nvim/lua/fschauen/setup/options.lua b/config/nvim/lua/fschauen/setup/options.lua deleted file mode 100644 index 0833c15..0000000 --- a/config/nvim/lua/fschauen/setup/options.lua +++ /dev/null @@ -1,133 +0,0 @@ -vim.cmd [[let &t_8f = "\[38:2:%lu:%lu:%lum"]] -vim.cmd [[let &t_8b = "\[48:2:%lu:%lu:%lum"]] - -local o = vim.opt - --- General -o.belloff = 'all' -- never ring bells -o.hidden = true -- hide abandoned buffers -o.clipboard = 'unnamedplus' -- synchronize with system clipboard -o.lazyredraw = true -- don't redraw screen during macros -o.modelines = 0 -- never use modelines -o.fileformats = 'unix,mac,dos' -- prioritize unix format -o.pastetoggle = '' -- toggle paste with P on Moonlander - -o.swapfile = false -- don't use swap files -o.writebackup = true -- Make a backup before writing a file... -o.backup = false -- ...but don't keep it around. -o.undofile = true -- write undo history - -o.shortmess:append 'I' -- no intro message when starting Vim -o.shada = { - "'1000", -- remember marks for this many files - "/1000", -- remember this many search patterns - ":1000", -- remember this many command line items - "<100", -- maximum number of lines to remember per register - "h", -- disable 'hlsearch' while reading shada file - "s100", -- limit size of remembered items to this many KiB -} - --- Searching -o.ignorecase = true -- Ignore case when searching... -o.smartcase = true -- ...unless pattern contains uppercase characters. -o.wrapscan = false -- Don't wrap around the end of the file when searching. - --- Editing -o.expandtab = true -- use spaces when is inserted -o.tabstop = 4 -- tabs are 4 spaces -o.shiftwidth = 0 -- (auto)indent using 'tabstop' spaces -o.smartindent = true -- use smart autoindenting -o.inccommand = 'split' -- preview command partial results -o.joinspaces = false -- use one space after a period whe joining lines -o.showmatch = true -- briefly jump to matching bracket if insert one -o.virtualedit = 'block' -- position the cursor anywhere in Visual Block mode -o.formatlistpat = [[^\s*\(\d\+[\]:.)}\t ]\|[-+*]\|[\[(][ x][\])]\)\s*]] -o.completeopt = { - 'menu', -- show completions in a popup menu - 'preview', -- show extra information about the selected match - 'noinsert', -- don't insert text until I select a match - 'noselect', -- don't pre-select the first match in the menu -} - -local fmt = o.formatoptions -fmt:remove 't' -- Don't auto-wrap on 'textwidth'... -fmt:append 'c' -- ...but do it within comment blocks... -fmt:append 'l' -- ...but not if line was already long before entering Insert mode. -fmt:append 'r' -- Insert comment leader when pressing Enter... -fmt:remove 'o' -- ...but not when opening a new line with o & O. -fmt:append 'q' -- allow formatting of comments with gq -fmt:remove 'a' -- don't auto-format every time text is inserted -fmt:append 'n' -- indent lists automatically acc. 'formatlistpat' -fmt:append 'j' -- remove comment leader when joining lines -fmt:append '1' -- don't break lines after a one letter word but rather before it - --- Appearance -o.termguicolors = true -- use "gui" :higlight instead of "cterm" -o.showmode = false -- don't show mode (shown in statusline instead) -o.relativenumber = true -- Start off with relative line numbers... -o.number = true -- ...but real number for current line. -o.wrap = false -- don't wrap long lines initially -o.textwidth = 80 -- maximum width for text being inserted -o.colorcolumn = '+1' -- highlight column after 'textwidth' -o.cursorline = true -- highlight the line of the cursor... -o.cursorlineopt = 'number'-- ...but only the line number -o.showbreak = '⤷ ' -- prefix for wrapped lines -o.scrolloff = 3 -- min. # of lines above and below cursor -o.sidescrolloff = 3 -- min. # of columns to left and right of cursor -o.signcolumn = 'number' -- display signs in 'number' column -o.list = false -- don't show invisible characters initially -o.listchars = { - eol = '↲', - tab = '» ', - extends = '…', - precedes = '…', - trail = '·', - conceal = '┊', -} -o.fillchars = { - diff = '⋅', -} - --- Wildcard Expansion -o.wildignore = { - '.git', - '.svn', - '__pycache__', - '**/tmp/**', - '*.DS_Store', - '*.dll', - '*.egg-info', - '*.exe', - '*.gif', - '*.jpeg', - '*.jpg', - '*.o', - '*.obj', - '*.out', - '*.png', - '*.pyc', - '*.so', - '*.zip', - '*~', -} -o.wildignorecase = true -- ignore case when completing file names -o.wildmode = 'longest:full' -- longest common prefix first, then wildmenu - --- Window Splitting -o.splitbelow = true -- :split below current window -o.splitright = true -- :vsplit to the right of current window -o.equalalways = false -- don't resize all windows when splitting - --- Folding -o.foldenable = true -- enable folding -o.foldlevelstart = 100 -- start with all folds open -o.foldmethod = 'syntax' -- fold based on syntax by default -o.foldnestmax = 10 -- limit nested folds to 10 levels - --- Options for diff mode -o.diffopt = { -- better side-by-side diffs - 'filler', -- show filler lines (so text is vertically synced) - 'vertical', -- use vertical splits (files side-by-side) - 'closeoff', -- disable diff mode when one window is closed -} -