vim: move most plugin configurations to plugins.lua

This commit is contained in:
Fernando Schauenburg 2022-07-18 23:41:54 +02:00
parent 422efc6210
commit 74fc686daa
10 changed files with 206 additions and 217 deletions

View file

@ -1,11 +0,0 @@
local nmap = require'fs.util'.nmap
local config = function()
require'indent_blankline'.setup { enabled = false }
-- show/hide indent guides
nmap { '<leader>si', '<cmd>:IndentBlanklineToggle<cr>' }
end
return { config = config }

View file

@ -1,33 +0,0 @@
local nmap = require'fs.util'.nmap
local config = function()
require'nvim-tree'.setup {
git = {
ignore = false, -- don't hide files from .gitignore
},
view = {
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
group_empty = true, -- folders that contain only one folder are grouped
highlight_git = true, -- enable highlight based on git attributes
indent_markers = {
enable = true, -- show indent markers
},
},
}
nmap { '<c-n>', '<cmd>NvimTreeToggle<cr>' }
nmap { '<leader>n', '<cmd>NvimTreeFindFileToggle<cr>' }
end
return { config = config }

View file

@ -1,11 +0,0 @@
local nmap = require'fs.util'.nmap
local config = function()
vim.g['rainbow#pairs'] = { {'(',')'}, {'[',']'}, {'{','}'} }
-- show/hide rainbow parens
nmap { '<leader>sp', '<cmd>RainbowParentheses!!<cr>' }
end
return { config = config }

View file

@ -1,18 +0,0 @@
local nmap = require'fs.util'.nmap
local setup = function()
vim.g.better_whitespace_filetypes_blacklist = {
'diff', 'git', 'gitcommit', 'help', 'fugitive'
}
end
local config = function()
-- fix whitespace
nmap { '<leader>w', '<cmd>StripWhitespace<cr>' }
-- show/hide whitespace
nmap { '<leader>sw', '<cmd>ToggleWhitespace<cr>' }
end
return { config = config, setup = setup }

View file

@ -1,54 +0,0 @@
local util = require'fs.util'
local C = util.colors()
local highlight = util.highlight
local additional_highlights = {
-- Override the colorscheme for these ones:
Normal = { bg = 'NONE' }, -- transparent background
NonText = { fg = C.base02, attrs = 'NONE' }, -- very subtle EOL symbols
Whitespace = { fg = C.orange }, -- listchars
SpellBad = { fg = C.yellow }, -- spelling mistakes
QuickFixLine = { fg = C.yellow, bg = C.base02 }, -- selected quickfix item
CursorLineNr = { fg = C.yellow, attrs = 'NONE' }, -- current line number
-- Trailing whitespace, from 'ntpeters/vim-better-whitespace':
ExtraWhitespace = { fg = C.orange, bg = C.orange },
-- Indentation guids, from 'lukas-reineke/indent-blankline.nvim':
IndentBlanklineChar = { fg = C.base01, bg = 'NONE' },
-- Virtual colorcolumn, from 'lukas-reineke/virt-column.nvim':
VirtColumn = { fg = C.base02, bg = 'NONE', attrs = 'NONE' },
ColorColumn = { bg = 'NONE' }, -- otherwise this is visible behind VirtColumn
-- Colors for 'kyazdani42/nvim-tree.lua':
NvimTreeSpecialFile = { fg = C.base2 },
NvimTreeIndentMarker = { fg = C.base01 },
NvimTreeGitStaged = { fg = C.green },
NvimTreeGitRenamed = { fg = C.yellow },
NvimTreeGitNew = { fg = C.yellow },
NvimTreeGitDirty = { fg = C.yellow },
NvimTreeGitDeleted = { fg = C.orange },
NvimTreeGitMerge = { fg = C.red },
-- Colors for 'nvim-telescope/telescope.nvim':
TelescopeBorder = { fg = C.base01 },
TelescopeTitle = { fg = C.base1 },
TelescopePromptPrefix = { fg = C.red },
TelescopePromptCounter = { fg = C.base1 },
TelescopeMatching = { fg = C.red },
TelescopeSelection = { fg = C.base2, bg = C.base02, attrs = 'NONE' },
TelescopeMultiSelection = { fg = C.blue },
TelescopeMultiIcon = { fg = C.blue },
}
local config = function()
vim.cmd [[silent! colorscheme solarized]]
for group, hl in pairs(additional_highlights) do
highlight(group, hl)
end
end
return { config = config }

View file

@ -1,9 +0,0 @@
local nmap = require'fs.util'.nmap
local config = function()
nmap { '<leader>gg', '<cmd>G<cr>' }
nmap { '<leader>g<space>', '<cmd>G ' }
end
return { config = config }

View file

@ -1,17 +0,0 @@
local setup = function()
-- Disable quote concealling.
vim.g.vim_json_syntax_conceal = 0
end
local config = function()
-- Make numbers and booleans stand out.
vim.cmd [[
highlight link jsonBraces Text
highlight link jsonNumber Identifier
highlight link jsonBoolean Identifier
highlight link jsonNull Identifier
]]
end
return { setup = setup, config = config }

View file

@ -1,22 +0,0 @@
local nmap = require'fs.util'.nmap
local setup = function()
-- Disable concealling on italic, bold, etc.
vim.g.vim_markdown_conceal = 0
-- Disable concealling on code blocks.
vim.g.vim_markdown_conceal_code_blocks = 0
-- Automatic insertion of bullets is buggy. so disable it.
vim.g.vim_markdown_auto_insert_bullets = 0
vim.g.vim_markdown_new_list_item_indent = 0
end
local config = function()
nmap { '<leader>+', '<cmd>.,.HeaderIncrease<cr>', { buffer = true } }
nmap { '<leader>=', '<cmd>.,.HeaderIncrease<cr>', { buffer = true } }
nmap { '<leader>-', '<cmd>.,.HeaderDecrease<cr>', { buffer = true } }
end
return { setup = setup, config = config }

View file

@ -1,19 +0,0 @@
local nmap = require'fs.util'.nmap
local toggle = function()
if vim.o.colorcolumn == '' then
vim.o.colorcolumn = '+1'
else
vim.o.colorcolumn = ''
end
end
local config = function()
require'virt-column'.setup { char = '' }
-- show/hide virtual colorcolumn
nmap { '<leader>sc', [[<cmd>lua require'fs.config.virt-column'.toggle()<cr>]] }
end
return { config = config, toggle = toggle }

View file

