vim: better control over plugin configurations
This commit is contained in:
parent
fd1724c708
commit
001d800afd
17 changed files with 158 additions and 95 deletions
|
@ -1,4 +0,0 @@
|
||||||
vim.g.ctrlp_match_window = 'bottom,order:ttb'
|
|
||||||
vim.g.ctrlp_switch_buffer = 0 -- open files in new buffer
|
|
||||||
vim.g.ctrlp_show_hidden = 1 -- show hidden files
|
|
||||||
|
|
|
@ -1,7 +0,0 @@
|
||||||
vim.g['rainbow#pairs'] = { {'(',')'}, {'[',']'}, {'{','}'} }
|
|
||||||
|
|
||||||
local nmap = require'fs.keymap'.nmap
|
|
||||||
|
|
||||||
-- toggle rainbow parens
|
|
||||||
nmap { '<leader>p', '<cmd>RainbowParentheses!!<cr>' }
|
|
||||||
|
|
|
@ -1,10 +0,0 @@
|
||||||
vim.cmd([[
|
|
||||||
highlight link srecStart Comment
|
|
||||||
highlight link srecType Comment
|
|
||||||
highlight link srecLength WarningMsg
|
|
||||||
highlight link srec16BitAddress Constant
|
|
||||||
highlight link srec24BitAddress Constant
|
|
||||||
highlight link srec32BitAddress Constant
|
|
||||||
highlight link srecChecksum Type
|
|
||||||
]])
|
|
||||||
|
|
|
@ -1,6 +0,0 @@
|
||||||
local nmap = require'fs.keymap'.nmap
|
|
||||||
|
|
||||||
-- use fugitive
|
|
||||||
nmap { '<leader>gg', '<cmd>G<cr>' }
|
|
||||||
nmap { '<leader>g<space>', '<cmd>G ' }
|
|
||||||
|
|
|
@ -1,11 +0,0 @@
|
||||||
-- Disable quote concealling.
|
|
||||||
vim.g.vim_json_syntax_conceal = 0
|
|
||||||
|
|
||||||
-- Make numbers and booleans stand out.
|
|
||||||
vim.cmd([[
|
|
||||||
highlight link jsonBraces Text
|
|
||||||
highlight link jsonNumber Identifier
|
|
||||||
highlight link jsonBoolean Identifier
|
|
||||||
highlight link jsonNull Identifier
|
|
||||||
]])
|
|
||||||
|
|
|
@ -1,15 +0,0 @@
|
||||||
-- 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
|
|
||||||
|
|
||||||
local nmap = require'fs.keymap'.buffer_nmap
|
|
||||||
nmap { '<leader>+', '<cmd>.,.HeaderIncrease<cr>' }
|
|
||||||
nmap { '<leader>=', '<cmd>.,.HeaderIncrease<cr>' }
|
|
||||||
nmap { '<leader>-', '<cmd>.,.HeaderDecrease<cr>' }
|
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
local nmap = require'fs.keymap'.nmap
|
|
||||||
|
|
||||||
-- fix whitespace
|
|
||||||
nmap { '<leader>w', '<cmd>FixWhitespace<cr>' }
|
|
||||||
|
|
8
config/nvim/lua/fs/config/ctrlp.lua
Normal file
8
config/nvim/lua/fs/config/ctrlp.lua
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
local setup = function()
|
||||||
|
vim.g.ctrlp_match_window = 'bottom,order:ttb'
|
||||||
|
vim.g.ctrlp_switch_buffer = 0 -- open files in new buffer
|
||||||
|
vim.g.ctrlp_show_hidden = 1 -- show hidden files
|
||||||
|
end
|
||||||
|
|
||||||
|
return { setup = setup }
|
||||||
|
|
|
@ -12,7 +12,7 @@ local Table = {
|
||||||
|
|
||||||
local colors = require'fs.colors'.colors()
|
local colors = require'fs.colors'.colors()
|
||||||
|
|
||||||
local function theme()
|
local theme = (function()
|
||||||
local active = {
|
local active = {
|
||||||
a = Table:new { fg = colors.base03, bg = colors.base1 },
|
a = Table:new { fg = colors.base03, bg = colors.base1 },
|
||||||
b = Table:new { fg = colors.base03, bg = colors.base00 },
|
b = Table:new { fg = colors.base03, bg = colors.base00 },
|
||||||
|
@ -46,7 +46,7 @@ local function theme()
|
||||||
c = inactive.c,
|
c = inactive.c,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
end
|
end)()
|
||||||
|
|
||||||
local parts = {
|
local parts = {
|
||||||
paste = {
|
paste = {
|
||||||
|
@ -92,13 +92,13 @@ local sections = Table:new {
|
||||||
lualine_z = { parts.progress },
|
lualine_z = { parts.progress },
|
||||||
}
|
}
|
||||||
|
|
||||||
local function setup()
|
local config = function()
|
||||||
require('lualine').setup {
|
require('lualine').setup {
|
||||||
options = {
|
options = {
|
||||||
icons_enabled = true,
|
icons_enabled = true,
|
||||||
component_separators = { left = '', right = '' },
|
component_separators = { left = '', right = '' },
|
||||||
section_separators = { left = '', right = '' },
|
section_separators = { left = '', right = '' },
|
||||||
theme = theme(),
|
theme = theme,
|
||||||
},
|
},
|
||||||
|
|
||||||
sections = sections:override {
|
sections = sections:override {
|
||||||
|
@ -111,5 +111,4 @@ local function setup()
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
setup()
|
return { config = config }
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
local nmap = require'fs.keymap'.nmap
|
local nmap = require'fs.keymap'.nmap
|
||||||
|
local colors = require'fs.colors'.colors()
|
||||||
nmap { '<c-n>', '<cmd>NvimTreeToggle<cr>' }
|
|
||||||
nmap { '<leader>n', '<cmd>NvimTreeFindFileToggle<cr>' }
|
|
||||||
|
|
||||||
-- helper to set vim.g options that will be moved to setup() later
|
-- helper to set vim.g options that will be moved to setup() later
|
||||||
local function set_globals(tbl)
|
local function set_globals(tbl)
|
||||||
|
@ -11,7 +9,15 @@ local function set_globals(tbl)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
set_globals {
|
local function highlight(group, color)
|
||||||
|
if vim.opt.termguicolors:get() then
|
||||||
|
vim.cmd(vim.fn.printf('highlight %s guifg=%s', group, color))
|
||||||
|
else
|
||||||
|
vim.cmd(vim.fn.printf('highlight %s ctermfg=%d', group, color))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local global_opts ={
|
||||||
add_trailing = 1, -- add trailing / to folders
|
add_trailing = 1, -- add trailing / to folders
|
||||||
group_empty = 1, -- folders that contain only one folder are grouped
|
group_empty = 1, -- folders that contain only one folder are grouped
|
||||||
indent_markers = 1, -- show indent markers
|
indent_markers = 1, -- show indent markers
|
||||||
|
@ -23,9 +29,8 @@ set_globals {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
require'nvim-tree'.setup {
|
local nvim_tree_config = {
|
||||||
auto_close = true, -- close vim if tree is the last window
|
auto_close = true, -- close vim if tree is the last window
|
||||||
update_cwd = true, -- refresh tree on DirChanged
|
|
||||||
|
|
||||||
git = {
|
git = {
|
||||||
ignore = false, -- don't hide files from .gitignore
|
ignore = false, -- don't hide files from .gitignore
|
||||||
|
@ -41,23 +46,21 @@ require'nvim-tree'.setup {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
local config = function()
|
||||||
|
require'nvim-tree'.setup(nvim_tree_config)
|
||||||
|
|
||||||
local function highlight(group, color)
|
highlight('NvimTreeSpecialFile' , colors.base2 )
|
||||||
if vim.opt.termguicolors:get() then
|
highlight('NvimTreeIndentMarker' , colors.base01 )
|
||||||
vim.cmd(vim.fn.printf('highlight %s guifg=%s', group, color))
|
highlight('NvimTreeGitStaged' , colors.green )
|
||||||
else
|
highlight('NvimTreeGitRenamed' , colors.yellow )
|
||||||
vim.cmd(vim.fn.printf('highlight %s ctermfg=%d', group, color))
|
highlight('NvimTreeGitNew' , colors.yellow )
|
||||||
end
|
highlight('NvimTreeGitDirty' , colors.yellow )
|
||||||
|
highlight('NvimTreeGitDeleted' , colors.orange )
|
||||||
|
highlight('NvimTreeGitMerge' , colors.red )
|
||||||
|
|
||||||
|
nmap { '<c-n>', '<cmd>NvimTreeToggle<cr>' }
|
||||||
|
nmap { '<leader>n', '<cmd>NvimTreeFindFileToggle<cr>' }
|
||||||
end
|
end
|
||||||
|
|
||||||
local C = require'fs.colors'.colors()
|
return { config = config }
|
||||||
|
|
||||||
highlight('NvimTreeSpecialFile' , C.base2 )
|
|
||||||
highlight('NvimTreeIndentMarker' , C.base01 )
|
|
||||||
highlight('NvimTreeGitStaged' , C.green )
|
|
||||||
highlight('NvimTreeGitRenamed' , C.yellow )
|
|
||||||
highlight('NvimTreeGitNew' , C.yellow )
|
|
||||||
highlight('NvimTreeGitDirty' , C.yellow )
|
|
||||||
highlight('NvimTreeGitDeleted' , C.orange )
|
|
||||||
highlight('NvimTreeGitMerge' , C.red )
|
|
||||||
|
|
11
config/nvim/lua/fs/config/rainbow_parentheses.lua
Normal file
11
config/nvim/lua/fs/config/rainbow_parentheses.lua
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
local nmap = require'fs.keymap'.nmap
|
||||||
|
|
||||||
|
local config = function()
|
||||||
|
vim.g['rainbow#pairs'] = { {'(',')'}, {'[',']'}, {'{','}'} }
|
||||||
|
|
||||||
|
-- toggle rainbow parens
|
||||||
|
nmap { '<leader>p', '<cmd>RainbowParentheses!!<cr>' }
|
||||||
|
end
|
||||||
|
|
||||||
|
return { config = config }
|
||||||
|
|
14
config/nvim/lua/fs/config/srec.lua
Normal file
14
config/nvim/lua/fs/config/srec.lua
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
local config = function()
|
||||||
|
vim.cmd[[
|
||||||
|
highlight link srecStart Comment
|
||||||
|
highlight link srecType Comment
|
||||||
|
highlight link srecLength WarningMsg
|
||||||
|
highlight link srec16BitAddress Constant
|
||||||
|
highlight link srec24BitAddress Constant
|
||||||
|
highlight link srec32BitAddress Constant
|
||||||
|
highlight link srecChecksum Type
|
||||||
|
]]
|
||||||
|
end
|
||||||
|
|
||||||
|
return { config = config }
|
||||||
|
|
9
config/nvim/lua/fs/config/vim-fugitive.lua
Normal file
9
config/nvim/lua/fs/config/vim-fugitive.lua
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
local nmap = require'fs.keymap'.nmap
|
||||||
|
|
||||||
|
local config = function()
|
||||||
|
nmap { '<leader>gg', '<cmd>G<cr>' }
|
||||||
|
nmap { '<leader>g<space>', '<cmd>G ' }
|
||||||
|
end
|
||||||
|
|
||||||
|
return { config = config }
|
||||||
|
|
17
config/nvim/lua/fs/config/vim-json.lua
Normal file
17
config/nvim/lua/fs/config/vim-json.lua
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
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 }
|
||||||
|
|
22
config/nvim/lua/fs/config/vim-markdown.lua
Normal file
22
config/nvim/lua/fs/config/vim-markdown.lua
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
local nmap = require'fs.keymap'.buffer_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>' }
|
||||||
|
nmap { '<leader>=', '<cmd>.,.HeaderIncrease<cr>' }
|
||||||
|
nmap { '<leader>-', '<cmd>.,.HeaderDecrease<cr>' }
|
||||||
|
end
|
||||||
|
|
||||||
|
return { setup = setup, config = config }
|
||||||
|
|
9
config/nvim/lua/fs/config/vim-trailing-whitespace.lua
Normal file
9
config/nvim/lua/fs/config/vim-trailing-whitespace.lua
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
local nmap = require'fs.keymap'.nmap
|
||||||
|
|
||||||
|
local config = function()
|
||||||
|
-- fix whitespace
|
||||||
|
nmap { '<leader>w', '<cmd>FixWhitespace<cr>' }
|
||||||
|
end
|
||||||
|
|
||||||
|
return { config = config }
|
||||||
|
|
|
@ -4,27 +4,56 @@ local plugins = function(use)
|
||||||
-- Visuals ----------------------------------------------------------------
|
-- Visuals ----------------------------------------------------------------
|
||||||
use 'altercation/vim-colors-solarized'
|
use 'altercation/vim-colors-solarized'
|
||||||
use 'kyazdani42/nvim-web-devicons'
|
use 'kyazdani42/nvim-web-devicons'
|
||||||
use 'nvim-lualine/lualine.nvim'
|
use {
|
||||||
|
'nvim-lualine/lualine.nvim',
|
||||||
|
config = [[require'fs.config.lualine'.config()]]
|
||||||
|
}
|
||||||
|
|
||||||
-- Navigation -------------------------------------------------------------
|
-- Navigation -------------------------------------------------------------
|
||||||
use 'kyazdani42/nvim-tree.lua'
|
use {
|
||||||
use 'junegunn/rainbow_parentheses.vim'
|
'kyazdani42/nvim-tree.lua',
|
||||||
use 'ctrlpvim/ctrlp.vim'
|
config = [[require'fs.config.nvim-tree'.config()]],
|
||||||
|
}
|
||||||
|
use {
|
||||||
|
'junegunn/rainbow_parentheses.vim',
|
||||||
|
config = [[require'fs.config.rainbow_parentheses'.config()]],
|
||||||
|
}
|
||||||
|
use {
|
||||||
|
'ctrlpvim/ctrlp.vim',
|
||||||
|
setup = [[require'fs.config.ctrlp'.setup()]],
|
||||||
|
}
|
||||||
|
|
||||||
-- Editing ----------------------------------------------------------------
|
-- Editing ----------------------------------------------------------------
|
||||||
use 'bronson/vim-trailing-whitespace'
|
use {
|
||||||
|
'bronson/vim-trailing-whitespace',
|
||||||
|
config = [[require'fs.config.vim-trailing-whitespace'.config()]],
|
||||||
|
}
|
||||||
use 'godlygeek/tabular'
|
use 'godlygeek/tabular'
|
||||||
use 'tpope/vim-commentary'
|
use 'tpope/vim-commentary'
|
||||||
|
|
||||||
-- git --------------------------------------------------------------------
|
-- git --------------------------------------------------------------------
|
||||||
use 'tpope/vim-fugitive'
|
use {
|
||||||
|
'tpope/vim-fugitive',
|
||||||
|
config = [[require'fs.config.vim-fugitive'.config()]],
|
||||||
|
}
|
||||||
|
|
||||||
-- Filetypes --------------------------------------------------------------
|
-- Filetypes --------------------------------------------------------------
|
||||||
use 'elzr/vim-json'
|
use {
|
||||||
use 'plasticboy/vim-markdown'
|
'elzr/vim-json',
|
||||||
|
setup = [[require'fs.config.vim-json'.setup()]],
|
||||||
|
config = [[require'fs.config.vim-json'.config()]],
|
||||||
|
}
|
||||||
|
use {
|
||||||
|
'plasticboy/vim-markdown',
|
||||||
|
setup = [[require'fs.config.vim-markdown'.setup()]],
|
||||||
|
config = [[require'fs.config.vim-markdown'.config()]],
|
||||||
|
}
|
||||||
use 'keith/swift.vim'
|
use 'keith/swift.vim'
|
||||||
use 'chr4/nginx.vim'
|
use 'chr4/nginx.vim'
|
||||||
use 'vim-scripts/srec.vim'
|
use {
|
||||||
|
'vim-scripts/srec.vim',
|
||||||
|
config = [[require'fs.config.srec'.config()]],
|
||||||
|
}
|
||||||
|
|
||||||
vim.cmd([[
|
vim.cmd([[
|
||||||
silent! colorscheme solarized
|
silent! colorscheme solarized
|
||||||
|
|
Loading…
Add table
Reference in a new issue