- plugins: add dial.nvim, remove spellsitter.nvim
- null-ls.nvim: make a list of interesting linters/formatters
- chore: add luacheck
This commit is contained in:
FollieHiyuki 2021-10-19 03:03:00 +07:00
parent 12b240dc21
commit ceb46755cd
No known key found for this signature in database
GPG Key ID: 813CF484F4993419
8 changed files with 166 additions and 26 deletions

View File

@ -0,0 +1,3 @@
std = 'min'
cache = true
new_globals = {'vim'}

View File

@ -8,7 +8,7 @@ local function pandoc_convert(ofiletype)
local ifilename = vim.fn.expand('%:p') local ifilename = vim.fn.expand('%:p')
local ofilename = vim.fn.expand('%:p:r') .. '.' .. ofiletype local ofilename = vim.fn.expand('%:p:r') .. '.' .. ofiletype
local cmd = nil local cmd
if ofiletype == 'pdf' then if ofiletype == 'pdf' then
cmd = string.format('pandoc %s -o %s --pdf-engine=xelatex -V "mainfont:Iosevka Etoile" -V "sansfont:Iosevka Aile" -V "monofont:Iosevka" -V "geometry:margin=1in"', ifilename, ofilename) cmd = string.format('pandoc %s -o %s --pdf-engine=xelatex -V "mainfont:Iosevka Etoile" -V "sansfont:Iosevka Aile" -V "monofont:Iosevka" -V "geometry:margin=1in"', ifilename, ofilename)

View File

