move old nvim config
This commit is contained in:
parent
c9ae53e233
commit
e7740e9989
27 changed files with 492 additions and 704 deletions
|
|
@ -1,50 +1,4 @@
|
|||
local default_cpp_lang = {
|
||||
extension = 'cc',
|
||||
commands = {
|
||||
build = {
|
||||
'g++',
|
||||
'-std=c++23',
|
||||
'-O2',
|
||||
'-Wall',
|
||||
'-Wextra',
|
||||
'-Wpedantic',
|
||||
'-Wshadow',
|
||||
'-Wconversion',
|
||||
'-Wformat=2',
|
||||
'-Wfloat-equal',
|
||||
'-Wundef',
|
||||
'-fdiagnostics-color=always',
|
||||
'-DLOCAL',
|
||||
'{source}',
|
||||
'-o',
|
||||
'{binary}',
|
||||
},
|
||||
run = { '{binary}' },
|
||||
debug = {
|
||||
'g++',
|
||||
'-std=c++23',
|
||||
'-g3',
|
||||
'-fsanitize=address,undefined',
|
||||
'-fno-omit-frame-pointer',
|
||||
'-fstack-protector-all',
|
||||
'-D_GLIBCXX_DEBUG',
|
||||
'-DLOCAL',
|
||||
'{source}',
|
||||
'-o',
|
||||
'{binary}',
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
local default_python_lang = {
|
||||
extension = 'py',
|
||||
commands = {
|
||||
run = { 'python', '{source}' },
|
||||
debug = { 'python', '{source}' },
|
||||
},
|
||||
}
|
||||
|
||||
local clang_format_content = [[BasedOnStyle: LLVM
|
||||
local clang_format = [[BasedOnStyle: LLVM
|
||||
IndentWidth: 2
|
||||
UseTab: Never
|
||||
|
||||
|
|
@ -62,27 +16,177 @@ AlignAfterOpenBracket: Align
|
|||
BinPackArguments: false
|
||||
BinPackParameters: false]]
|
||||
|
||||
local cpp_base = [[#include <bits/stdc++.h> // {{{
|
||||
|
||||
#include <version>
|
||||
#ifdef __cpp_lib_ranges_enumerate
|
||||
#include <ranges>
|
||||
namespace rv = std::views;
|
||||
namespace rs = std::ranges;
|
||||
#endif
|
||||
|
||||
#pragma GCC optimize("O2,unroll-loops")
|
||||
#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
|
||||
|
||||
using namespace std;
|
||||
|
||||
using i32 = int32_t;
|
||||
using u32 = uint32_t;
|
||||
using i64 = int64_t;
|
||||
using u64 = uint64_t;
|
||||
using f64 = double;
|
||||
using f128 = long double;
|
||||
|
||||
#if __cplusplus >= 202002L
|
||||
template <typename T>
|
||||
constexpr T MIN = std::numeric_limits<T>::min();
|
||||
|
||||
template <typename T>
|
||||
constexpr T MAX = std::numeric_limits<T>::max();
|
||||
#endif
|
||||
|
||||
#ifdef LOCAL
|
||||
#define db(...) std::print(__VA_ARGS__)
|
||||
#define dbln(...) std::println(__VA_ARGS__)
|
||||
#else
|
||||
#define db(...)
|
||||
#define dbln(...)
|
||||
#endif
|
||||
// }}}
|
||||
|
||||
void solve() {
|
||||
<++>
|
||||
}
|
||||
|
||||
int main() { // {{{
|
||||
std::cin.exceptions(std::cin.failbit);
|
||||
#ifdef LOCAL
|
||||
std::cerr.rdbuf(std::cout.rdbuf());
|
||||
std::cout.setf(std::ios::unitbuf);
|
||||
std::cerr.setf(std::ios::unitbuf);
|
||||
#else
|
||||
std::cin.tie(nullptr)->sync_with_stdio(false);
|
||||
#endif
|
||||
]]
|
||||
|
||||
local cpp_single = cpp_base .. [[ solve();
|
||||
return 0;
|
||||
} // }}}]]
|
||||
|
||||
local cpp_multi = cpp_base .. [[ u32 tc = 1;
|
||||
std::cin >> tc;
|
||||
for (u32 t = 0; t < tc; ++t) {
|
||||
solve();
|
||||
}
|
||||
return 0;
|
||||
} // }}}]]
|
||||
|
||||
local templates = {
|
||||
cpp = {
|
||||
default = cpp_multi,
|
||||
codeforces = cpp_multi,
|
||||
atcoder = cpp_single,
|
||||
cses = cpp_single,
|
||||
},
|
||||
python = {
|
||||
default = [[def main() -> None:
|
||||
<++>
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()]],
|
||||
},
|
||||
}
|
||||
|
||||
local function insert_template(buf, lang, platform)
|
||||
local lang_templates = templates[lang]
|
||||
if not lang_templates then
|
||||
return false
|
||||
end
|
||||
|
||||
local template = lang_templates[platform] or lang_templates.default
|
||||
if not template then
|
||||
return false
|
||||
end
|
||||
|
||||
local lines = vim.split(template, '\n')
|
||||
vim.api.nvim_buf_set_lines(buf, 0, -1, false, lines)
|
||||
|
||||
for lnum, line in ipairs(lines) do
|
||||
local col = line:find('<++>', 1, true)
|
||||
if col then
|
||||
local new_line = line:sub(1, col - 1) .. line:sub(col + 4)
|
||||
vim.api.nvim_buf_set_lines(buf, lnum - 1, lnum, false, { new_line })
|
||||
vim.api.nvim_win_set_cursor(0, { lnum, col - 1 })
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
return {
|
||||
'barrettruth/cp.nvim',
|
||||
dir = '~/dev/cp.nvim',
|
||||
cmd = 'CP',
|
||||
keys = {
|
||||
{ '<leader>ce', '<cmd>CP edit<cr>' },
|
||||
{ '<leader>cp', '<cmd>CP panel<cr>' },
|
||||
{ '<leader>cP', '<cmd>CP pick<cr>' },
|
||||
{ '<leader>cr', '<cmd>CP run<cr>' },
|
||||
{ '<leader>cr', '<cmd>CP run all<cr>' },
|
||||
{ '<leader>cd', '<cmd>CP run --debug<cr>' },
|
||||
{ '<leader>cc', '<cmd>CP cache read<cr>' },
|
||||
{ ']c', '<cmd>CP next<cr>' },
|
||||
{ '[c', '<cmd>CP prev<cr>' },
|
||||
},
|
||||
dependencies = {
|
||||
'ibhagwan/fzf-lua'
|
||||
},
|
||||
config = function()
|
||||
require('cp').setup({
|
||||
init = function()
|
||||
vim.g.cp = {
|
||||
debug = false,
|
||||
languages = {
|
||||
cpp = default_cpp_lang,
|
||||
python = default_python_lang,
|
||||
cpp = {
|
||||
extension = 'cc',
|
||||
commands = {
|
||||
build = {
|
||||
'g++',
|
||||
'-std=c++23',
|
||||
'-O2',
|
||||
'-Wall',
|
||||
'-Wextra',
|
||||
'-Wpedantic',
|
||||
'-Wshadow',
|
||||
'-Wconversion',
|
||||
'-Wformat=2',
|
||||
'-Wfloat-equal',
|
||||
'-Wundef',
|
||||
'-fdiagnostics-color=always',
|
||||
'-DLOCAL',
|
||||
'{source}',
|
||||
'-o',
|
||||
'{binary}',
|
||||
},
|
||||
run = { '{binary}' },
|
||||
debug = {
|
||||
'g++',
|
||||
'-std=c++23',
|
||||
'-g3',
|
||||
'-fsanitize=address,undefined',
|
||||
'-fno-omit-frame-pointer',
|
||||
'-fstack-protector-all',
|
||||
'-D_GLIBCXX_DEBUG',
|
||||
'-DLOCAL',
|
||||
'{source}',
|
||||
'-o',
|
||||
'{binary}',
|
||||
},
|
||||
},
|
||||
},
|
||||
python = {
|
||||
extension = 'py',
|
||||
commands = {
|
||||
run = { 'python', '{source}' },
|
||||
debug = { 'python', '{source}' },
|
||||
},
|
||||
},
|
||||
},
|
||||
platforms = {
|
||||
codeforces = {
|
||||
|
|
@ -95,7 +199,10 @@ return {
|
|||
},
|
||||
cses = {},
|
||||
},
|
||||
ui = { picker = 'fzf-lua' },
|
||||
ui = {
|
||||
picker = 'fzf-lua',
|
||||
panel = { diff_modes = { 'side-by-side', 'git' } },
|
||||
},
|
||||
hooks = {
|
||||
setup_io_input = function(buf)
|
||||
require('cp.helpers').clearcol(buf)
|
||||
|
|
@ -120,48 +227,22 @@ return {
|
|||
local buf = vim.api.nvim_get_current_buf()
|
||||
local lines = vim.api.nvim_buf_get_lines(buf, 0, 1, true)
|
||||
if #lines > 1 or (#lines == 1 and lines[1] ~= '') then
|
||||
local pos = vim.api.nvim_win_get_cursor(0)
|
||||
vim.cmd('normal! zx')
|
||||
vim.api.nvim_win_set_cursor(0, pos)
|
||||
return
|
||||
end
|
||||
|
||||
local trigger = state.get_platform() or ''
|
||||
vim.api.nvim_buf_set_lines(buf, 0, -1, false, { trigger })
|
||||
vim.api.nvim_win_set_cursor(0, { 1, #trigger })
|
||||
vim.cmd.startinsert({ bang = true })
|
||||
vim.schedule(function()
|
||||
local ls = require('luasnip')
|
||||
if ls.expandable() then
|
||||
vim.api.nvim_create_autocmd('TextChanged', {
|
||||
buffer = buf,
|
||||
once = true,
|
||||
callback = function()
|
||||
vim.schedule(function()
|
||||
local pos =
|
||||
vim.api.nvim_win_get_cursor(0)
|
||||
vim.cmd('normal! zx')
|
||||
vim.api.nvim_win_set_cursor(0, pos)
|
||||
end)
|
||||
end,
|
||||
})
|
||||
ls.expand()
|
||||
end
|
||||
vim.cmd.stopinsert()
|
||||
end)
|
||||
local clang_format_path = vim.fn.getcwd()
|
||||
.. '/.clang-format'
|
||||
local lang = state.get_language()
|
||||
local platform = state.get_platform()
|
||||
insert_template(buf, lang, platform)
|
||||
|
||||
local clang_format_path = vim.fn.getcwd() .. '/.clang-format'
|
||||
if vim.fn.filereadable(clang_format_path) == 0 then
|
||||
vim.fn.writefile(
|
||||
vim.split(clang_format_content, '\n'),
|
||||
clang_format_path
|
||||
)
|
||||
vim.fn.writefile(vim.split(clang_format, '\n'), clang_format_path)
|
||||
end
|
||||
end,
|
||||
},
|
||||
filename = function(_, _, problem_id)
|
||||
return problem_id
|
||||
end,
|
||||
})
|
||||
}
|
||||
end,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,15 +1,33 @@
|
|||
---@type number|nil
|
||||
local git_tab = nil
|
||||
|
||||
---@type string|nil
|
||||
local prev = nil
|
||||
local prev_gitsigns_signcol = nil
|
||||
|
||||
return {
|
||||
{
|
||||
'tpope/vim-fugitive',
|
||||
cmd = 'Git',
|
||||
cmd = { 'Git', 'G', 'Gread', 'Gwrite', 'Gdiffsplit', 'Gvdiffsplit' },
|
||||
},
|
||||
{
|
||||
'barrettruth/diffs.nvim',
|
||||
dir = '~/dev/diffs.nvim',
|
||||
enabled = true,
|
||||
init = function()
|
||||
vim.g.diffs = {
|
||||
debug = false,
|
||||
hide_prefix = true,
|
||||
highlights = {
|
||||
vim = {
|
||||
enabled = true,
|
||||
},
|
||||
intra = {
|
||||
enabled = true,
|
||||
max_lines = 500,
|
||||
},
|
||||
},
|
||||
}
|
||||
end,
|
||||
},
|
||||
{
|
||||
-- TODO: find out a way to remove this/better overall github integration
|
||||
'folke/snacks.nvim',
|
||||
---@type snacks.Config
|
||||
opts = { gitbrowse = {} },
|
||||
|
|
@ -29,10 +47,10 @@ return {
|
|||
'<leader>Gs',
|
||||
function()
|
||||
if vim.opt.signcolumn:get() == 'no' then
|
||||
prev = vim.opt.signcolumn:get()
|
||||
prev_gitsigns_signcol = vim.opt.signcolumn:get()
|
||||
vim.opt.signcolumn = 'yes'
|
||||
else
|
||||
vim.opt.signcolumn = prev
|
||||
vim.opt.signcolumn = prev_gitsigns_signcol
|
||||
end
|
||||
vim.cmd.Gitsigns('toggle_signs')
|
||||
end,
|
||||
|
|
|
|||
43
config/nvim/lua/plugins/guard.lua
Normal file
43
config/nvim/lua/plugins/guard.lua
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
return {
|
||||
'nvimdev/guard.nvim',
|
||||
-- TODO: use main repo when #76 merged
|
||||
dependencies = {
|
||||
{ dir = '~/dev/guard-collection', 'barrettruth/guard-collection' },
|
||||
},
|
||||
init = function()
|
||||
vim.g.guard_config = {
|
||||
fmt_on_save = false,
|
||||
save_on_fmt = true,
|
||||
lsp_as_default_formatter = true,
|
||||
}
|
||||
end,
|
||||
config = function()
|
||||
local ft = require('guard.filetype')
|
||||
|
||||
ft('python'):fmt({
|
||||
cmd = 'isort',
|
||||
args = { '--profile', 'black', '-' },
|
||||
stdin = true,
|
||||
}):append('black'):lint('mypy')
|
||||
|
||||
ft('lua'):fmt('stylua'):lint('selene')
|
||||
|
||||
ft('javascript,javascriptreact,typescript,typescriptreact'):fmt('prettierd'):lint('eslint_d')
|
||||
ft('css,graphql,html,json,jsonc,mdx,yaml'):fmt('prettierd')
|
||||
|
||||
ft('sh,bash,zsh'):fmt({
|
||||
cmd = 'shfmt',
|
||||
args = { '-i', '2' },
|
||||
stdin = true,
|
||||
})
|
||||
ft('zsh'):lint('zsh')
|
||||
|
||||
ft('proto'):fmt('buf'):lint('buf')
|
||||
ft('dockerfile'):lint('hadolint')
|
||||
ft('tex'):fmt('latexindent')
|
||||
ft('cmake'):fmt('cmake-format')
|
||||
ft('make'):lint('checkmake')
|
||||
ft('cpp'):lint('cpplint')
|
||||
ft('markdown'):fmt('cbfmt'):append('prettierd')
|
||||
end,
|
||||
}
|
||||
|
|
@ -11,11 +11,11 @@ return {
|
|||
},
|
||||
{
|
||||
'saghen/blink.cmp',
|
||||
version = '1.*',
|
||||
dependencies = { 'folke/lazydev.nvim', 'L3MON4D3/LuaSnip' },
|
||||
build = 'cargo build --release',
|
||||
dependencies = 'folke/lazydev.nvim',
|
||||
---@module 'blink.cmp'
|
||||
---@type blink.cmp.Config
|
||||
event = { 'InsertEnter', 'CmdlineEnter' },
|
||||
event = { 'InsertEnter', 'LspAttach' },
|
||||
config = function(_, opts)
|
||||
vim.o.pumheight = 15
|
||||
opts.completion.menu.max_height = vim.o.pumheight
|
||||
|
|
@ -56,15 +56,16 @@ return {
|
|||
},
|
||||
},
|
||||
cmdline = {
|
||||
completion = {
|
||||
menu = {
|
||||
auto_show = true,
|
||||
},
|
||||
},
|
||||
keymap = {
|
||||
['<left>'] = false,
|
||||
['<right>'] = false,
|
||||
},
|
||||
enabled = false,
|
||||
-- completion = {
|
||||
-- menu = {
|
||||
-- auto_show = true,
|
||||
-- },
|
||||
-- },
|
||||
-- keymap = {
|
||||
-- ['<left>'] = false,
|
||||
-- ['<right>'] = false,
|
||||
-- },
|
||||
},
|
||||
sources = {
|
||||
default = { 'lsp', 'path', 'snippets', 'buffer' },
|
||||
|
|
@ -80,9 +81,6 @@ return {
|
|||
keys = { { '<c-n>', mode = 'i' } },
|
||||
opts_extend = { 'sources.default' },
|
||||
},
|
||||
{
|
||||
'b0o/SchemaStore.nvim',
|
||||
},
|
||||
{
|
||||
'saecki/live-rename.nvim',
|
||||
event = 'LspAttach',
|
||||
|
|
@ -113,7 +111,6 @@ return {
|
|||
},
|
||||
{
|
||||
'yioneko/nvim-vtsls',
|
||||
enabled = false,
|
||||
config = function(_, opts)
|
||||
require('vtsls').config(opts)
|
||||
end,
|
||||
|
|
@ -180,72 +177,6 @@ return {
|
|||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
'pmizio/typescript-tools.nvim',
|
||||
enabled = false,
|
||||
opts = {
|
||||
on_attach = function(_, bufnr)
|
||||
bmap(
|
||||
{ 'n', 'gD', vim.cmd.TSToolsGoToSourceDefinition },
|
||||
{ buffer = bufnr }
|
||||
)
|
||||
end,
|
||||
handlers = {
|
||||
['textDocument/publishDiagnostics'] = function(_, result, ctx)
|
||||
if not result.diagnostics then
|
||||
return
|
||||
end
|
||||
|
||||
local idx = 1
|
||||
while idx <= #result.diagnostics do
|
||||
local entry = result.diagnostics[idx]
|
||||
|
||||
local formatter =
|
||||
require('format-ts-errors')[entry.code]
|
||||
entry.message = formatter and formatter(entry.message)
|
||||
or entry.message
|
||||
|
||||
if vim.tbl_contains({ 80001, 80006 }, entry.code) then
|
||||
table.remove(result.diagnostics, idx)
|
||||
else
|
||||
idx = idx + 1
|
||||
end
|
||||
end
|
||||
|
||||
vim.lsp.diagnostic.on_publish_diagnostics(_, result, ctx)
|
||||
end,
|
||||
},
|
||||
|
||||
settings = {
|
||||
expose_as_code_action = 'all',
|
||||
-- tsserver_path = vim.env.XDG_DATA_HOME .. '/pnpm/tsserver',
|
||||
tsserver_file_preferences = {
|
||||
includeInlayarameterNameHints = 'all',
|
||||
includeInlayarameterNameHintsWhenArgumentMatchesName = false,
|
||||
includeInlayFunctionParameterTypeHints = true,
|
||||
includeInlayVariableTypeHints = true,
|
||||
includeInlayVariableTypeHintsWhenTypeMatchesName = false,
|
||||
includeInlayPropertyDeclarationTypeHints = true,
|
||||
includeInlayFunctionLikeReturnTypeHints = true,
|
||||
includeInlayEnumMemberValueHints = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
dependencies = {
|
||||
'nvim-lua/plenary.nvim',
|
||||
},
|
||||
ft = {
|
||||
'javascript',
|
||||
'javascriptreact',
|
||||
'typescript',
|
||||
'typescriptreact',
|
||||
},
|
||||
},
|
||||
{
|
||||
'mrcjkb/rustaceanvim',
|
||||
enabled = false,
|
||||
ft = { 'rust' },
|
||||
},
|
||||
{
|
||||
'SmiteshP/nvim-navic',
|
||||
opts = {
|
||||
|
|
|
|||
|
|
@ -1,16 +1,116 @@
|
|||
return {
|
||||
{
|
||||
'barrettruth/live-server.nvim',
|
||||
build = 'pnpm add -g live-server',
|
||||
cmd = { 'LiveServerStart', 'LiveServerStart' },
|
||||
config = true,
|
||||
keys = { { '<leader>L', '<cmd>LiveServerToggle<cr>' } },
|
||||
},
|
||||
{
|
||||
'echasnovski/mini.pairs',
|
||||
config = true,
|
||||
event = 'InsertEnter',
|
||||
},
|
||||
{
|
||||
'echasnovski/mini.ai',
|
||||
opts = {
|
||||
custom_textobjects = {
|
||||
b = false,
|
||||
f = false,
|
||||
e = function(ai_type)
|
||||
local n_lines = vim.fn.line('$')
|
||||
local start_line, end_line = 1, n_lines
|
||||
if ai_type == 'i' then
|
||||
while
|
||||
start_line <= n_lines
|
||||
and vim.fn.getline(start_line):match('^%s*$')
|
||||
do
|
||||
start_line = start_line + 1
|
||||
end
|
||||
while
|
||||
end_line >= start_line
|
||||
and vim.fn.getline(end_line):match('^%s*$')
|
||||
do
|
||||
end_line = end_line - 1
|
||||
end
|
||||
end
|
||||
local to_col = math.max(vim.fn.getline(end_line):len(), 1)
|
||||
return {
|
||||
from = { line = start_line, col = 1 },
|
||||
to = { line = end_line, col = to_col },
|
||||
}
|
||||
end,
|
||||
l = function(ai_type)
|
||||
local line_num = vim.fn.line('.')
|
||||
local line = vim.fn.getline(line_num)
|
||||
if line == '' then
|
||||
return {
|
||||
from = { line = line_num, col = 1 },
|
||||
to = { line = line_num, col = 1 },
|
||||
}
|
||||
end
|
||||
local start_col, end_col
|
||||
if ai_type == 'i' then
|
||||
start_col = line:find('%S') or 1
|
||||
end_col = line:match('.*%S()') or 1
|
||||
else
|
||||
start_col, end_col = 1, line:len()
|
||||
end
|
||||
return {
|
||||
from = { line = line_num, col = start_col },
|
||||
to = { line = line_num, col = end_col },
|
||||
}
|
||||
end,
|
||||
I = function(ai_type)
|
||||
local cur_line = vim.fn.line('.')
|
||||
local cur_indent = vim.fn.indent(cur_line)
|
||||
if vim.fn.getline(cur_line):match('^%s*$') then
|
||||
local search_line = cur_line + 1
|
||||
while
|
||||
search_line <= vim.fn.line('$')
|
||||
and vim.fn.getline(search_line):match('^%s*$')
|
||||
do
|
||||
search_line = search_line + 1
|
||||
end
|
||||
if search_line <= vim.fn.line('$') then
|
||||
cur_indent = vim.fn.indent(search_line)
|
||||
end
|
||||
end
|
||||
local start_line, end_line = cur_line, cur_line
|
||||
while start_line > 1 do
|
||||
local prev = start_line - 1
|
||||
local prev_blank = vim.fn.getline(prev):match('^%s*$')
|
||||
if ai_type == 'i' and prev_blank then
|
||||
break
|
||||
end
|
||||
if
|
||||
not prev_blank
|
||||
and vim.fn.indent(prev) < cur_indent
|
||||
then
|
||||
break
|
||||
end
|
||||
start_line = prev
|
||||
end
|
||||
while end_line < vim.fn.line('$') do
|
||||
local next = end_line + 1
|
||||
local next_blank = vim.fn.getline(next):match('^%s*$')
|
||||
if ai_type == 'i' and next_blank then
|
||||
break
|
||||
end
|
||||
if
|
||||
not next_blank
|
||||
and vim.fn.indent(next) < cur_indent
|
||||
then
|
||||
break
|
||||
end
|
||||
end_line = next
|
||||
end
|
||||
local to_col = math.max(vim.fn.getline(end_line):len(), 1)
|
||||
return {
|
||||
from = { line = start_line, col = 1 },
|
||||
to = { line = end_line, col = to_col },
|
||||
}
|
||||
end,
|
||||
},
|
||||
},
|
||||
keys = {
|
||||
{ 'a', mode = { 'x', 'o' } },
|
||||
{ 'i', mode = { 'x', 'o' } },
|
||||
},
|
||||
},
|
||||
{
|
||||
'iamcco/markdown-preview.nvim',
|
||||
build = 'pnpm up && cd app && pnpm install',
|
||||
|
|
@ -40,7 +140,6 @@ return {
|
|||
},
|
||||
{
|
||||
'lervag/vimtex',
|
||||
enabled = false,
|
||||
init = function()
|
||||
vim.g.vimtex_view_method = 'general'
|
||||
vim.g.vimtex_compiler_method = 'latexmk'
|
||||
|
|
@ -49,88 +148,6 @@ return {
|
|||
end,
|
||||
ft = { 'plaintext', 'tex' },
|
||||
},
|
||||
{
|
||||
'L3MON4D3/LuaSnip',
|
||||
build = 'make install_jsregexp',
|
||||
config = function()
|
||||
local ls = require('luasnip')
|
||||
|
||||
ls.filetype_extend('htmldjango', { 'html' })
|
||||
ls.filetype_extend('markdown', { 'html' })
|
||||
ls.filetype_extend('javascriptreact', { 'javascript', 'html' })
|
||||
ls.filetype_extend('typescript', { 'javascript' })
|
||||
ls.filetype_extend(
|
||||
'typescriptreact',
|
||||
{ 'javascriptreact', 'javascript', 'html' }
|
||||
)
|
||||
|
||||
require('luasnip.loaders.from_lua').lazy_load()
|
||||
end,
|
||||
keys = {
|
||||
-- restore digraph mapping
|
||||
{ '<c-d>', '<c-k>', mode = 'i' },
|
||||
{
|
||||
'<c-space>',
|
||||
'<cmd>lua require("luasnip").expand()<cr>',
|
||||
mode = 'i',
|
||||
},
|
||||
{
|
||||
'<c-h>',
|
||||
'<cmd>lua if require("luasnip").jumpable(-1) then require("luasnip").jump(-1) end<cr>',
|
||||
mode = { 'i', 's' },
|
||||
},
|
||||
{
|
||||
'<c-l>',
|
||||
'<cmd>lua if require("luasnip").jumpable(1) then require("luasnip").jump(1) end<cr>',
|
||||
mode = { 'i', 's' },
|
||||
},
|
||||
{
|
||||
'<c-j>',
|
||||
'<cmd>lua if require("luasnip").choice_active() then require("luasnip").change_choice(-1) end<cr>',
|
||||
mode = 'i',
|
||||
},
|
||||
{
|
||||
'<c-k>',
|
||||
'<cmd>lua if require("luasnip").choice_active() then require("luasnip").change_choice(1) end<cr>',
|
||||
mode = 'i',
|
||||
},
|
||||
},
|
||||
opts = {
|
||||
region_check_events = 'InsertEnter',
|
||||
delete_check_events = {
|
||||
'TextChanged',
|
||||
'TextChangedI',
|
||||
'InsertLeave',
|
||||
},
|
||||
ext_opts = {
|
||||
[require('luasnip.util.types').choiceNode] = {
|
||||
active = {
|
||||
virt_text = {
|
||||
{
|
||||
' <- ',
|
||||
vim.wo.cursorline and 'CursorLine' or 'Normal',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
'laytan/cloak.nvim',
|
||||
config = true,
|
||||
keys = { { '<leader>Ct', '<cmd>CloakToggle<cr>' } },
|
||||
event = 'BufReadPre .env*',
|
||||
},
|
||||
{
|
||||
'maxmellon/vim-jsx-pretty',
|
||||
ft = {
|
||||
'javascript',
|
||||
'javascriptreact',
|
||||
'typescript',
|
||||
'typescriptreact',
|
||||
},
|
||||
},
|
||||
{
|
||||
'monaqa/dial.nvim',
|
||||
config = function(_)
|
||||
|
|
@ -208,31 +225,6 @@ return {
|
|||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
'cbochs/grapple.nvim',
|
||||
opts = {
|
||||
scope = 'git_branch',
|
||||
icons = false,
|
||||
status = false,
|
||||
win_opts = {
|
||||
title = '',
|
||||
footer = '',
|
||||
},
|
||||
},
|
||||
keys = {
|
||||
{ '<leader>ha', '<cmd>Grapple toggle<cr>' },
|
||||
{ '<leader>hd', '<cmd>Grapple untag<cr>' },
|
||||
{ '<leader>hq', '<cmd>Grapple toggle_tags<cr>' },
|
||||
|
||||
{ '<c-1>', '<cmd>Grapple select index=1<cr>' },
|
||||
{ '<c-2>', '<cmd>Grapple select index=2<cr>' },
|
||||
{ '<c-3>', '<cmd>Grapple select index=3<cr>' },
|
||||
{ '<c-4>', '<cmd>Grapple select index=4<cr>' },
|
||||
|
||||
{ ']h', '<cmd>Grapple cycle_tags next<cr>' },
|
||||
{ '[h', '<cmd>Grapple cycle_tags prev<cr>' },
|
||||
},
|
||||
},
|
||||
{
|
||||
'catgoose/nvim-colorizer.lua',
|
||||
opts = {
|
||||
|
|
@ -348,46 +340,6 @@ return {
|
|||
{ 'ySs', mode = 'n' },
|
||||
},
|
||||
},
|
||||
{
|
||||
'kana/vim-textobj-user',
|
||||
dependencies = {
|
||||
{
|
||||
'kana/vim-textobj-entire',
|
||||
keys = {
|
||||
{ 'ae', mode = { 'o', 'x' } },
|
||||
{ 'ie', mode = { 'o', 'x' } },
|
||||
},
|
||||
},
|
||||
{
|
||||
'kana/vim-textobj-line',
|
||||
keys = {
|
||||
{ 'al', mode = { 'o', 'x' } },
|
||||
{ 'il', mode = { 'o', 'x' } },
|
||||
},
|
||||
},
|
||||
{
|
||||
'kana/vim-textobj-indent',
|
||||
keys = {
|
||||
{ 'ai', mode = { 'o', 'x' } },
|
||||
{ 'ii', mode = { 'o', 'x' } },
|
||||
},
|
||||
},
|
||||
{
|
||||
'preservim/vim-textobj-sentence',
|
||||
keys = {
|
||||
{ 'as', mode = { 'o', 'x' } },
|
||||
{ 'is', mode = { 'o', 'x' } },
|
||||
},
|
||||
},
|
||||
{
|
||||
'whatyouhide/vim-textobj-xmlattr',
|
||||
keys = {
|
||||
{ 'ax', mode = { 'o', 'x' } },
|
||||
{ 'ix', mode = { 'o', 'x' } },
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
'saghen/blink.indent',
|
||||
opts = {
|
||||
|
|
@ -397,6 +349,7 @@ return {
|
|||
'fugitive',
|
||||
'markdown',
|
||||
'typst',
|
||||
'git',
|
||||
},
|
||||
},
|
||||
static = {
|
||||
|
|
@ -407,19 +360,9 @@ return {
|
|||
},
|
||||
{
|
||||
'barrettruth/midnight.nvim',
|
||||
init = function()
|
||||
vim.api.nvim_create_autocmd({ 'OptionSet' }, {
|
||||
pattern = 'background',
|
||||
callback = function()
|
||||
vim.cmd.colorscheme(
|
||||
vim.o.background == 'dark' and 'midnight' or 'daylight'
|
||||
)
|
||||
end,
|
||||
group = vim.api.nvim_create_augroup(
|
||||
'AColorScheme',
|
||||
{ clear = true }
|
||||
),
|
||||
})
|
||||
dir = '~/dev/midnight.nvim',
|
||||
config = function()
|
||||
vim.cmd.colorscheme('midnight')
|
||||
end,
|
||||
},
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,30 +28,8 @@ return {
|
|||
),
|
||||
})
|
||||
end,
|
||||
keys = {
|
||||
{
|
||||
'<leader>T',
|
||||
function()
|
||||
local lang_map = { htmldjango = 'html' }
|
||||
local bufnr = vim.api.nvim_get_current_buf()
|
||||
local parser = vim.treesitter.get_parser(bufnr)
|
||||
local lang = parser:lang()
|
||||
local path = (
|
||||
vim.env.NVIM_APPNAME or vim.fn.stdpath('config')
|
||||
)
|
||||
.. ('/after/queries/%s/highlights.scm'):format(
|
||||
lang_map[lang] or lang
|
||||
)
|
||||
|
||||
if vim.loop.fs_stat(path) then
|
||||
vim.fn.rename(path, path .. '.disabled')
|
||||
elseif vim.loop.fs_stat(path .. '.disabled') then
|
||||
vim.fn.rename(path .. '.disabled', path)
|
||||
end
|
||||
vim.cmd.TSBufToggle('highlight')
|
||||
vim.cmd.TSBufToggle('highlight')
|
||||
end,
|
||||
},
|
||||
opts = {
|
||||
auto_install = true,
|
||||
},
|
||||
},
|
||||
{
|
||||
|
|
@ -78,8 +56,6 @@ return {
|
|||
local select_maps = {
|
||||
{ 'aa', '@parameter.outer' },
|
||||
{ 'ia', '@parameter.inner' },
|
||||
{ 'ab', '@block.outer' },
|
||||
{ 'ib', '@block.inner' },
|
||||
{ 'as', '@class.outer' },
|
||||
{ 'is', '@class.inner' },
|
||||
{ 'aC', '@call.outer' },
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue