Updates, change vim keybinds
This commit is contained in:
parent
6d3c813c2b
commit
6093a01276
|
@ -12,6 +12,7 @@ fish_add_path -a /opt/homebrew/bin "/opt/homebrew/sbin"
|
|||
fish_add_path ~/Library/bin
|
||||
fish_add_path ~/Library/Application\ Support/Cargo/bin
|
||||
fish_add_path ~/.dotnet/tools
|
||||
fish_add_path ~/Library/Application\ Support/Go/bin
|
||||
|
||||
set -gx HOMEBREW_PREFIX "/opt/homebrew";
|
||||
set -gx HOMEBREW_CELLAR "/opt/homebrew/Cellar";
|
||||
|
|
2
mpd.conf
2
mpd.conf
|
@ -365,7 +365,7 @@ audio_output {
|
|||
type "osx"
|
||||
name "CoreAudio Default"
|
||||
mixer_type "software"
|
||||
replay_gain_handler "none"
|
||||
replay_gain_handler "software"
|
||||
hog_device "no"
|
||||
enabled "yes"
|
||||
always_on "no"
|
||||
|
|
|
@ -113,3 +113,20 @@ nnoremap <leader>fh <cmd>Telescope help_tags<cr>
|
|||
|
||||
filetype plugin on
|
||||
filetype indent on
|
||||
|
||||
" Use Skim as the VimTeX PDF viewer
|
||||
let g:vimtex_view_method = 'skim'
|
||||
|
||||
" press <Tab> to expand or jump in a snippet. These can also be mapped separately
|
||||
" via <Plug>luasnip-expand-snippet and <Plug>luasnip-jump-next.
|
||||
imap <silent><expr> <Tab> luasnip#expand_or_jumpable() ? '<Plug>luasnip-expand-or-jump' : '<Tab>'
|
||||
" -1 for jumping backwards.
|
||||
inoremap <silent> <S-Tab> <cmd>lua require'luasnip'.jump(-1)<Cr>
|
||||
|
||||
snoremap <silent> <Tab> <cmd>lua require('luasnip').jump(1)<Cr>
|
||||
snoremap <silent> <S-Tab> <cmd>lua require('luasnip').jump(-1)<Cr>
|
||||
|
||||
" For changing choices in choiceNodes (not strictly necessary for a basic setup).
|
||||
imap <silent><expr> <C-E> luasnip#choice_active() ? '<Plug>luasnip-next-choice' : '<C-E>'
|
||||
smap <silent><expr> <C-E> luasnip#choice_active() ? '<Plug>luasnip-next-choice' : '<C-E>'
|
||||
|
||||
|
|
|
@ -64,6 +64,7 @@ local lspkind = require('lspkind')
|
|||
luasnip.config.set_config {
|
||||
region_check_events = {'CursorMoved', 'InsertEnter'},
|
||||
delete_check_events = {'TextChanged', 'InsertLeave'},
|
||||
enable_autosnippets = true,
|
||||
}
|
||||
|
||||
cmp.setup {
|
||||
|
@ -79,10 +80,13 @@ cmp.setup {
|
|||
mapping = cmp.mapping.preset.insert({
|
||||
['<C-b>'] = cmp.mapping.scroll_docs(-4),
|
||||
['<C-f>'] = cmp.mapping.scroll_docs(4),
|
||||
['<C-j>'] = cmp.mapping.select_next_item(),
|
||||
['<C-k>'] = cmp.mapping.select_prev_item(),
|
||||
['<C-Space>'] = cmp.mapping.complete(),
|
||||
['<C-e>'] = cmp.mapping.abort(),
|
||||
['<CR>'] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
|
||||
['<Tab>'] = cmp.mapping(function(fallback)
|
||||
|
||||
--[[['<Tab>'] = cmp.mapping(function(fallback)
|
||||
if luasnip.expandable() then
|
||||
luasnip.expand()
|
||||
elseif cmp.visible() then
|
||||
|
@ -105,7 +109,7 @@ cmp.setup {
|
|||
else
|
||||
fallback()
|
||||
end
|
||||
end, {"i", "s", "c"}),
|
||||
end, {"i", "s", "c"}),]]
|
||||
}),
|
||||
sources = cmp.config.sources({
|
||||
{ name = 'nvim_lsp' },
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
local M = {}
|
||||
|
||||
M.pipe = function(fns)
|
||||
return function(...)
|
||||
for _, fn in ipairs(fns) do
|
||||
if not fn(...) then
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
return M
|
|
@ -0,0 +1,73 @@
|
|||
local M = {}
|
||||
|
||||
local MATH_NODES = {
|
||||
displayed_equation = true,
|
||||
inline_formula = true,
|
||||
math_environment = true,
|
||||
}
|
||||
|
||||
local TEXT_NODES = {
|
||||
text_mode = true,
|
||||
label_definition = true,
|
||||
label_reference = true,
|
||||
}
|
||||
|
||||
local function get_node_at_cursor()
|
||||
local pos = vim.api.nvim_win_get_cursor(0)
|
||||
-- Subtract one to account for 1-based row indexing in nvim_win_get_cursor
|
||||
local row, col = pos[1] - 1, pos[2]
|
||||
|
||||
local parser = vim.treesitter.get_parser(0, "latex")
|
||||
if not parser then
|
||||
return
|
||||
end
|
||||
|
||||
local root_tree = parser:parse({ row, col, row, col })[1]
|
||||
local root = root_tree and root_tree:root()
|
||||
if not root then
|
||||
return
|
||||
end
|
||||
|
||||
return root:named_descendant_for_range(row, col, row, col)
|
||||
end
|
||||
|
||||
function M.in_text()
|
||||
local node = get_node_at_cursor()
|
||||
while node do
|
||||
if node:type() == "text_mode" then
|
||||
--if check_parent then
|
||||
-- For \text{}
|
||||
local parent = node:parent()
|
||||
if parent and MATH_NODES[parent:type()] then
|
||||
return false
|
||||
end
|
||||
--end
|
||||
|
||||
return true
|
||||
elseif MATH_NODES[node:type()] then
|
||||
return false
|
||||
end
|
||||
node = node:parent()
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
function M.in_mathzone()
|
||||
local node = get_node_at_cursor()
|
||||
while node do
|
||||
if TEXT_NODES[node:type()] then
|
||||
return false
|
||||
elseif MATH_NODES[node:type()] then
|
||||
return true
|
||||
end
|
||||
node = node:parent()
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
M.no_backslash = function(line_to_cursor, matched_trigger)
|
||||
return not line_to_cursor:find("\\%a+$", -#line_to_cursor)
|
||||
end
|
||||
|
||||
return M
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
local ls = require("luasnip")
|
||||
local util = require("tex_tsutil")
|
||||
|
||||
return {
|
||||
ls.snippet(
|
||||
{
|
||||
trig = "df",
|
||||
wordTrig = false,
|
||||
name = "diff",
|
||||
snippetType = "autosnippet",
|
||||
condition = util.in_mathzone,
|
||||
}, {
|
||||
t("\\diff "),
|
||||
}
|
||||
),
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
local ls = require("luasnip")
|
||||
local tu = require("tex_tsutil")
|
||||
local su = require("snip_util")
|
||||
|
||||
local conds = require("luasnip.extras.expand_conditions")
|
||||
|
||||
local cond = su.pipe({ conds.line_begin, tu.in_text })
|
||||
|
||||
|
||||
-- Use extend_decorator to add the same condition to all.
|
||||
local s = ls.extend_decorator.apply(ls.snippet, {
|
||||
condition = cond,
|
||||
snippetType = "autosnippet",
|
||||
})
|
||||
|
||||
local ps = ls.extend_decorator.apply(ls.parser.parse_snippet, {
|
||||
condition = cond,
|
||||
snippetType = "autosnippet",
|
||||
})
|
||||
|
||||
return {
|
||||
ps({ trig = "bgn", name = "Environment"},
|
||||
"\\begin{$1}\n\t$0\n\\end{$1}"),
|
||||
}
|
Loading…
Reference in New Issue