Compare commits
3 Commits
fafcee66b1
...
6093a01276
Author | SHA1 | Date |
---|---|---|
Citlali del Rey | 6093a01276 | |
Citlali del Rey | 6d3c813c2b | |
Citlali del Rey | e6896269f8 |
|
@ -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"
|
||||
|
|
|
@ -1,7 +1,11 @@
|
|||
let g:mapleader = ","
|
||||
let g:maplocalleader = ","
|
||||
|
||||
lua require('plugins')
|
||||
lua require('lsp')
|
||||
|
||||
nmap <silent> <c-k> :wincmd k<CR>
|
||||
|
||||
map <silent> <c-k> :wincmd k<CR>
|
||||
nmap <silent> <c-j> :wincmd j<CR>
|
||||
nmap <silent> <c-h> :wincmd h<CR>
|
||||
nmap <silent> <c-l> :wincmd l<CR>
|
||||
|
@ -18,32 +22,15 @@ tnoremap <silent> <C-A-l> <Cmd>wincmd l<CR>
|
|||
|
||||
" Terminal
|
||||
command Terminal below 15sp term://$SHELL |startinsert
|
||||
autocmd TermOpen * set nonu
|
||||
autocmd BufEnter term://* startinsert
|
||||
autocmd BufLeave term://* stopinsert
|
||||
autocmd TermOpen * setlocal nonumber norelativenumber signcolumn=no
|
||||
|
||||
nnoremap <silent> <C-A-t> <Cmd>Terminal<CR>
|
||||
|
||||
" Move to previous/next
|
||||
nnoremap <silent> <A-,> <Cmd>BufferPrevious<CR>
|
||||
nnoremap <silent> <A-.> <Cmd>BufferNext<CR>
|
||||
" Re-order to previous/next
|
||||
nnoremap <silent> <A-<> <Cmd>BufferMovePrevious<CR>
|
||||
nnoremap <silent> <A->> <Cmd>BufferMoveNext<CR>
|
||||
nnoremap <silent> <A-1> <Cmd>BufferGoto 1<CR>
|
||||
nnoremap <silent> <A-2> <Cmd>BufferGoto 2<CR>
|
||||
nnoremap <silent> <A-3> <Cmd>BufferGoto 3<CR>
|
||||
nnoremap <silent> <A-4> <Cmd>BufferGoto 4<CR>
|
||||
nnoremap <silent> <A-5> <Cmd>BufferGoto 5<CR>
|
||||
nnoremap <silent> <A-6> <Cmd>BufferGoto 6<CR>
|
||||
nnoremap <silent> <A-7> <Cmd>BufferGoto 7<CR>
|
||||
nnoremap <silent> <A-8> <Cmd>BufferGoto 8<CR>
|
||||
nnoremap <silent> <A-9> <Cmd>BufferGoto 9<CR>
|
||||
nnoremap <silent> <A-0> <Cmd>BufferLast<CR>
|
||||
" Pin/unpin buffer
|
||||
nnoremap <silent> <A-p> <Cmd>BufferPin<CR>
|
||||
" Close buffer
|
||||
nnoremap <silent> <A-c> <Cmd>BufferClose<CR>
|
||||
nnoremap <silent> <A-,> <Cmd>bprevious<CR>
|
||||
nnoremap <silent> <A-.> <Cmd>bnext<CR>
|
||||
" Wipeout buffer
|
||||
" :BufferWipeout
|
||||
" Close commands
|
||||
|
@ -70,7 +57,7 @@ set background=light
|
|||
set completeopt=menu,menuone,noselect
|
||||
set tabstop=4
|
||||
set shiftwidth=0
|
||||
set number relativenumber
|
||||
set number relativenumber signcolumn=yes
|
||||
set mouse=a
|
||||
set cursorline
|
||||
set noexpandtab
|
||||
|
@ -103,4 +90,43 @@ let g:neovide_floating_blur_amount_x = 2.0
|
|||
let g:neovide_floating_blur_amount_y = 2.0
|
||||
let g:neovide_floating_opacity = 60
|
||||
|
||||
set guifont=SFMono\ Nerd\ Font
|
||||
set guifont=0xProto\ Nerd\ Font,Symbols\ Nerd\ Font\ Mono
|
||||
|
||||
sign define DiagnosticSignError text= texthl=DiagnosticSignError linehl= numhl=DiagnosticSignError
|
||||
sign define DiagnosticSignWarn text= texthl=DiagnosticSignWarn linehl= numhl=DiagnosticSignWarn
|
||||
sign define DiagnosticSignInfo text= texthl=DiagnosticSignInfo linehl= numhl=DiagnosticSignInfo
|
||||
sign define DiagnosticSignHint text= texthl=DiagnosticSignHint linehl= numhl=DiagnosticSignHint
|
||||
|
||||
" Trouble
|
||||
nnoremap <leader>xx <cmd>TroubleToggle<cr>
|
||||
nnoremap <leader>xw <cmd>TroubleToggle workspace_diagnostics<cr>
|
||||
nnoremap <leader>xd <cmd>TroubleToggle document_diagnostics<cr>
|
||||
nnoremap <leader>xq <cmd>TroubleToggle quickfix<cr>
|
||||
nnoremap <leader>xl <cmd>TroubleToggle loclist<cr>
|
||||
nnoremap gR <cmd>TroubleToggle lsp_references<cr>
|
||||
|
||||
" Telescope
|
||||
nnoremap <leader>ff <cmd>Telescope find_files<cr>
|
||||
nnoremap <leader>fg <cmd>Telescope live_grep<cr>
|
||||
nnoremap <leader>fb <cmd>Telescope buffers<cr>
|
||||
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>'
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
-- Mappings.
|
||||
-- See `:help vim.diagnostic.*` for documentation on any of the below functions
|
||||
local opts = { noremap = true, silent = true }
|
||||
vim.keymap.set('n', '<space>e', vim.diagnostic.open_float, opts)
|
||||
vim.keymap.set('n', '<leader>e', vim.diagnostic.open_float, opts)
|
||||
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, opts)
|
||||
vim.keymap.set('n', ']d', vim.diagnostic.goto_next, opts)
|
||||
vim.keymap.set('n', '<space>q', vim.diagnostic.setloclist, opts)
|
||||
vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, opts)
|
||||
|
||||
local navic = require("nvim-navic")
|
||||
|
||||
|
@ -22,22 +22,31 @@ local on_attach = function(client, bufnr)
|
|||
vim.keymap.set('n', 'K', vim.lsp.buf.hover, bufopts)
|
||||
vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, bufopts)
|
||||
vim.keymap.set('n', '<C-k>', vim.lsp.buf.signature_help, bufopts)
|
||||
vim.keymap.set('n', '<space>wa', vim.lsp.buf.add_workspace_folder, bufopts)
|
||||
vim.keymap.set('n', '<space>wr', vim.lsp.buf.remove_workspace_folder, bufopts)
|
||||
vim.keymap.set('n', '<space>wl', function()
|
||||
vim.keymap.set('n', '<leader>wa', vim.lsp.buf.add_workspace_folder, bufopts)
|
||||
vim.keymap.set('n', '<leader>wr', vim.lsp.buf.remove_workspace_folder, bufopts)
|
||||
vim.keymap.set('n', '<leader>wl', function()
|
||||
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
|
||||
end, bufopts)
|
||||
vim.keymap.set('n', '<space>D', vim.lsp.buf.type_definition, bufopts)
|
||||
vim.keymap.set('n', '<space>rn', vim.lsp.buf.rename, bufopts)
|
||||
vim.keymap.set('n', '<space>ca', vim.lsp.buf.code_action, bufopts)
|
||||
vim.keymap.set('n', '<leader>D', vim.lsp.buf.type_definition, bufopts)
|
||||
vim.keymap.set('n', '<leader>rn', vim.lsp.buf.rename, bufopts)
|
||||
vim.keymap.set('n', '<leader>ca', vim.lsp.buf.code_action, bufopts)
|
||||
vim.keymap.set('n', 'gr', vim.lsp.buf.references, bufopts)
|
||||
vim.keymap.set('n', '<space>f', function ()
|
||||
vim.keymap.set('n', '<leader>fm', function()
|
||||
vim.lsp.buf.format({ async = true })
|
||||
end, bufopts)
|
||||
|
||||
if client.server_capabilities.documentSymbolProvider then
|
||||
navic.attach(client, bufnr)
|
||||
end
|
||||
|
||||
vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, {
|
||||
virtual_text = {
|
||||
prefix = "",
|
||||
spacing = 4,
|
||||
},
|
||||
signs = true,
|
||||
underline = true,
|
||||
})
|
||||
end
|
||||
|
||||
local lsp_flags = {
|
||||
|
@ -52,7 +61,13 @@ local cmp = require('cmp')
|
|||
local luasnip = require('luasnip')
|
||||
local lspkind = require('lspkind')
|
||||
|
||||
cmp.setup({
|
||||
luasnip.config.set_config {
|
||||
region_check_events = {'CursorMoved', 'InsertEnter'},
|
||||
delete_check_events = {'TextChanged', 'InsertLeave'},
|
||||
enable_autosnippets = true,
|
||||
}
|
||||
|
||||
cmp.setup {
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
luasnip.lsp_expand(args.body)
|
||||
|
@ -60,14 +75,41 @@ cmp.setup({
|
|||
},
|
||||
window = {
|
||||
-- completion = cmp.config.window.bordered(),
|
||||
-- documentation = cmp.config.window.bordered(),
|
||||
documentation = cmp.config.window.bordered(),
|
||||
},
|
||||
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)
|
||||
if luasnip.expandable() then
|
||||
luasnip.expand()
|
||||
elseif cmp.visible() then
|
||||
if #cmp.get_entries() == 1 then
|
||||
cmp.confirm({ select = true})
|
||||
else
|
||||
cmp.select_next_item({ behavior = cmp.SelectBehavior.Select })
|
||||
end
|
||||
elseif luasnip.locally_jumpable() then
|
||||
luasnip.jump()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, {"i", "s", "c"}),
|
||||
['<S-Tab>'] = cmp.mapping(function (fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_prev_item({ behavior = cmp.SelectBehavior.Select })
|
||||
elseif luasnip.locally_jumpable(-1) then
|
||||
luasnip.jump(-1)
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, {"i", "s", "c"}),]]
|
||||
}),
|
||||
sources = cmp.config.sources({
|
||||
{ name = 'nvim_lsp' },
|
||||
|
@ -83,7 +125,7 @@ cmp.setup({
|
|||
maxwidth = 50,
|
||||
}),
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
cmp.setup.cmdline('/', {
|
||||
mapping = cmp.mapping.preset.cmdline(),
|
||||
|
@ -101,6 +143,9 @@ cmp.setup.cmdline(':', {
|
|||
})
|
||||
})
|
||||
|
||||
require "neodev".setup {
|
||||
}
|
||||
|
||||
mason.setup()
|
||||
mason_lspconfig.setup()
|
||||
|
||||
|
@ -123,6 +168,6 @@ mason_lspconfig.setup_handlers {
|
|||
}
|
||||
|
||||
|
||||
--for _, server in ipairs(lsp_installer.get_installed_servers()) do
|
||||
-- lspconfig[server.name].setup {}
|
||||
--end
|
||||
-- Load all snippets from the nvim/LuaSnip directory at startup
|
||||
require("luasnip.loaders.from_lua").load()
|
||||
|
||||
|
|
|
@ -7,10 +7,9 @@ require('packer').startup(function(use)
|
|||
use { 'nvim-treesitter/nvim-treesitter', run = ':TSUpdate' }
|
||||
|
||||
use { "ellisonleao/gruvbox.nvim" }
|
||||
|
||||
use 'neovim/nvim-lspconfig' -- Configurations for Nvim LSP
|
||||
|
||||
use{
|
||||
use {
|
||||
"williamboman/mason.nvim",
|
||||
"williamboman/mason-lspconfig.nvim",
|
||||
}
|
||||
|
@ -60,58 +59,64 @@ require('packer').startup(function(use)
|
|||
--use 'vim-airline/vim-airline-themes'
|
||||
|
||||
use 'lervag/vimtex'
|
||||
use 'folke/neodev.nvim'
|
||||
use 'kosayoda/nvim-lightbulb'
|
||||
use {
|
||||
'nvim-telescope/telescope.nvim', tag = '0.1.x',
|
||||
requires = { { 'nvim-lua/plenary.nvim' } }
|
||||
}
|
||||
end)
|
||||
|
||||
require("gruvbox").setup({
|
||||
undercurl = true,
|
||||
underline = true,
|
||||
bold = true,
|
||||
italic = {
|
||||
strings = true,
|
||||
comments = true,
|
||||
},
|
||||
strikethrough = true,
|
||||
invert_selection = false,
|
||||
invert_signs = false,
|
||||
invert_tabline = false,
|
||||
invert_intend_guides = false,
|
||||
inverse = true, -- invert background for search, diffs, statuslines and errors
|
||||
contrast = "soft", -- can be "hard", "soft" or empty string
|
||||
overrides = {},
|
||||
undercurl = true,
|
||||
underline = true,
|
||||
bold = true,
|
||||
italic = {
|
||||
strings = true,
|
||||
comments = true,
|
||||
},
|
||||
strikethrough = true,
|
||||
invert_selection = false,
|
||||
invert_signs = false,
|
||||
invert_tabline = false,
|
||||
invert_intend_guides = false,
|
||||
inverse = true, -- invert background for search, diffs, statuslines and errors
|
||||
contrast = "soft", -- can be "hard", "soft" or empty string
|
||||
overrides = {},
|
||||
})
|
||||
|
||||
require'nvim-treesitter.configs'.setup {
|
||||
-- A list of parser names, or "all"
|
||||
ensure_installed = "all",
|
||||
require 'nvim-treesitter.configs'.setup {
|
||||
-- A list of parser names, or "all"
|
||||
ensure_installed = "all",
|
||||
|
||||
-- Install parsers synchronously (only applied to `ensure_installed`)
|
||||
sync_install = false,
|
||||
-- Install parsers synchronously (only applied to `ensure_installed`)
|
||||
sync_install = false,
|
||||
|
||||
-- Automatically install missing parsers when entering buffer
|
||||
auto_install = true,
|
||||
-- Automatically install missing parsers when entering buffer
|
||||
auto_install = true,
|
||||
|
||||
-- List of parsers to ignore installing (for "all")
|
||||
ignore_install = { "phpdoc" },
|
||||
-- List of parsers to ignore installing (for "all")
|
||||
ignore_install = { "phpdoc" },
|
||||
|
||||
---- If you need to change the installation directory of the parsers (see -> Advanced Setup)
|
||||
-- parser_install_dir = "/some/path/to/store/parsers", -- Remember to run vim.opt.runtimepath:append("/some/path/to/store/parsers")!
|
||||
---- If you need to change the installation directory of the parsers (see -> Advanced Setup)
|
||||
-- parser_install_dir = "/some/path/to/store/parsers", -- Remember to run vim.opt.runtimepath:append("/some/path/to/store/parsers")!
|
||||
|
||||
highlight = {
|
||||
-- `false` will disable the whole extension
|
||||
enable = true,
|
||||
highlight = {
|
||||
-- `false` will disable the whole extension
|
||||
enable = true,
|
||||
|
||||
-- NOTE: these are the names of the parsers and not the filetype. (for example if you want to
|
||||
-- disable highlighting for the `tex` filetype, you need to include `latex` in this list as this is
|
||||
-- the name of the parser)
|
||||
-- list of language that will be disabled
|
||||
disable = { },
|
||||
-- NOTE: these are the names of the parsers and not the filetype. (for example if you want to
|
||||
-- disable highlighting for the `tex` filetype, you need to include `latex` in this list as this is
|
||||
-- the name of the parser)
|
||||
-- list of language that will be disabled
|
||||
disable = {},
|
||||
|
||||
-- Setting this to true will run `:h syntax` and tree-sitter at the same time.
|
||||
-- Set this to `true` if you depend on 'syntax' being enabled (like for indentation).
|
||||
-- Using this option may slow down your editor, and you may see some duplicate highlights.
|
||||
-- Instead of true it can also be a list of languages
|
||||
additional_vim_regex_highlighting = false,
|
||||
},
|
||||
-- Setting this to true will run `:h syntax` and tree-sitter at the same time.
|
||||
-- Set this to `true` if you depend on 'syntax' being enabled (like for indentation).
|
||||
-- Using this option may slow down your editor, and you may see some duplicate highlights.
|
||||
-- Instead of true it can also be a list of languages
|
||||
additional_vim_regex_highlighting = false,
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
|
@ -138,17 +143,24 @@ require('lualine').setup {
|
|||
options = {
|
||||
icons_enabled = true,
|
||||
theme = 'gruvbox',
|
||||
component_separators = { left = '', right = ''},
|
||||
section_separators = { left = '', right = ''},
|
||||
component_separators = { left = '', right = '' },
|
||||
section_separators = { left = '', right = '' },
|
||||
disabled_filetypes = {
|
||||
statusline = {},
|
||||
statusline = {
|
||||
"neo-tree",
|
||||
},
|
||||
winbar = {
|
||||
"help",
|
||||
"terminal",
|
||||
"TERMINAL",
|
||||
"fish",
|
||||
"term",
|
||||
"startify",
|
||||
"dashboard",
|
||||
"packer",
|
||||
"neogitstatus",
|
||||
"NvimTree",
|
||||
"neo-tree",
|
||||
"Trouble",
|
||||
"alpha",
|
||||
"lir",
|
||||
|
@ -167,18 +179,29 @@ require('lualine').setup {
|
|||
}
|
||||
},
|
||||
sections = {
|
||||
lualine_a = {'mode'},
|
||||
lualine_b = {'diff', 'diagnostics'},
|
||||
lualine_c = {'filename'},
|
||||
lualine_x = {'encoding', 'fileformat', 'filetype'},
|
||||
lualine_y = {'progress'},
|
||||
lualine_z = {'location'}
|
||||
lualine_a = { 'mode' },
|
||||
lualine_b = {
|
||||
'diff',
|
||||
{
|
||||
'diagnostics',
|
||||
symbols = {
|
||||
error = ' ',
|
||||
warn = ' ',
|
||||
info = ' ',
|
||||
hint = ' ',
|
||||
},
|
||||
},
|
||||
},
|
||||
lualine_c = { 'filename' },
|
||||
lualine_x = { 'encoding', 'fileformat', 'filetype' },
|
||||
lualine_y = { 'progress' },
|
||||
lualine_z = { 'location' }
|
||||
},
|
||||
inactive_sections = {
|
||||
lualine_a = {},
|
||||
lualine_b = {},
|
||||
lualine_c = {'filename'},
|
||||
lualine_x = {'location'},
|
||||
lualine_c = { 'filename' },
|
||||
lualine_x = { 'location' },
|
||||
lualine_y = {},
|
||||
lualine_z = {},
|
||||
},
|
||||
|
@ -192,13 +215,13 @@ require('lualine').setup {
|
|||
lualine_b = {
|
||||
"branch"
|
||||
},
|
||||
lualine_c = {'hostname'},
|
||||
lualine_c = { 'hostname' },
|
||||
lualine_x = {},
|
||||
lualine_y = {},
|
||||
lualine_z = {'tabs', 'datetime'},
|
||||
lualine_z = { 'tabs', { 'datetime', style = 'iso' } },
|
||||
},
|
||||
winbar = {
|
||||
lualine_a = {'searchcount'},
|
||||
lualine_a = { 'searchcount' },
|
||||
lualine_b = {},
|
||||
lualine_c = {
|
||||
"filename",
|
||||
|
@ -221,35 +244,38 @@ require('lualine').setup {
|
|||
},
|
||||
extensions = {}
|
||||
}
|
||||
require'nvim-navic'.setup {
|
||||
icons = {
|
||||
File = ' ',
|
||||
Module = ' ',
|
||||
Namespace = ' ',
|
||||
Package = ' ',
|
||||
Class = ' ',
|
||||
Method = ' ',
|
||||
Property = ' ',
|
||||
Field = ' ',
|
||||
Constructor = ' ',
|
||||
Enum = ' ',
|
||||
Interface = ' ',
|
||||
Function = ' ',
|
||||
Variable = ' ',
|
||||
Constant = ' ',
|
||||
String = ' ',
|
||||
Number = ' ',
|
||||
Boolean = ' ',
|
||||
Array = ' ',
|
||||
Object = ' ',
|
||||
Key = ' ',
|
||||
Null = ' ',
|
||||
EnumMember = ' ',
|
||||
Struct = ' ',
|
||||
Event = ' ',
|
||||
Operator = ' ',
|
||||
TypeParameter = ' ',
|
||||
},
|
||||
separator = ' ',
|
||||
require 'nvim-navic'.setup {
|
||||
icons = {
|
||||
File = ' ',
|
||||
Module = ' ',
|
||||
Namespace = ' ',
|
||||
Package = ' ',
|
||||
Class = ' ',
|
||||
Method = ' ',
|
||||
Property = ' ',
|
||||
Field = ' ',
|
||||
Constructor = ' ',
|
||||
Enum = ' ',
|
||||
Interface = ' ',
|
||||
Function = ' ',
|
||||
Variable = ' ',
|
||||
Constant = ' ',
|
||||
String = ' ',
|
||||
Number = ' ',
|
||||
Boolean = ' ',
|
||||
Array = ' ',
|
||||
Object = ' ',
|
||||
Key = ' ',
|
||||
Null = ' ',
|
||||
EnumMember = ' ',
|
||||
Struct = ' ',
|
||||
Event = ' ',
|
||||
Operator = ' ',
|
||||
TypeParameter = ' ',
|
||||
},
|
||||
separator = ' ',
|
||||
}
|
||||
|
||||
require 'nvim-lightbulb'.setup {
|
||||
autocmd = { enabled = true }
|
||||
}
|
||||
|
|
|
@ -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