vim update

This commit is contained in:
h
2026-06-13 21:57:40 -04:00
parent bcc5e8ce98
commit f44e1cdc22
16 changed files with 2415 additions and 58 deletions
+286
View File
@@ -0,0 +1,286 @@
local lspconfig = vim.lsp.config
local util = vim.lsp.config.util
local lspstatus = require('lsp-status')
lspstatus.register_progress()
local function find_repo_root(names)
local config = names.configfiles
local function matcher(filename, _bufnr)
local gitroot = util.root_pattern('.git')(filename)
if gitroot then
for _, file in ipairs(config) do
if util.path.is_file(util.path.join(gitroot, file)) then
return gitroot
end
end
end
return util.root_pattern(unpack(config))(filename)
end
return matcher
end
local lsp_confs = {
lua_ls = {
settings = {
Lua = {
-- Settings for working with nvim (copied from https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#sumneko_lua)
runtime = {
version = 'LuaJIT',
path = runtime_path,
},
diagnostics = {
globals = { 'vim' },
},
workspace = {
library = vim.api.nvim_get_runtime_file("", true),
},
},
},
},
solidity_ls = {},
coq_lsp = {},
racket_langserver = {},
ocamllsp = {},
rust_analyzer = {
cmd_env = {
CARGO_TARGET_DIR = "/tmp/rust-analyzer"
},
settings = {
["rust-analyzer"] = {
checkOnSave = true,
-- checkOnSave = {
-- command = "clippy",
-- allTargets = false,
-- },
cargo = {
features = "all",
},
},
},
},
ccls = {},
jedi_language_server = {
filetypes = { "python", "sage.python" },
},
gopls = {},
dartls = {},
ts_ls = {
root_dir = find_repo_root({
configfiles = { "tsconfig.json", "jsconfig.json", "package.json" }
}),
},
denols = {
root_dir = find_repo_root({
configfiles = { "deno.json", "deno.jsonc" }
}),
},
astro = {
root_dir = find_repo_root({
configfiles = { "astro.config.mjs" }
}),
},
-- nargo = {
-- root_dir = find_repo_root({
-- configfiles = { "Nargo.toml" }
-- }),
-- },
eslint = {
root_dir = find_repo_root({
configfiles = { ".eslintrc", ".eslintrc.js", "package.json" }
}),
on_new_config = function(config, new_root_dir)
local default_config = vim.lsp.config.eslint.default_config
default_config.on_new_config(config, new_root_dir)
local pnp_cjs = util.path.join(new_root_dir, '.pnp.cjs')
local pnp_js = util.path.join(new_root_dir, '.pnp.js')
if util.path.exists(pnp_cjs) or util.path.exists(pnp_js) then
config.cmd = { 'yarn', 'exec', unpack(default_config.cmd) }
end
end
},
svelte = {},
svls = {},
}
local lsp_special_setup = {
}
local function on_attach(client, _bufnr)
lspstatus.on_attach(client)
end
for server, conf in pairs(lsp_confs) do
local source_on_attach = conf.on_attach
if source_on_attach == nil then
conf.on_attach = on_attach
else
conf.on_attach = function(client, bufnr)
on_attach(client, bufnr)
source_on_attach(client, bufnr)
end
end
conf.capabilities = vim.tbl_deep_extend(
"keep",
conf.capabilities or {},
lspstatus.capabilities
)
local final_config = coq.lsp_ensure_capabilities(conf)
-- local final_config = conf
local special_setup = lsp_special_setup[server]
if special_setup then
special_setup(final_config)
else
-- lspconfig[server].setup(final_config)
vim.lsp.config[server] = final_config
vim.lsp.enable(server)
-- lspconfig(server, final_config)
-- vim.lsp.enable(server)
end
end
-- local null_ls = require('null-ls')
-- null_ls.setup({
-- sources = {
-- -- null_ls.builtins.diagnostics.chktex,
-- null_ls.builtins.diagnostics.cppcheck,
-- null_ls.builtins.diagnostics.shellcheck,
--
-- null_ls.builtins.code_actions.gitsigns,
-- },
-- })
vim.diagnostic.config({
severity_sort = true,
update_in_insert = true,
float = {
source = true,
},
})
do -- signs
local signs = {
{ 'DiagnosticSignError', text = '×', texthl = 'DiagnosticSignError' },
{ 'DiagnosticSignWarn', text = '>', texthl = 'DiagnosticSignWarn' },
{ 'DiagnosticSignInfo', text = 'I', texthl = 'DiagnosticSignInfo' },
{ 'DiagnosticSignHint', text = 'H', texthl = 'DiagnosticSignHint' },
}
for _, sign in pairs(signs) do
local name = sign[1]
local opts = sign
opts[1] = nil
vim.fn.sign_define(name, opts)
end
end
local map = vim.api.nvim_set_keymap
map(
'n',
'K',
[[luaeval('next(vim.lsp.buf_get_clients()) == nil') ? 'K' : '<Cmd>lua vim.lsp.buf.hover()<CR>']],
{ noremap = true, expr = true }
)
map(
'n',
'<C-]>',
[[luaeval('next(vim.lsp.buf_get_clients()) == nil') ? '<C-]>' : '<Cmd>lua vim.lsp.buf.definition()<CR>']],
{ noremap = true, expr = true }
)
local M = {}
-- enables formatting on save
M.format_on_save_hook = function()
local enabled = vim.b.format_on_save
if enabled == nil then
enabled = true
end
if enabled ~= 0 and enabled ~= false then
if vim.bo.filetype ~= "plaintex" and vim.bo.filetype ~= "tex" and vim.bo.filetype ~= "latex" and
vim.bo.filetype ~= "qf" and vim.bo.filetype ~= "bib" and vim.bo.filetype ~= "" and vim.bo.filetype ~= "pdf"
and vim.bo.filetype ~= "conf" and vim.bo.filetype ~= "TelescopePrompt" and vim.bo.filetype ~= "lazy" and vim.bo.filetype ~= "lazy_backdrop" and vim.bo.filetype ~= "TelescopeResults" then
vim.lsp.buf.format({ async = false })
end
end
end
vim.cmd [[
augroup hoverlspconfig
au!
" diagnostic on hover
au BufWritePre * lua require'lsp'.format_on_save_hook()
au CursorHold * lua vim.diagnostic.open_float({focus = false})
augroup END
]]
-- enables coq
vim.api.nvim_create_autocmd(
{ 'FileType',
}, {
pattern = "*",
callback = function()
if vim.bo.filetype ~= "plaintex" and vim.bo.filetype ~= "tex" and vim.bo.filetype ~= "latex" and
vim.bo.filetype ~= "qf" and vim.bo.filetype ~= "bib" and vim.bo.filetype ~= "" and vim.bo.filetype ~= "pdf"
and vim.bo.filetype ~= "conf" and vim.bo.filetype ~= "TelescopePrompt" and vim.bo.filetype ~= "lazy" and vim.bo.filetype ~= "lazy_backdrop" and vim.bo.filetype ~= "TelescopeResults" then
vim.cmd([[ :COQnow -s ]])
end
end
})
-- toggles folds
map('n', '<Leader>pc', 'za', { noremap = true })
-- folds and treesitter
vim.api.nvim_create_autocmd('FileType', {
pattern = { '*' },
callback = function()
if vim.bo.filetype ~= "plaintex" and vim.bo.filetype ~= "tex" and vim.bo.filetype ~= "latex" and
vim.bo.filetype ~= "qf" and vim.bo.filetype ~= "bib" and vim.bo.filetype ~= "" and vim.bo.filetype ~= "pdf"
and vim.bo.filetype ~= "conf" and vim.bo.filetype ~= "TelescopePrompt" and vim.bo.filetype ~= "lazy" and vim.bo.filetype ~= "lazy_backdrop" and vim.bo.filetype ~= "TelescopeResults" then
vim.treesitter.start()
vim.wo[0][0].foldexpr = 'v:lua.vim.treesitter.foldexpr()'
vim.wo[0][0].foldmethod = 'expr'
vim.wo[0][0].foldenable = true
vim.wo[0][0].foldlevel = 99
vim.bo.indentexpr = "v:lua.require'nvim-treesitter'.indentexpr()"
end
end
})
for _, method in ipairs({ 'textDocument/diagnostic', 'workspace/diagnostic' }) do
local default_diagnostic_handler = vim.lsp.handlers[method]
vim.lsp.handlers[method] = function(err, result, context, config)
if err ~= nil and err.code == -32802 then
return
end
return default_diagnostic_handler(err, result, context, config)
end
end
-- vim.api.nvim_create_autocmd({ 'FileType', 'BufRead', 'BufReadPre', 'BufReadPost', 'BufWrite', 'BufWritePre',
-- 'BufWritePost' }, {
-- pattern = "*",
-- callback = function()
-- if vim.bo.filetype ~= "plaintex" and vim.bo.filetype ~= "tex" and vim.bo.filetype ~= "latex" then
-- vim.cmd [[ :COQnow -s ]]
-- end
-- end
-- })
-- vim.cmd [[
-- augroup disabletexlsp
-- autocmd!
-- autocmd FileType tex :COQstop
-- augroup END
-- ]]
return M
+417
View File
@@ -0,0 +1,417 @@
/* weird look: plantuml, mermaid
* flowchart looks ok ok
* Code highlights (highlight.js / hljs) incorrect, not base16
*/
body { background-color: var(--background); }
.markdown-body ol ol,
.markdown-body ul ol,
.markdown-body ol ul,
.markdown-body ul ul,
.markdown-body ol ul ol,
.markdown-body ul ul ol,
.markdown-body ol ul ul,
.markdown-body ul ul ul {
margin-top: 0;
margin-bottom: 0;
}
.markdown-body {
font-family: "Helvetica Neue", Helvetica, "Segoe UI", Arial, freesans, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
font-size: 16px;
color: var(--foreground);
line-height: 1.6;
word-wrap: break-word;
padding: 45px;
background: var(--background);
border: 0px solid var(--foreground);
-webkit-border-radius: 0 0 3px 3px;
border-radius: 0 0 3px 3px;
}
.markdown-body > *:first-child {
margin-top: 0 !important;
}
.markdown-body > *:last-child {
margin-bottom: 0 !important;
}
.markdown-body .table-of-contents ol {
list-style: none;
}
.markdown-body .table-of-contents > ol {
padding-left: 0;
}
.markdown-body * {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4,
.markdown-body h5,
.markdown-body h6 {
margin-top: 1em;
margin-bottom: 16px;
font-weight: bold;
line-height: 1.4;
}
.markdown-body h1 .anchor,
.markdown-body h2 .anchor,
.markdown-body h3 .anchor,
.markdown-body h4 .anchor,
.markdown-body h5 .anchor,
.markdown-body h6 .anchor {
margin-left: -24px;
visibility: hidden;
}
.markdown-body h1:hover .anchor,
.markdown-body h2:hover .anchor,
.markdown-body h3:hover .anchor,
.markdown-body h4:hover .anchor,
.markdown-body h5:hover .anchor,
.markdown-body h6:hover .anchor {
visibility: visible;
}
.markdown-body p,
.markdown-body blockquote,
.markdown-body ul,
.markdown-body ol,
.markdown-body dl,
.markdown-body table,
.markdown-body pre {
margin-top: 0;
margin-bottom: 16px;
background-color: var(--background) !important; /* Changes background of code block */
}
.markdown-body h1 {
margin: 0.67em 0;
padding-bottom: 0.3em;
font-size: 2.25em;
line-height: 1.2;
border-bottom: 1px solid var(--color4);
color: var(--color13) !important;
}
.markdown-body h2 {
padding-bottom: 0.3em;
font-size: 1.75em;
line-height: 1.225;
border-bottom: 1px solid var(--color4);
color: var(--color12) !important;
}
.markdown-body h3 {
font-size: 1.5em;
line-height: 1.43;
}
.markdown-body h4 {
font-size: 1.25em;
}
.markdown-body h5 {
font-size: 1em;
}
.markdown-body h6 {
font-size: 1em;
color: var(--color8) !important;
}
.markdown-body hr {
margin-top: 20px;
margin-bottom: 20px;
height: 0;
border: 0;
border-top: 1px solid var(--color4);
}
.markdown-body ol,
.markdown-body ul {
padding-left: 2em;
}
.markdown-body ol ol,
.markdown-body ul ol {
list-style-type: lower-roman;
}
.markdown-body ol ul,
.markdown-body ul ul {
list-style-type: circle;
}
.markdown-body ol ul ul,
.markdown-body ul ul ul {
list-style-type: square;
}
.markdown-body ol {
list-style-type: decimal;
}
.markdown-body ul {
list-style-type: disc;
/* color: var(--color9) !important; */ /* changes color of all bullet lists */
}
li::marker {
color: var(--color14) !important; /* changes color of bullet points */
}
.markdown-body dl {
margin-bottom: 1.3em
}
.markdown-body dl dt {
font-weight: 700;
}
.markdown-body dl dd {
margin-left: 0;
}
.markdown-body dl dd p {
margin-bottom: 0.8em;
}
.markdown-body blockquote {
margin-left: 0;
margin-right: 0;
padding: 0 15px;
color: var(--color8) !important;
border-left: 4px solid var(--color3) !important; /* border denoting block quote */
}
.markdown-body table {
display: block;
width: 100%;
overflow: auto;
word-break: normal;
word-break: keep-all;
border-collapse: collapse;
border-spacing: 0;
}
.markdown-body table tr {
background-color: var(--background) !important; /* Changes bacground color of tables */
border-top: 1px solid var(--color4);
}
.markdown-body table tr:nth-child(2n) {
background-color: #f8f8f8;
}
.markdown-body table th,
.markdown-body table td {
padding: 6px 13px;
border: 1px solid var(--color4); /* color of table cells/border */
}
.markdown-body pre {
word-wrap: normal;
padding: 16px;
overflow: auto;
font-size: 85%;
line-height: 1.45;
background-color: #f7f7f7;
-webkit-border-radius: 3px;
border-radius: 3px;
}
.markdown-body pre code {
display: inline;
max-width: initial;
padding: 0;
margin: 0;
overflow: initial;
font-size: 100%;
line-height: inherit;
word-wrap: normal;
white-space: pre;
-webkit-border-radius: 3px;
border-radius: 3px;
background-color: transparent;
}
.markdown-body pre code:before,
.markdown-body pre code:after {
content: normal;
}
.markdown-body code {
font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace;
padding: 0;
padding-top: 0.2em;
padding-bottom: 0.2em;
margin: 0;
font-size: 85%;
-webkit-border-radius: 3px;
border-radius: 3px;
}
.markdown-body code:before,
.markdown-body code:after {
letter-spacing: -0.2em;
content: "\00a0";
}
.markdown-body a {
color: var(--color2) !important; /* Change style of hyperlinks */
text-decoration: underline;
background: transparent;
}
.markdown-body img {
max-width: 100%;
max-height: 100%;
}
.markdown-body strong {
font-weight: bold;
}
.markdown-body em {
font-style: italic;
}
.markdown-body del {
text-decoration: line-through;
}
.task-list-item {
list-style-type: none;
}
.task-list-item input {
font: 13px/1.4 Helvetica, arial, nimbussansl, liberationsans, freesans, clean, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
margin: 0 0.35em 0.25em -1.6em;
vertical-align: middle;
}
.task-list-item input[disabled] {
cursor: default;
}
.task-list-item input[type="checkbox"] {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
padding: 0;
}
.task-list-item input[type="radio"] {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
padding: 0;
}
/* Below are the page settings */
#page-ctn {
margin: 0 auto;
max-width: 900px;
}
#page-header {
padding: 8px;
background-color: var(--background) !important;
border-color: var(--foreground) !important;
border-style: solid;
border-width: 1px 1px 0;
border-top-left-radius: 3px;
border-top-right-radius: 3px;
}
#page-header svg {
display: inline-block;
margin-right: 5px;
overflow: hidden;
fill: var(--foreground) !important;
}
#page-header h3 {
display: flex;
align-items: center;
margin-top: 0;
margin-bottom: 0;
padding-right: 16px;
font-size: 14px;
font-weight: 600;
color: var(--foreground) !important;
}
/* Highlight settings */
.hljs {
display: block;
overflow-x: auto;
padding: 0.5em;
/* color: #333; */
color: var(--color7) !important;
background: var(--background) !important;
}
.hljs-comment,
.hljs-quote {
color: var(--color8) !important; /* color of comments */
font-style: italic;
}
.hljs-keyword,
.hljs-selector-tag,
.hljs-subst {
color: var(--color4) !important;
font-weight: bold;
}
.hljs-number,
.hljs-literal,
.hljs-variable,
.hljs-template-variable,
.hljs-tag .hljs-attr {
color: var(--color5) !important;
}
.hljs-string,
.hljs-doctag {
color: var(--color1) !important;
}
.hljs-title,
.hljs-section,
.hljs-selector-id {
color: var(--color3) !important; /* Color of function title */
font-weight: bold;
}
.hljs-subst {
font-weight: normal;
}
.hljs-type,
.hljs-class .hljs-title {
color: var(--color2) !important; /* Color of class title */
font-weight: bold;
}
.hljs-tag,
.hljs-name,
.hljs-attribute {
font-weight: normal;
color: var(--color6) !important; /* Color of XML/HTML tags */
}
.hljs-regexp,
.hljs-link {
/* color: #009926; */
color: var(--color9) !important;
}
.hljs-symbol,
.hljs-bullet {
/* color: #990073; */
color: var(--color10) !important;
}
.hljs-built_in,
.hljs-builtin-name {
/* color: #0086b3; */
color: var(--color12) !important;
}
.hljs-meta {
color: var(--color8) !important; /* Color of meta tags */
font-weight: bold;
}
.hljs-deletion {
background: var(--color3);
}
.hljs-addition {
background: #dfd;
}
.hljs-emphasis {
font-style: italic;
}
.hljs-strong {
font-weight: bold;
}
.katex-html {
color: var(--color7);
}
+73
View File
@@ -0,0 +1,73 @@
local o = vim.opt
local map = vim.api.nvim_set_keymap
o.expandtab = true
o.tabstop = 4
o.shiftwidth = 0
o.viminfo = ''
vim.g.base16colorspace = 256
vim.g.vimtex_view_method = "zathura"
o.termguicolors = true
vim.b.coqtail_coq_prog = "coqidetop"
vim.cmd [[
augroup spellcheck
au!
au FileType markdown setlocal spell
au FileType plaintex setlocal spell
au FileType tex setlocal spell
au FileType latex setlocal spell
au BufRead,BufNewFile *.md setlocal spell
au BufRead,BufNewFile *.tex setlocal spell
augroup END
]]
o.spelllang = "en_us"
map('i', '<C-L>', '<c-g>u<Esc>[s1z=`]a<c-g>u', { noremap = true })
vim.cmd('colorscheme theme-nvim')
vim.g.airline_theme = 'theme'
vim.cmd("AirlineTheme theme")
-- stupid fix for stupid problems i guess
vim.g["airline#extensions#whitespace#enabled"] = false
local color = require('base16-colorscheme').colors.base02
vim.api.nvim_set_hl(0, 'LineNr', { fg = color, bg = "none" })
map('n', '<Leader>s', ':%s//g<Left><Left>', {})
map('n', '<Leader>e', ':make!<CR>', { noremap = true })
map('n', '<C-o>', ':cclose<CR>', { noremap = true })
map('n', '<C-L>', ':nohlsearch<CR><C-L>', { noremap = true, silent = true })
map('n', ';', ':', { noremap = true })
map('v', ';', ':', { noremap = true })
for i = 1, 9, 1 do
map('', '<Leader>' .. tostring(i), tostring(i) .. 'gt', { noremap = true })
end
map('n', '<C-Left>', ':tabprevious<CR>', { noremap = true })
map('n', '<C-Right>', ':tabnext<CR>', { noremap = true })
map('', '<Leader>0', ':tablast<CR>', { noremap = true })
map('n', 'ZX', '<Cmd>q<CR>', { noremap = true, silent = true })
map('t', '<Esc>', '<C-\\><C-n>', { noremap = true })
o.list = true
o.listchars = {
tab = '',
eol = '¬',
trail = '·',
extends = ''
}
vim.cmd [[
augroup options_guicursor
au!
" Reset to vertical cursor for terminal nvim (https://github.com/neovim/neovim/issues/4867#issuecomment-291249173)
au VimLeave * set guicursor=a:ver90
augroup END
]]
+385
View File
@@ -0,0 +1,385 @@
local function import(name)
return function()
require(name)
end
end
return {
{
"RRethy/base16-nvim",
},
{
"vim-airline/vim-airline",
dependencies = {
"ryanoasis/vim-devicons",
},
},
{
"mustache/vim-mustache-handlebars",
},
{
"whonore/Coqtail",
},
{
"Julian/lean.nvim",
dependencies = {
"nvim-lua/plenary.nvim",
},
config = function()
require("lean").setup({
opts = { mappings = true }
})
end,
},
{
"noir-lang/noir-nvim",
},
{
"nvim-treesitter/nvim-treesitter",
lazy = false,
version = false,
build = function()
vim.cmd(":TSUpdate")
end,
opts = {
highlight = {
enable = true,
disable = { "ipkg", "markdown", "md" }
},
indent = {
enable = true,
disable = { "markdown", "md" }
},
ensure_installed = "all",
ignore_install = { "ipkg", "markdown", "md" },
},
},
{
"petRUShka/vim-sage",
},
{
"evanleck/vim-svelte",
},
{
"wuelnerdotexe/vim-astro",
},
{
"tpope/vim-fugitive",
config = function()
local map = vim.api.nvim_set_keymap
map('n', '<Leader>g', '<Cmd>Git<CR>', { noremap = true })
end,
},
{
"tpope/vim-surround",
},
{
"tpope/vim-repeat",
},
{
"nvim-lua/plenary.nvim",
},
{
"lewis6991/gitsigns.nvim",
dependencies = {
"nvim-lua/plenary.nvim",
},
config = function()
require('gitsigns').setup {
signs = {
add = {
text = '',
},
change = {
text = '',
},
delete = {
text = '_',
},
topdelete = {
text = '',
},
changedelete = {
text = '~',
},
},
}
end,
},
{
"akinsho/flutter-tools.nvim",
dependencies = {
"nvim-lua/plenary.nvim",
},
config = function()
require('flutter-tools').setup {
-- lsp = {
-- color = {
-- enabled = false
-- }
-- }
}
end,
},
{
"numToStr/Comment.nvim",
config = function()
local map = vim.api.nvim_set_keymap
require('Comment').setup({})
map(
'n',
'<C-_>',
'<Cmd>lua require("Comment.api").toggle_linewise_op(vim.fn.visualmode())<CR>',
{ noremap = true, silent = true }
)
end,
},
{
"nvim-telescope/telescope.nvim",
dependencies = {
"nvim-lua/plenary.nvim",
{
"nvim-telescope/telescope-fzf-native.nvim",
build = "make",
},
"nvim-telescope/telescope-symbols.nvim",
},
config = import("tel"),
},
{
"stevearc/dressing.nvim",
config = function()
require('dressing').setup({
input = {
default_prompt = '',
win_options = {
winhighlight = 'NormalFloat:Normal',
},
},
})
vim.cmd [[highlight link FloatTitle NonText]]
vim.cmd [[highlight link DressingInputText Normal]]
end,
},
{
"antoinemadec/FixCursorHold.nvim",
config = function()
vim.g.cursorhold_updatetime = 500
end,
},
{
"sirver/ultisnips",
ft = { 'latex', 'plaintex', 'tex' },
config = function()
vim.g.UltiSnipsExpandTrigger = '<tab>'
vim.g.UltiSnipsJumpForwardTrigger = '<C-h>'
vim.g.UltiSnipsJumpBackwardTrigger = '<C-b>'
end,
},
{
"ms-jpq/coq.artifacts",
branch = "artifacts",
lazy = false
},
{
"ms-jpq/coq_nvim",
branch = "coq",
lazy = false,
dependencies = {
{
"ms-jpq/coq.artifacts",
branch = "artifacts",
lazy = false,
},
{
"ms-jpq/coq.thirdparty",
branch = "3p",
lazy = false,
},
},
init = function()
vim.g.coq_settings = {
-- auto_start = 'shut-up',
keymap = {
eval_snips = "<Leader>se",
},
-- match = {
-- look_ahead = 1,
-- },
clients = {
snippets = {
always_on_top = true,
enabled = true,
weight_adjust = 100,
},
buffers = {
enabled = true,
weight_adjust = -2.0,
},
tree_sitter = {
enabled = true,
weight_adjust = -1.5,
},
lsp = {
enabled = true,
weight_adjust = -100,
},
third_party = {
enabled = true,
weight_adjust = -1.5,
}
}
}
require('coq_3p') {
{ src = 'vimtex', short_name = 'TEX' },
{ src = 'nvimlua', short_name = 'NLUA', conf_only = true },
{ src = 'bc', short_name = 'CALC', precision = 8 },
}
end,
build = function()
require("coq")
vim.cmd(":COQdeps")
end,
config = function()
require('coq_3p') {
{ src = 'vimtex', short_name = 'TEX' },
{ src = 'nvimlua', short_name = 'NLUA', conf_only = true },
{ src = 'bc', short_name = 'CALC', precision = 8 },
}
end
},
{
"ms-jpq/coq.thirdparty",
branch = "3p",
lazy = false,
},
{
"nvim-lua/lsp-status.nvim",
lazy = false,
},
{
"neovim/nvim-lspconfig",
lazy = false,
dependencies = {
{
"nvim-lua/lsp-status.nvim",
lazy = false,
},
{
"ms-jpq/coq.thirdparty",
branch = "3p",
lazy = false,
},
{
"ms-jpq/coq.artifacts",
branch = "artifacts",
lazy = false,
},
{
"ms-jpq/coq_nvim",
branch = "coq",
lazy = false,
dependencies = {
{
"ms-jpq/coq.artifacts",
branch = "artifacts",
lazy = false,
},
},
},
},
config = function()
local capabilities = require("coq").lsp_ensure_capabilities()
-- extend coq completion capabilities all lsps
vim.lsp.config('*', {
capabilities = capabilities,
})
vim.lsp.enable("lua_ls")
require("lsp")
end,
},
{
"lervag/vimtex",
config = function()
vim.g.vimtex_view_general_viewer = 'zathura'
vim.g.vimtex_compiler_method = "latexmk"
-- vim.g.vimtex_view_general_options = = '-x nvim -n -c "Vimtex'
-- 'file:@pdf\\#src:@line@tex'
-- vim.g.vimtex_quickfix_enabled = 0
-- vim.g.Tex_GotoError = 0
-- vim.g.Tex_ShowErrorContext = 0
end,
},
{
"iamcco/markdown-preview.nvim",
ft = { "markdown" },
init = function()
vim.g.mkdp_filetypes = { "markdown" }
end,
build = function()
vim.fn.system("cd app && npm install")
end,
config = function()
local map = vim.api.nvim_set_keymap
map('n', '<C-m>', '<Plug>MarkdownPreviewToggle', {})
map('n', '<Leader>m', '<Plug>MarkdownPreviewToggle', {})
vim.g.mkdp_markdown_css =
os.getenv("HOME") .. "/.config/nvim/lua/markdownStyle.css"
vim.g.mkdp_highlight_css =
os.getenv("HOME") .. "/.cache/wal/colors.css"
end,
},
}
+11
View File
@@ -0,0 +1,11 @@
local o = vim.opt
local map = vim.api.nvim_set_keymap
vim.g.mapleader = ","
vim.g.maplocalleader = " "
vim.g.coq_v1 = true
o.modeline = true
o.number = true
o.relativenumber = true
o.clipboard = "unnamedplus"
o.viminfo = ""
+208
View File
@@ -0,0 +1,208 @@
local telescope = require('telescope')
telescope.setup({
defaults = {
file_ignore_patterns = { '.git' },
mappings = {
i = {
['<C-o>'] = { '<Esc>', type = 'command' },
['<Esc>'] = 'close',
['<C-s>'] = 'select_horizontal',
},
n = {
q = 'close',
['<C-o>'] = { '<Nop>', type = 'command' },
['<C-s>'] = 'select_horizontal',
},
},
sorting_strategy = 'ascending',
layout_config = {
prompt_position = 'top',
},
prompt_prefix = ' ',
selection_caret = ' ',
multi_icon = '',
},
pickers = {
buffers = {
mappings = {
n = {
dd = 'delete_buffer',
},
},
},
find_files = {
hidden = true,
},
lsp_code_actions = {
initial_mode = 'normal',
},
lsp_range_code_actions = {
initial_mode = 'normal',
},
},
})
telescope.load_extension('fzf')
-- taken from https://github.com/nvim-telescope/telescope-ui-select.nvim for code actions
telescope.register_extension {
setup = function(topts)
local specific_opts = vim.F.if_nil(topts.specific_opts, {})
topts.specific_opts = nil
if #topts == 1 and topts[1] ~= nil then
topts = topts[1]
end
local pickers = require "telescope.pickers"
local finders = require "telescope.finders"
local conf = require("telescope.config").values
local actions = require "telescope.actions"
local action_state = require "telescope.actions.state"
local strings = require "plenary.strings"
local entry_display = require "telescope.pickers.entry_display"
local utils = require "telescope.utils"
__TelescopeUISelectSpecificOpts = vim.F.if_nil(
__TelescopeUISelectSpecificOpts,
vim.tbl_extend("keep", specific_opts, {
["codeaction"] = {
make_indexed = function(items)
local indexed_items = {}
local widths = {
idx = 0,
command_title = 0,
client_name = 0,
}
for idx, item in ipairs(items) do
local client = vim.lsp.get_client_by_id(item[1])
local entry = {
idx = idx,
["add"] = {
command_title = item[2].title:gsub("\r\n", "\\r\\n"):gsub("\n", "\\n"),
client_name = client and client.name or "",
},
text = item,
}
table.insert(indexed_items, entry)
widths.idx = math.max(widths.idx, strings.strdisplaywidth(entry.idx))
widths.command_title = math.max(widths.command_title,
strings.strdisplaywidth(entry.add.command_title))
widths.client_name = math.max(widths.client_name,
strings.strdisplaywidth(entry.add.client_name))
end
return indexed_items, widths
end,
make_displayer = function(widths)
return entry_display.create {
separator = " ",
items = {
{ width = widths.idx + 1 }, -- +1 for ":" suffix
{ width = widths.command_title },
{ width = widths.client_name },
},
}
end,
make_display = function(displayer)
return function(e)
return displayer {
{ e.value.idx .. ":", "TelescopePromptPrefix" },
{ e.value.add.command_title },
{ e.value.add.client_name, "TelescopeResultsComment" },
}
end
end,
make_ordinal = function(e)
return e.idx .. e.add["command_title"]
end,
},
})
)
vim.ui.select = function(items, opts, on_choice)
opts = opts or {}
local prompt = vim.F.if_nil(opts.prompt, "Select one of")
if prompt:sub(-1, -1) == ":" then
prompt = prompt:sub(1, -2)
end
opts.format_item = vim.F.if_nil(opts.format_item, function(e)
return tostring(e)
end)
-- We want or here because __TelescopeUISelectSpecificOpts[x] can be either nil or even false -> {}
local sopts = __TelescopeUISelectSpecificOpts[vim.F.if_nil(opts.kind, "")] or {}
local indexed_items, widths = vim.F.if_nil(sopts.make_indexed, function(items_)
local indexed_items = {}
for idx, item in ipairs(items_) do
table.insert(indexed_items, { idx = idx, text = item })
end
return indexed_items
end)(items)
local displayer = vim.F.if_nil(sopts.make_displayer, function()
end)(widths)
local make_display = vim.F.if_nil(sopts.make_display, function(_)
return function(e)
local x, _ = opts.format_item(e.value.text)
return x
end
end)(displayer)
local make_ordinal = vim.F.if_nil(sopts.make_ordinal, function(e)
return opts.format_item(e.text)
end)
pickers.new(topts, {
prompt_title = prompt,
finder = finders.new_table {
results = indexed_items,
entry_maker = function(e)
return {
value = e,
display = make_display,
ordinal = make_ordinal(e),
}
end,
},
attach_mappings = function(prompt_bufnr)
actions.select_default:replace(function()
local selection = action_state.get_selected_entry()
if selection == nil then
utils.__warn_no_selection "ui-select"
return
end
actions.close(prompt_bufnr)
on_choice(selection.value.text, selection.value.idx)
end)
return true
end,
sorter = conf.generic_sorter(topts),
}):find()
end
end,
}
local map = vim.api.nvim_set_keymap
map('n', '<Leader>pf', '<Cmd>Telescope find_files<CR>', { noremap = true })
map('n', '<Leader>pb', '<Cmd>Telescope buffers<CR>', { noremap = true })
map('n', '<Leader>po', '<Cmd>Telescope lsp_document_symbols<CR>', { noremap = true })
map('n', '<Leader>ps', '<Cmd>Telescope lsp_workspace_symbols<CR>', { noremap = true })
map('n', '<Leader>pd', '<Cmd>Telescope lsp_definitions<CR>', { noremap = true })
map('n', '<Leader>pr', '<Cmd>Telescope lsp_references<CR>', { noremap = true })
map('n', '<Leader>pp', '<C-^>', { noremap = true })
map('n', '<Leader>p', ':Telescope ', { noremap = true })
map('n', '<Leader>p ', ':Telescope ', { noremap = true })
map('n', '<Leader>.', ':lua vim.lsp.buf.code_action()<CR>', { noremap = true })
map('n', '<Leader>pn', '<Cmd>lua vim.lsp.buf.rename()<CR>', { noremap = true })
-- vim.cmd [[
-- function! s:telescope_hlsetup() abort
-- highlight link TelescopeBorder NonText
-- highlight link TelescopeTitle NonText
-- endfunction
-- call s:telescope_hlsetup()
-- augroup telescope_hlsetup
-- au!
-- au ColorScheme * call s:telescope_hlsetup()
-- augroup END
-- ]]