@ -13,57 +13,240 @@ return packer().startup(function(use)
use 'nvim-lua/plenary.nvim'
-- Visuals ----------------------------------------------------------------
use { 'altercation/vim-colors-solarized',
config = function() require'fs.config.vim-colors-solarized'.config() end,
use {
'altercation/vim-colors-solarized',
config = function()
local C = require'fs.util'.colors()
local overrides = {
-- Override the colorscheme for these ones:
Normal = { bg = 'NONE' }, -- transparent background
NonText = { fg = C.base02, attrs = 'NONE' }, -- very subtle EOL symbols
Whitespace = { fg = C.orange }, -- listchars
SpellBad = { fg = C.yellow }, -- spelling mistakes
QuickFixLine = { fg = C.yellow, bg = C.base02 }, -- selected quickfix item
CursorLineNr = { fg = C.yellow, attrs = 'NONE' }, -- current line number
-- Trailing whitespace, from 'ntpeters/vim-better-whitespace':
ExtraWhitespace = { fg = C.orange, bg = C.orange },
-- Indentation guids, from 'lukas-reineke/indent-blankline.nvim':
IndentBlanklineChar = { fg = C.base01, bg = 'NONE' },
-- Virtual colorcolumn, from 'lukas-reineke/virt-column.nvim':
VirtColumn = { fg = C.base02, bg = 'NONE', attrs = 'NONE' },
ColorColumn = { bg = 'NONE' }, -- otherwise this is visible behind VirtColumn
-- Colors for 'kyazdani42/nvim-tree.lua':
NvimTreeSpecialFile = { fg = C.base2 },
NvimTreeIndentMarker = { fg = C.base01 },
NvimTreeGitStaged = { fg = C.green },
NvimTreeGitRenamed = { fg = C.yellow },
NvimTreeGitNew = { fg = C.yellow },
NvimTreeGitDirty = { fg = C.yellow },
NvimTreeGitDeleted = { fg = C.orange },
NvimTreeGitMerge = { fg = C.red },
-- Colors for 'nvim-telescope/telescope.nvim':
TelescopeBorder = { fg = C.base01 },
TelescopeTitle = { fg = C.base1 },
TelescopePromptPrefix = { fg = C.red },
TelescopePromptCounter = { fg = C.base1 },
TelescopeMatching = { fg = C.red },
TelescopeSelection = { fg = C.base2, bg = C.base02, attrs = 'NONE' },
TelescopeMultiSelection = { fg = C.blue },
TelescopeMultiIcon = { fg = C.blue },
}
vim.cmd [[silent! colorscheme solarized]]
local highlight = require'fs.util'.highlight
for group, spec in pairs(overrides) do
highlight(group, spec)
end
end,
}
use 'kyazdani42/nvim-web-devicons'
use { 'nvim-lualine/lualine.nvim',
use {
'nvim-lualine/lualine.nvim',
config = function() require'fs.config.lualine'.config() end,
}
use { 'lukas-reineke/virt-column.nvim',
config = function() require'fs.config.virt-column'.config() end,
use {
'lukas-reineke/virt-column.nvim',
config = function()
require'virt-column'.setup {
char = ''
}
-- show/hide virtual colorcolumn
vim.keymap.set('n', '<leader>sc', function()
if vim.o.colorcolumn == '' then
vim.o.colorcolumn = '+1'
else
vim.o.colorcolumn = ''
end
end)
end,
}
use { 'lukas-reineke/indent-blankline.nvim',
config = function() require'fs.config.indent-blankline'.config() end,
use {
'lukas-reineke/indent-blankline.nvim',
config = function()
require'indent_blankline'.setup {
enabled = false
}
-- show/hide indent guides
vim.keymap.set('n', '<leader>si', '<cmd>:IndentBlanklineToggle<cr>')
end,
}
use { 'junegunn/rainbow_parentheses.vim',
config = function() require'fs.config.rainbow_parentheses'.config() end,
use {
'junegunn/rainbow_parentheses.vim',
config = function()
vim.g['rainbow#pairs'] = { {'(',')'}, {'[',']'}, {'{','}'} }
-- show/hide rainbow parens
vim.keymap.set('n', '<leader>sp', '<cmd>RainbowParentheses!!<cr>')
end,
}
-- Navigation -------------------------------------------------------------
use { 'nvim-telescope/telescope.nvim',
use {
'nvim-telescope/telescope.nvim',
config = function() require'fs.config.telescope'.config() end,
}
use { 'kyazdani42/nvim-tree.lua',
config = function() require'fs.config.nvim-tree'.config() end,
use {
'kyazdani42/nvim-tree.lua',
config = function()
require'nvim-tree'.setup {
git = {
ignore = false, -- don't hide files from .gitignore
},
view = {
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
group_empty = true, -- folders that contain only one folder are grouped
highlight_git = true, -- enable highlight based on git attributes
indent_markers = {
enable = true, -- show indent markers
},
},
}
vim.keymap.set('n', '<c-n>', '<cmd>NvimTreeToggle<cr>')
vim.keymap.set('n', '<leader>n', '<cmd>NvimTreeFindFileToggle<cr>')
end,
}
-- Editing ----------------------------------------------------------------
use { 'ntpeters/vim-better-whitespace',
setup = function() require'fs.config.vim-better-whitespace'.setup() end,
config = function() require'fs.config.vim-better-whitespace'.config() end,
use {
'ntpeters/vim-better-whitespace',
setup = function()
vim.g.better_whitespace_filetypes_blacklist = {
'diff',
'fugitive',
'git',
'gitcommit',
'help',
}
end,
config = function()
-- fix whitespace
vim.keymap.set('n', '<leader>w', '<cmd>StripWhitespace<cr>')
-- show/hide whitespace
vim.keymap.set('n', '<leader>sw', '<cmd>ToggleWhitespace<cr>')
end,
}
use 'godlygeek/tabular'
use 'tpope/vim-commentary'
-- git --------------------------------------------------------------------
use { 'tpope/vim-fugitive',
config = function() require'fs.config.vim-fugitive'.config() end,
use {
'tpope/vim-fugitive',
config = function()
vim.keymap.set('n', '<leader>gg', '<cmd>G<cr>')
vim.keymap.set('n', '<leader>g<space>', ':G ')
end,
}
-- Filetypes --------------------------------------------------------------
use { 'elzr/vim-json',
setup = function() require'fs.config.vim-json'.setup() end,
config = function() require'fs.config.vim-json'.config() end,
use {
'elzr/vim-json',
setup = function()
-- Disable quote concealling.
vim.g.vim_json_syntax_conceal = 0
end,
config = function()
-- Make numbers and booleans stand out.
vim.cmd [[
highlight link jsonBraces Text
highlight link jsonNumber Identifier
highlight link jsonBoolean Identifier
highlight link jsonNull Identifier
]]
end,
}
use { 'plasticboy/vim-markdown',
setup = function() require'fs.config.vim-markdown'.setup() end,
config = function() require'fs.config.vim-markdown'.config() end,
use {
'plasticboy/vim-markdown',
setup = function()
-- Disable concealling on italic, bold, etc.
vim.g.vim_markdown_conceal = 0
-- Disable concealling on code blocks.
vim.g.vim_markdown_conceal_code_blocks = 0
-- Automatic insertion of bullets is buggy, so disable it.
vim.g.vim_markdown_auto_insert_bullets = 0
vim.g.vim_markdown_new_list_item_indent = 0
end,
config = function()
local buf = { buffer = true }
vim.keymap.set('n', '<leader>+', '<cmd>.,.HeaderIncrease<cr>', buf)
vim.keymap.set('n', '<leader>=', '<cmd>.,.HeaderIncrease<cr>', buf)
vim.keymap.set('n', '<leader>-', '<cmd>.,.HeaderDecrease<cr>', buf)
end,
}
use 'keith/swift.vim'
use 'chr4/nginx.vim'
-- Misc -------------------------------------------------------------------
use 'milisims/nvim-luaref'
end)