vim: create a main setup function
This commit is contained in:
parent
cf4c53541f
commit
546db023f4
18 changed files with 358 additions and 408 deletions
|
@ -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()
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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 = "\<ESC>[38:2:%lu:%lu:%lum"]]
|
||||
vim.cmd [[let &t_8b = "\<ESC>[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 <EOL> format
|
||||
o.pastetoggle = '<F20>' -- 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 <Tab> 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
|
||||
|
||||
|
|
|
@ -31,12 +31,12 @@ local keymap = {
|
|||
{ 'J', 'mzJ`z' },
|
||||
|
||||
-- retain selection when making changes in visual mode
|
||||
{ '<c-a>', '<c-a>gv', 'v' },
|
||||
{ '<c-x>', '<c-x>gv', 'v' },
|
||||
{ 'g<c-a>', 'g<c-a>gv', 'v' },
|
||||
{ 'g<c-x>', 'g<c-x>gv', 'v' },
|
||||
{ '>', '><cr>gv', 'v' },
|
||||
{ '<', '<<cr>gv', 'v' },
|
||||
{ '<c-a>', '<c-a>gv', mode = 'v' },
|
||||
{ '<c-x>', '<c-x>gv', mode = 'v' },
|
||||
{ 'g<c-a>', 'g<c-a>gv', mode = 'v' },
|
||||
{ 'g<c-x>', 'g<c-x>gv', mode = 'v' },
|
||||
{ '>', '><cr>gv', mode = 'v' },
|
||||
{ '<', '<<cr>gv', mode = 'v' },
|
||||
|
||||
-- place destination of important movements in the center of the screen
|
||||
{ 'n', 'nzzzv' },
|
||||
|
@ -63,24 +63,24 @@ local keymap = {
|
|||
-- move lines up and down
|
||||
{ '<c-a-j>', [[:move .+1<cr>==]] },
|
||||
{ '<c-a-k>', [[:move .-2<cr>==]] },
|
||||
{ '<c-a-j>', [[:move '>+1<cr>gv=gv]], 'v' },
|
||||
{ '<c-a-k>', [[:move '<-2<cr>gv=gv]], 'v' },
|
||||
{ '<c-a-j>', [[<esc>:move .+1<cr>==gi]], 'i' },
|
||||
{ '<c-a-k>', [[<esc>:move .-2<cr>==gi]], 'i' },
|
||||
{ '<c-a-j>', [[:move '>+1<cr>gv=gv]], mode = 'v' },
|
||||
{ '<c-a-k>', [[:move '<-2<cr>gv=gv]], mode = 'v' },
|
||||
{ '<c-a-j>', [[<esc>:move .+1<cr>==gi]], mode = 'i' },
|
||||
{ '<c-a-k>', [[<esc>:move .-2<cr>==gi]], mode = 'i' },
|
||||
|
||||
-- move to begin/end of line in insert mode
|
||||
{ '<c-a>', '<c-o>^', 'i' },
|
||||
{ '<c-e>', '<c-o>$', 'i' },
|
||||
{ '<c-a>', '<c-o>^', mode = 'i' },
|
||||
{ '<c-e>', '<c-o>$', mode = 'i' },
|
||||
|
||||
-- move to begin of line in command mode (<c-e> moves to end by default)
|
||||
{ '<c-a>', '<c-b>', 'c' },
|
||||
{ '<c-a>', '<c-b>', mode = 'c' },
|
||||
|
||||
-- more convenient way of entering normal mode from terminal mode
|
||||
{ [[<c-\><c-\>]], [[<c-\><c-n>]], 't' },
|
||||
{ [[<c-\><c-\>]], [[<c-\><c-n>]], mode = 't' },
|
||||
|
||||
-- recall older/recent command-line from history
|
||||
{ '<c-j>', '<down>', 'c' },
|
||||
{ '<c-k>', '<up>', 'c' },
|
||||
{ '<c-j>', '<down>', mode = 'c' },
|
||||
{ '<c-k>', '<up>', mode = 'c' },
|
||||
|
||||
-- quickly change background
|
||||
{ '<leader>bg', [[<cmd>let &background = &background ==? 'light' ? 'dark' : 'light'<cr>]] },
|
||||
|
@ -126,7 +126,7 @@ local keymap = {
|
|||
--'<leader>fu'
|
||||
--'<leader>fv'
|
||||
{ '<leader>fw', pickers.selection (--[[dynamic]]) , desc = ' [w]word under cursor' },
|
||||
{ '<leader>fw', pickers.selection (--[[dynamic]]), 'v' , desc = ' visual [s]election' },
|
||||
{ '<leader>fw', pickers.selection (--[[dynamic]]), mode = 'v', desc = ' visual [s]election' },
|
||||
--'<leader>fx'
|
||||
--'<leader>fy'
|
||||
{ '<leader>fz', pickers.spell_suggest (' Spelling suggestions') , desc = ' [z] spell suggestions' },
|
||||
|
@ -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
|
||||
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -1,22 +1,28 @@
|
|||
local config = function()
|
||||
local cmp = require 'cmp'
|
||||
local map = cmp.mapping
|
||||
local repeat_mapping = function(value, keys)
|
||||
local tbl = {}
|
||||
for _, k in ipairs(keys) do tbl[k] = value end
|
||||
return tbl
|
||||
end
|
||||
|
||||
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)
|
||||
local transform_keymap = function(mappings, modes)
|
||||
modes = modes or 'n'
|
||||
modes = type(modes) == 'table' and modes or { modes }
|
||||
return vim.tbl_map(partial(flip(map), modes), keymap)
|
||||
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)
|
||||
local cond = function(condition, yes, no)
|
||||
return function(fallback)
|
||||
if condition() then yes(fallback) else no(fallback) end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local config = function()
|
||||
local cmp = require 'cmp'
|
||||
local map = cmp.mapping
|
||||
|
||||
local keymap = {
|
||||
['<c-n>'] = cond(cmp.visible,
|
||||
|
@ -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, {
|
||||
mapping = transform_keymap(
|
||||
vim.tbl_extend('force', keymap, {
|
||||
['<tab>'] = cond(cmp.visible, map.confirm {select = true }, map.complete()),
|
||||
})),
|
||||
}),
|
||||
'c'),
|
||||
|
||||
completion = {
|
||||
autocomplete = false,
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
return {
|
||||
'chr4/nginx.vim',
|
||||
|
||||
ft = 'nginx',
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
return {
|
||||
'keith/swift.vim',
|
||||
|
||||
ft = 'swift',
|
||||
}
|
||||
|
||||
|
|
|
@ -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,/ ]]
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
return {
|
||||
'mg979/vim-visual-multi',
|
||||
|
||||
init = function()
|
||||
vim.g.VM_leader = '\\'
|
||||
vim.g.VM_silent_exit = 1
|
||||
|
|
|
@ -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'
|
||||
})
|
||||
|
|
@ -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
|
|
@ -1,8 +0,0 @@
|
|||
vim.filetype.add {
|
||||
pattern = {
|
||||
['${HOME}/.ssh/config.d/.*'] = 'sshconfig',
|
||||
['.*/ssh/config'] = 'sshconfig',
|
||||
['.*/git/config'] = 'gitconfig',
|
||||
}
|
||||
}
|
||||
|
|
@ -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
|
||||
|
|
@ -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
|
||||
|
|
@ -1,133 +0,0 @@
|
|||
vim.cmd [[let &t_8f = "\<ESC>[38:2:%lu:%lu:%lum"]]
|
||||
vim.cmd [[let &t_8b = "\<ESC>[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 <EOL> format
|
||||
o.pastetoggle = '<F20>' -- 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 <Tab> 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
|
||||
}
|
||||
|
Loading…
Add table
Reference in a new issue