nvim: update config

- replace bracey.vim with web-tools.nvim
- lspconfig: add texlab, and experimental ltex-ls
- sqls.nvim: setup() is deprecated
- null-ls.nvim: remove duplicated sources in status line
- remove cmp-latex-symbols (texlab is enough)
This commit is contained in:
Hoang Nguyen 2022-01-07 22:04:22 +07:00
parent f1eb472c21
commit b6888be613
No known key found for this signature in database
GPG Key ID: 813CF484F4993419
17 changed files with 82 additions and 33 deletions

View File

@ -80,7 +80,7 @@
syntax ; tasing you for every semicolon you forget
(spell ; tasing you for misspelling misspelling
+everywhere
+hunspell
+aspell
+flyspell)
grammar ; tasing grammar mistake every you make

View File

@ -66,8 +66,8 @@
evil-split-window-below t)
;; Emoji
(after! emojify
(setq emojify-display-style 'unicode))
;; (after! emojify
;; (setq emojify-display-style 'unicode))
{% if theme == 'nord' %}
(setq doom-theme 'doom-nord)

View File

@ -53,7 +53,7 @@ local augroups = {
keymaps = {
{'BufReadPre', '*', 'lua require("keymap").whichkeyLocal()'},
{'FileType', 'org', 'lua require("keymap").whichkeyOrg()'},
{'FileType', 'html', 'lua require("keymap").whichkeyHtml()'},
{'FileType', 'html,css', 'lua require("keymap").whichkeyHtml()'},
{'FileType', 'markdown', 'lua require("keymap").whichkeyMarkdown()'}
},
plugins = {

View File

@ -249,7 +249,7 @@ M.markdown_map = {
}
M.html_map = {
p = {':Bracey<CR>', 'Preview html'}
p = {':BrowserPreview<CR>', 'Preview with browser-sync'}
}
M.org_map = {

View File

@ -81,7 +81,6 @@ function M.cmp()
conjure = '[CJ]',
orgmode = '[ORG]',
-- cmp_tabnine = '[TN]',
latex_symbols = '[TEX]',
-- dictionary = '[DICT]',
path = '[PATH]',
buffer = '[BUF]',
@ -149,7 +148,6 @@ function M.cmp()
{name = 'conjure'},
{name = 'orgmode'},
-- {name = 'cmp_tabnine'},
{name = 'latex_symbols'},
-- {name = 'dictionary', keyword_length = 2},
{name = 'path'},
{name = 'buffer'},

View File

@ -27,7 +27,6 @@ M['hrsh7th/cmp-nvim-lsp'] = {after = {'nvim-cmp', 'nvim-lspconfig'}}
-- run = './install.sh',
-- config = conf.tabnine
-- }
M['kdheepak/cmp-latex-symbols'] = {after = 'nvim-cmp'}
M['PaterJason/cmp-conjure'] = {after = {'conjure', 'nvim-cmp'}}
M['windwp/nvim-autopairs'] = {after = 'nvim-cmp', config = conf.autopairs}

View File

@ -12,7 +12,7 @@ M['norcalli/nvim-colorizer.lua'] = {
M['Olical/conjure'] = { -- TODO: config, check out fennel-repl.nvim
ft = {'clojure', 'fennel', 'scheme', 'hy', 'janet', 'racket'}
}
M['nvim-orgmode/orgmode.nvim'] = { -- TODO: highlights, check out neorg
M['nvim-orgmode/orgmode'] = { -- TODO: highlights, check out neorg
ft = 'org',
-- requires = {{
-- 'akinsho/org-bullets.nvim',

View File

@ -69,12 +69,6 @@ function M.null_ls()
require('modules.lsp.null_ls')
end
function M.sqls()
require('sqls').setup {
picker = 'telescope'
}
end
function M.trouble()
require('trouble').setup {
position = 'bottom',

View File

@ -304,8 +304,40 @@ lspconf.rust_analyzer.setup {
}
}
lspconf.texlab.setup {
on_attach = on_attach,
capabilities = capabilities,
settings = {
texlab = {
build = {
onSave = true,
forwardSearchAfter = true
},
forwardSearch = {
executable = 'zathura',
args = {'--synctex-forward', '%l:1:%f', '%p'}
}
}
}
}
-- lspconf.ltex.setup {
-- cmd = {servers_path .. '/ltex-ls/bin/ltex-ls'},
-- on_attach = on_attach,
-- capabilities = capabilities,
-- settings = {
-- ltex = {completionEnabled = true}
-- }
-- }
-- lspconf.sqls.setup {
-- cmd = {servers_path .. '/sqls/sqls'},
-- on_attach = function(client, bufnr)
-- require('sqls').on_attach(client, bufnr)
-- end
-- }
local servers = {
sqls = {servers_path .. '/sqls/sqls'},
cmake = {servers_path .. '/cmake/venv/bin/cmake-language-server'},
-- bashls = {servers_path .. '/bashls/node_modules/.bin/bash-language-server', 'start'},
-- dockerls = {servers_path .. '/dockerls/node_modules/.bin/docker-langserver', '--stdio'},

View File

@ -10,6 +10,7 @@ local sources = {
command = linters_path .. '/cmake_format/venv/bin/cmake-format'
},
null_ls.builtins.formatting.fish_indent,
-- null_ls.builtins.formatting.latexindent,
-- null_ls.builtins.formatting.prettier.with {
-- command = linters_path .. '/prettier/node_modules/.bin/prettier'
-- },
@ -45,9 +46,9 @@ local sources = {
filetypes = {'markdown', 'org', 'asciidoc', 'org'},
command = linters_path .. '/write_good/node_modules/.bin/write-good'
},
null_ls.builtins.diagnostics.markdownlint.with {
command = linters_path .. '/markdownlint/node_modules/.bin/markdownlint'
},
-- null_ls.builtins.diagnostics.markdownlint.with {
-- command = linters_path .. '/markdownlint/node_modules/.bin/markdownlint'
-- },
-- null_ls.builtins.diagnostics.proselint.with {
-- filetypes = {'org', 'tex', 'markdown', 'asciidoc'},
-- command = linters_path .. '/proselint/venv/bin/proselint',

View File

@ -3,7 +3,12 @@ local conf = require('modules.lsp.config')
M['neovim/nvim-lspconfig'] = {
event = 'BufReadPre',
wants = {'lsp_signature.nvim', 'lspsaga.nvim', 'SchemaStore.nvim'},
wants = {
'lsp_signature.nvim',
'lspsaga.nvim',
-- 'sqls.nvim',
'SchemaStore.nvim'
},
requires = {
{
'ray-x/lsp_signature.nvim',
@ -15,6 +20,7 @@ M['neovim/nvim-lspconfig'] = {
config = conf.saga,
opt = true
},
{'nanotee/sqls.nvim', opt = true},
{'b0o/SchemaStore.nvim', opt = true}
},
config = conf.lsp
@ -24,11 +30,6 @@ M['jose-elias-alvarez/null-ls.nvim'] = {
after = 'nvim-lspconfig',
config = conf.null_ls
}
M['nanotee/sqls.nvim'] = {
ft = {'sql', 'mysql'},
wants = 'nvim-lspconfig',
config = conf.sqls
}
M['folke/trouble.nvim'] = {
cmd = {'Trouble', 'TroubleToggle', 'TroubleRefresh'},
config = conf.trouble

View File

@ -129,6 +129,15 @@ function M.markdown_preview()
-- vim.g.mkdp_echo_preview_url = 1
end
function M.web_tools()
require('web-tools').setup {
keymaps = {
rename = '',
repeat_rename = '.'
}
}
end
function M.spectre()
require('spectre').setup()
require('keymap.plugmap').spectre()

View File

@ -50,11 +50,11 @@ M['iamcco/markdown-preview.nvim'] = { -- TODO: check out kat0h/bufpreview.vim
ft = {'markdown', 'rmd'},
config = conf.markdown_preview
}
M['turbio/bracey.vim'] = {
run = 'npm install --prefix server',
cmd = 'Bracey'
M['ray-x/web-tools.nvim'] = {
cmd = {'BrowserSync', 'BrowserPreview', 'TagRename'},
config = conf.web_tools
}
M['windwp/nvim-spectre'] = {
M['nvim-pack/nvim-spectre'] = {
keys = '<leader>p',
wants = 'plenary.nvim',
config = conf.spectre

View File

@ -37,10 +37,19 @@ local function lsp_active_clients()
end
-- null-ls sources
local sources = {}
local null_ls_sources = require('null-ls.sources')
local ft = vim.api.nvim_buf_get_option(0, 'ft')
for _, source in ipairs(null_ls_sources.get_available(ft)) do
table.insert(clients, source.name)
table.insert(sources, source.name)
end
-- filter duplicated entries
local sources_post = {}
for i = 1, #sources do
if not sources_post[sources[i]] then
table.insert(clients, sources[i])
sources_post[sources[i]] = true
end
end
return table.concat(clients, ', ')

View File

@ -1,6 +1,6 @@
-- TODO: rust-tools.nvim, crates.nvim, go.nvim, clojure-vim/*, nvim-comment-frame,
-- nvim-revJ.lua, nvim-remote-containers, tex.nvim, telescope-dap.nvim, fcitx.nvim,
-- pandoc.nvim, qf_helper.nvim, tldr.nvim, refactoring.nvim
-- nvim-revJ.lua, nvim-remote-containers, telescope-dap.nvim, fcitx.nvim,
-- pandoc.nvim, qf_helper.nvim, tldr.nvim, refactoring.nvim, pretty-fold.nvim
local fn, cmd = vim.fn, vim.api.nvim_command
local compile_path = fn.stdpath('data') .. '/site/plugin/packer_compiled.lua'
local modules_dir = fn.stdpath('config') .. '/lua/modules'

View File

@ -0,0 +1,3 @@
#!/bin/sh
podman run --rm -i localhost/ltex-ls "$@"

View File

@ -21,6 +21,7 @@ function M.disable_default_plugins()
g.loaded_netrwSettings = 1
g.loaded_netrwFileHandlers = 1
g.did_load_filetypes = 1 -- use filetype.nvim instead
g.loaded_python_provider = 0 -- disable python2 support
end
function M.load_options()
@ -33,6 +34,8 @@ function M.load_options()
-- Python path
g.python3_host_prog = '/usr/bin/python3'
opt.pyxversion = 3
-- TeX flavor
g.tex_flavor = 'latex'
-- General settings
opt.termguicolors = true
@ -78,7 +81,7 @@ function M.load_options()
opt.grepprg = 'rg --hidden --vimgrep --smart-case --'
opt.diffopt = 'filler,iwhite,internal,algorithm:patience'
-- opt.spell = true
opt.dictionary = {'/usr/share/dict/american-english'}
-- opt.dictionary = {'/usr/share/dict/american-english'}
-- Transparency
opt.pumblend = 5