vim: move plugin configurations to after/plugin/*.lua

This commit is contained in:
Fernando Schauenburg 2022-02-02 00:45:27 +01:00
parent 445e6c4a9d
commit 08a5953fc6
11 changed files with 90 additions and 45 deletions

View file

@ -0,0 +1,4 @@
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

View file

@ -0,0 +1,6 @@
local nmap = require'fs.keymap'.nmap
-- toggle NERDTree
nmap { '<leader>n', '<cmd>NERDTreeToggle<cr>' }

View file

@ -0,0 +1,7 @@
vim.g['rainbow#pairs'] = { {'(',')'}, {'[',']'}, {'{','}'} }
local nmap = require'fs.keymap'.nmap
-- toggle rainbow parens
nmap { '<leader>p', '<cmd>RainbowParentheses!!<cr>' }

View file

@ -0,0 +1,10 @@
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
]])

View file

@ -0,0 +1,6 @@
local nmap = require'fs.keymap'.nmap
-- use fugitive
nmap { '<leader>gg', '<cmd>G<cr>' }
nmap { '<leader>g<space>', '<cmd>G ' }

View file

@ -0,0 +1,11 @@
-- 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
]])

View file

@ -0,0 +1,15 @@
-- 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>' }

View file

@ -0,0 +1,5 @@
local nmap = require'fs.keymap'.nmap
-- fix whitespace
nmap { '<leader>w', '<cmd>FixWhitespace<cr>' }

View file

@ -0,0 +1,24 @@
local M = {}
local extend = function(opts)
return vim.tbl_extend('keep', opts or {}, { noremap = true })
end
M.nmap = function(tbl)
vim.api.nvim_set_keymap('n', tbl[1], tbl[2], extend(tbl[3]))
end
M.imap = function(tbl)
vim.api.nvim_set_keymap('n', tbl[1], tbl[2], extend(tbl[3]))
end
M.buffer_nmap = function(tbl)
vim.api.nvim_buf_set_keymap(0, 'n', tbl[1], tbl[2], extend(tbl[3]))
end
M.buffer_imap = function(tbl)
vim.api.nvim_buf_set_keymap(0, 'i', tbl[1], tbl[2], extend(tbl[3]))
end
return M

View file

@ -62,22 +62,9 @@ register {
-- quickly change background -- quickly change background
M('n', '<leader>bg', [[:let &background = &background ==? 'light' ? 'dark' : 'light'<cr>]]), M('n', '<leader>bg', [[:let &background = &background ==? 'light' ? 'dark' : 'light'<cr>]]),
-- use fugitive
M('n', '<leader>gg', ':G<cr>'),
M('n', '<leader>g<space>', ':G '),
-- disable highlight until next search -- disable highlight until next search
M('n', '<leader>h', ':nohlsearch<cr>'), M('n', '<leader>h', ':nohlsearch<cr>'),
-- toggle NERDTree
M('n', '<leader>n', ':NERDTreeToggle<cr>'),
-- toggle rainbow parens
M('n', '<leader>p', ':RainbowParentheses!!<cr>'),
-- edit init.lua -- edit init.lua
M('n', '<leader>v', ':e $MYVIMRC<cr>'), M('n', '<leader>v', ':e $MYVIMRC<cr>'),
-- fix whitespace
M('n', '<leader>w', ':FixWhitespace<cr>'),
} }

View file

@ -1,62 +1,32 @@
local g = vim.g
local plugins = function(use) local plugins = function(use)
use 'wbthomason/packer.nvim' use 'wbthomason/packer.nvim'
-- Visuals ---------------------------------------------------------------- -- Visuals ----------------------------------------------------------------
use 'altercation/vim-colors-solarized' use 'altercation/vim-colors-solarized'
use { use {
'nvim-lualine/lualine.nvim', 'nvim-lualine/lualine.nvim',
requires = { 'kyazdani42/nvim-web-devicons', opt = true } requires = { 'kyazdani42/nvim-web-devicons', opt = true }
} }
-- Navigation -------------------------------------------------------------
use { 'scrooloose/nerdtree', cmd = 'NERDTreeToggle' } use { 'scrooloose/nerdtree', cmd = 'NERDTreeToggle' }
use 'junegunn/rainbow_parentheses.vim' use 'junegunn/rainbow_parentheses.vim'
vim.g['rainbow#pairs'] = { {'(',')'}, {'[',']'}, {'{','}'} }
use 'ctrlpvim/ctrlp.vim' use 'ctrlpvim/ctrlp.vim'
g.ctrlp_match_window = 'bottom,order:ttb'
g.ctrlp_switch_buffer = 0 -- open files in new buffer
g.ctrlp_show_hidden = 1 -- show hidden files
-- Editing ---------------------------------------------------------------- -- Editing ----------------------------------------------------------------
use 'bronson/vim-trailing-whitespace' use 'bronson/vim-trailing-whitespace'
use 'godlygeek/tabular' use 'godlygeek/tabular'
use 'tpope/vim-commentary' use 'tpope/vim-commentary'
-- git ---------------------------------------------------------------- -- git --------------------------------------------------------------------
use 'tpope/vim-fugitive' use 'tpope/vim-fugitive'
-- Filetypes -------------------------------------------------------------- -- Filetypes --------------------------------------------------------------
use 'elzr/vim-json' use 'elzr/vim-json'
-- Disable quote concealling.
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
]])
use 'plasticboy/vim-markdown' use 'plasticboy/vim-markdown'
g.vim_markdown_conceal_code_blocks = 0
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'
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
]])
vim.cmd([[ vim.cmd([[
silent! colorscheme solarized silent! colorscheme solarized