@ -138,13 +138,6 @@ function M.treesitter_conf()
vim.opt.foldexpr = 'nvim_treesitter#foldexpr()' vim.opt.foldexpr = 'nvim_treesitter#foldexpr()'
end end
-- function M.spellsitter_conf()
-- require('spellsitter').setup {
-- hl = 'SpellBad',
-- captures = {'comment'}
-- }
-- end
function M.iswap_conf() function M.iswap_conf()
require('iswap').setup { require('iswap').setup {
-- The keys that will be used as a selection, in order -- The keys that will be used as a selection, in order
@ -259,6 +252,60 @@ function M.eft_conf()
vim.api.nvim_set_keymap('x', ';', '<Plug>(eft-repeat)', {}) vim.api.nvim_set_keymap('x', ';', '<Plug>(eft-repeat)', {})
end end
function M.dial_conf()
local dial = require('dial')
-- Custom augends
dial.augends['custom#boolean'] = dial.common.enum_cyclic{
name = 'boolean',
strlist = {'true', 'false'}
}
dial.augends['custom#boolean2'] = dial.common.enum_cyclic{
name = 'boolean',
strlist = {'True', 'False'}
}
dial.config.searchlist.normal = {
'number#decimal#int',
'number#decimal#fixed#zero',
'number#hex',
'number#binary',
'date#[%Y/%m/%d]',
'date#[%m/%d]',
'date#[%Y-%m-%d]',
'date#[%H:%M:%S]',
'date#[%H:%M]',
'date#[%jA]',
'color#hex',
'markup#markdown#header',
'custom#boolean',
'custom#boolean2'
}
dial.config.searchlist.visual = {
'number#decimal#int',
'number#decimal#fixed#zero',
'number#hex',
'number#binary',
'date#[%Y/%m/%d]',
'date#[%m/%d]',
'date#[%Y-%m-%d]',
'date#[%H:%M:%S]',
'date#[%H:%M]',
'date#[%jA]',
'char#alph#small#word',
'char#alph#capital#word',
'color#hex'
}
-- Mappings
vim.api.nvim_set_keymap('n', '<C-a>', '<Plug>(dial-increment)', {})
vim.api.nvim_set_keymap('v', '<C-a>', '<Plug>(dial-increment)', {})
vim.api.nvim_set_keymap('n', '<C-x>', '<Plug>(dial-decrement)', {})
vim.api.nvim_set_keymap('v', '<C-x>', '<Plug>(dial-decrement)', {})
vim.api.nvim_set_keymap('v', 'g<C-a>', '<Plug>(dial-increment-additional)', {})
vim.api.nvim_set_keymap('v', 'g<C-x>', '<Plug>(dial-decrement-additional)', {})
end
function M.comment_conf() function M.comment_conf()
require('nvim_comment').setup {comment_empty = false} require('nvim_comment').setup {comment_empty = false}
end end

View File

@ -305,16 +305,97 @@ function M.lsp_conf()
-- Register sources -- Register sources
null_ls.config { null_ls.config {
sources = { sources = {
-- Formatters -- Formatters --
null_ls.builtins.formatting.stylua.with { -- null_ls.builtins.formatting.black.with {
condition = function(utils) -- command = 'black'
return utils.root_has_file('stylua.toml') -- },
end
},
null_ls.builtins.formatting.clang_format.with { null_ls.builtins.formatting.clang_format.with {
filetypes = {'c', 'cpp'} filetypes = {'c', 'cpp'}
} },
-- Linters -- null_ls.builtins.formatting.cmake_format.with {
-- command = 'cmake-format'
-- },
-- null_ls.builtins.formatting.eslint.with {
-- condition = function(utils)
-- return utils.root_has_file('.eslintrc.js')
-- end,
-- command = 'eslint'
-- },
null_ls.builtins.formatting.fish_indent,
-- null_ls.builtins.formatting.fixjson.with {
-- command = 'fixjson'
-- },
-- null_ls.builtins.formatting.fnlfmt.with {
-- command = 'fnlfmt'
-- },
-- null_ls.builtins.formatting.goimports.with {
-- command = 'goimports'
-- },
-- null_ls.builtins.formatting.gofmt.with {
-- command = 'gofmt'
-- },
-- null_ls.builtins.formatting.isort.with {
-- command = 'isort'
-- },
-- null_ls.builtins.formatting.nixfmt.with {
-- command = 'nixfmt'
-- },
-- null_ls.builtins.formatting.prettier.with {
-- command = 'prettier'
-- },
-- null_ls.builtins.formatting.rustfmt.with {
-- command = 'rustfmt'
-- },
-- null_ls.builtins.formatting.rustywind.with {
-- command = 'rustywind'
-- },
-- null_ls.builtins.formatting.shfmt,
-- null_ls.builtins.formatting.stylua.with {
-- condition = function(utils)
-- return utils.root_has_file('stylua.toml')
-- end,
-- command = 'stylua'
-- },
-- null_ls.builtins.formatting.uncrustify.with {
-- command = 'uncrustify'
-- },
-- null_ls.builtins.formatting.yapf.with {
-- command = 'yapf'
-- },
-- null_ls.builtins.formatting.autopep8.with {
-- command = 'autopep8'
-- },
-- null_ls.builtins.formatting.stylelint.with {
-- command = 'stylelint'
-- },
-- Linters --
null_ls.builtins.diagnostics.shellcheck,
-- null_ls.builtins.diagnostics.codespell.with {
-- command = 'codespell'
-- },
-- null_ls.builtins.diagnostics.eslint.with {
-- command = 'eslint'
-- },
-- null_ls.builtins.diagnostics.flake8.with {
-- command = 'flake8'
-- },
null_ls.builtins.diagnostics.hadolint.with {
command = vim.fn.stdpath('config') .. '/scripts/hadolint',
args = {'$FILENAME'}
},
null_ls.builtins.diagnostics.luacheck,
-- null_ls.builtins.diagnostics.cppcheck,
-- null_ls.builtins.diagnostics.write_good,
-- null_ls.builtins.diagnostics.proselint,
-- null_ls.builtins.diagnostics.markdownlint,
-- null_ls.builtins.diagnostics.pylint,
-- null_ls.builtins.diagnostics.vale,
-- null_ls.builtins.diagnostics.misspell,
-- null_ls.builtins.diagnostics.vint,
-- null_ls.builtins.diagnostics.stylelint,
-- Special --
null_ls.builtins.hover.dictionary, -- get word definition from dictionaryapi.dev
-- null_ls.builtins.code_actions.gitsigns
} }
} }

View File

@ -2,7 +2,6 @@ local M = {}
function M.dashboard_conf() function M.dashboard_conf()
local dashboard = require('alpha.themes.dashboard') local dashboard = require('alpha.themes.dashboard')
local button = dashboard.button
dashboard.section.header = { dashboard.section.header = {
type = 'text', type = 'text',
@ -32,7 +31,7 @@ function M.dashboard_conf()
} }
} }
button = function(sc, txt, keybind, keybind_opts) local button = function(sc, txt, keybind, keybind_opts)
local sc_ = sc:gsub('%s', ''):gsub('SPC', '<leader>') local sc_ = sc:gsub('%s', ''):gsub('SPC', '<leader>')
local opts = { local opts = {

View File

@ -78,11 +78,6 @@ return packer.startup(function(use)
use {'nvim-treesitter/playground', after = 'nvim-treesitter'} use {'nvim-treesitter/playground', after = 'nvim-treesitter'}
use {'romgrk/nvim-treesitter-context', after = 'nvim-treesitter'} use {'romgrk/nvim-treesitter-context', after = 'nvim-treesitter'}
use {'nvim-treesitter/nvim-treesitter-textobjects', after = 'nvim-treesitter'} use {'nvim-treesitter/nvim-treesitter-textobjects', after = 'nvim-treesitter'}
-- use {
-- 'lewis6991/spellsitter.nvim',
-- event = {'BufRead', 'BufNew', 'BufNewFile'},
-- config = editor.spellsitter_conf
-- }
use { use {
'lukas-reineke/indent-blankline.nvim', 'lukas-reineke/indent-blankline.nvim',
after = 'nvim-treesitter', after = 'nvim-treesitter',
@ -137,6 +132,14 @@ return packer.startup(function(use)
}, },
config = editor.eft_conf config = editor.eft_conf
} }
use {
'monaqa/dial.nvim',
keys = {
{'n', '<C-a>'}, {'v', '<C-a>'}, {'v', 'g<C-a>'},
{'n', '<C-x>'}, {'v', '<C-x>'}, {'v', 'g<C-x>'}
},
config = editor.dial_conf
}
use {'junegunn/vim-easy-align', cmd = 'EasyAlign'} use {'junegunn/vim-easy-align', cmd = 'EasyAlign'}
use { use {
'terrortylor/nvim-comment', 'terrortylor/nvim-comment',
@ -433,9 +436,9 @@ return packer.startup(function(use)
} }
use {'dstein64/vim-startuptime', cmd = 'StartupTime'} -- Just for benchmarking use {'dstein64/vim-startuptime', cmd = 'StartupTime'} -- Just for benchmarking
-- TODO: dial.nvim, rust-tools.nvim, crates.nvim, go.nvim, clojure-vim/*, -- TODO: rust-tools.nvim, crates.nvim, go.nvim, clojure-vim/*, nvim-bqf,
-- nvim-bqf, nvim-comment-frame, nvim-revJ.lua, nvim-remote-containers, -- nvim-comment-frame, nvim-revJ.lua, nvim-remote-containers, tex.nvim,
-- tex.nvim, telescope-lsp-handlers.nvim, telescope-dap.nvim -- telescope-lsp-handlers.nvim, telescope-dap.nvim
-- Install plugins if missing -- Install plugins if missing
packer.install() packer.install()

View File

@ -0,0 +1,4 @@
#!/bin/sh
podman run --rm -i docker.io/hadolint/hadolint \
hadolint --no-fail --format=json - < "$@"

View File

@ -0,0 +1,3 @@
#!/bin/sh
podman pull docker.io/hadolint/hadolint:latest