changes
This commit is contained in:
parent
5bdde24dfb
commit
0081252e35
140
init.lua
140
init.lua
|
|
@ -90,8 +90,10 @@ P.S. You can delete this when you're done too. It's your config now! :)
|
|||
vim.g.mapleader = ' '
|
||||
vim.g.maplocalleader = ' '
|
||||
|
||||
vim.g.tex_flavor = 'latex'
|
||||
|
||||
-- Set to true if you have a Nerd Font installed and selected in the terminal
|
||||
vim.g.have_nerd_font = false
|
||||
vim.g.have_nerd_font = true
|
||||
|
||||
-- [[ Setting options ]]
|
||||
-- See `:help vim.opt`
|
||||
|
|
@ -102,7 +104,7 @@ vim.g.have_nerd_font = false
|
|||
vim.opt.number = true
|
||||
-- You can also add relative line numbers, to help with jumping.
|
||||
-- Experiment for yourself to see if you like it!
|
||||
-- vim.opt.relativenumber = true
|
||||
vim.opt.relativenumber = true
|
||||
|
||||
-- Enable mouse mode, can be useful for resizing splits for example!
|
||||
vim.opt.mouse = 'a'
|
||||
|
|
@ -156,6 +158,9 @@ vim.opt.cursorline = true
|
|||
-- Minimal number of screen lines to keep above and below the cursor.
|
||||
vim.opt.scrolloff = 10
|
||||
|
||||
vim.opt.shiftwidth = 4
|
||||
vim.opt.tabstop = 4
|
||||
|
||||
-- [[ Basic Keymaps ]]
|
||||
-- See `:help vim.keymap.set()`
|
||||
|
||||
|
|
@ -164,7 +169,7 @@ vim.opt.scrolloff = 10
|
|||
vim.keymap.set('n', '<Esc>', '<cmd>nohlsearch<CR>')
|
||||
|
||||
-- Diagnostic keymaps
|
||||
vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, { desc = 'Open diagnostic [Q]uickfix list' })
|
||||
vim.keymap.set('n', '<leader>d', vim.diagnostic.setloclist, { desc = 'Open Diagnostic Quickfix list' })
|
||||
|
||||
-- Exit terminal mode in the builtin terminal with a shortcut that is a bit easier
|
||||
-- for people to discover. Otherwise, you normally need to press <C-\><C-n>, which
|
||||
|
|
@ -228,7 +233,7 @@ vim.opt.rtp:prepend(lazypath)
|
|||
-- NOTE: Here is where you install your plugins.
|
||||
require('lazy').setup({
|
||||
-- NOTE: Plugins can be added with a link (or for a github repo: 'owner/repo' link).
|
||||
'tpope/vim-sleuth', -- Detect tabstop and shiftwidth automatically
|
||||
-- 'tpope/vim-sleuth', -- Detect tabstop and shiftwidth automatically
|
||||
|
||||
-- NOTE: Plugins can also be added by using a table,
|
||||
-- with the first argument being the link and the following
|
||||
|
|
@ -315,12 +320,8 @@ require('lazy').setup({
|
|||
|
||||
-- Document existing key chains
|
||||
spec = {
|
||||
{ '<leader>c', group = '[C]ode', mode = { 'n', 'x' } },
|
||||
{ '<leader>d', group = '[D]ocument' },
|
||||
{ '<leader>r', group = '[R]ename' },
|
||||
{ '<leader>s', group = '[S]earch' },
|
||||
{ '<leader>w', group = '[W]orkspace' },
|
||||
{ '<leader>t', group = '[T]oggle' },
|
||||
{ '<leader>f', group = 'Telescope Find' },
|
||||
{ '<leader>c', group = 'Config Toggle' },
|
||||
{ '<leader>h', group = 'Git [H]unk', mode = { 'n', 'v' } },
|
||||
},
|
||||
},
|
||||
|
|
@ -402,39 +403,39 @@ require('lazy').setup({
|
|||
|
||||
-- See `:help telescope.builtin`
|
||||
local builtin = require 'telescope.builtin'
|
||||
vim.keymap.set('n', '<leader>sh', builtin.help_tags, { desc = '[S]earch [H]elp' })
|
||||
vim.keymap.set('n', '<leader>sk', builtin.keymaps, { desc = '[S]earch [K]eymaps' })
|
||||
vim.keymap.set('n', '<leader>sf', builtin.find_files, { desc = '[S]earch [F]iles' })
|
||||
vim.keymap.set('n', '<leader>ss', builtin.builtin, { desc = '[S]earch [S]elect Telescope' })
|
||||
vim.keymap.set('n', '<leader>sw', builtin.grep_string, { desc = '[S]earch current [W]ord' })
|
||||
vim.keymap.set('n', '<leader>sg', builtin.live_grep, { desc = '[S]earch by [G]rep' })
|
||||
vim.keymap.set('n', '<leader>sd', builtin.diagnostics, { desc = '[S]earch [D]iagnostics' })
|
||||
vim.keymap.set('n', '<leader>sr', builtin.resume, { desc = '[S]earch [R]esume' })
|
||||
vim.keymap.set('n', '<leader>s.', builtin.oldfiles, { desc = '[S]earch Recent Files ("." for repeat)' })
|
||||
vim.keymap.set('n', '<leader><leader>', builtin.buffers, { desc = '[ ] Find existing buffers' })
|
||||
vim.keymap.set('n', '<leader>fh', builtin.help_tags, { desc = 'Telescope Help Tags' })
|
||||
vim.keymap.set('n', '<leader>fk', builtin.keymaps, { desc = 'Telescope Keymaps' })
|
||||
vim.keymap.set('n', '<leader>ff', builtin.find_files, { desc = 'Telescope Find Files' })
|
||||
-- vim.keymap.set('n', '<leader>fs', builtin.builtin, { desc = '[F]ind [S]elect Telescope' })
|
||||
-- vim.keymap.set('n', '<leader>fw', builtin.grep_string, { desc = '[F]ind current [W]ord' })
|
||||
vim.keymap.set('n', '<leader>fg', builtin.live_grep, { desc = 'Telescope Live Grep' })
|
||||
-- vim.keymap.set('n', '<leader>fd', builtin.diagnostics, { desc = '[F]ind [D]iagnostics' })
|
||||
-- vim.keymap.set('n', '<leader>fr', builtin.resume, { desc = '[F]ind [R]esume' })
|
||||
-- vim.keymap.set('n', '<leader>f.', builtin.oldfiles, { desc = '[F]ind Recent Files ("." for repeat)' })
|
||||
vim.keymap.set('n', '<leader><leader>', builtin.buffers, { desc = 'Telescope Buffers' })
|
||||
|
||||
-- Slightly advanced example of overriding default behavior and theme
|
||||
vim.keymap.set('n', '<leader>/', function()
|
||||
-- vim.keymap.set('n', '<leader>/', function()
|
||||
-- You can pass additional configuration to Telescope to change the theme, layout, etc.
|
||||
builtin.current_buffer_fuzzy_find(require('telescope.themes').get_dropdown {
|
||||
winblend = 10,
|
||||
previewer = false,
|
||||
})
|
||||
end, { desc = '[/] Fuzzily search in current buffer' })
|
||||
-- builtin.current_buffer_fuzzy_find(require('telescope.themes').get_dropdown {
|
||||
-- winblend = 10,
|
||||
-- previewer = false,
|
||||
-- })
|
||||
-- end, { desc = '[/] Fuzzily search in current buffer' })
|
||||
|
||||
-- It's also possible to pass additional configuration options.
|
||||
-- See `:help telescope.builtin.live_grep()` for information about particular keys
|
||||
vim.keymap.set('n', '<leader>s/', function()
|
||||
vim.keymap.set('n', '<leader>f/', function()
|
||||
builtin.live_grep {
|
||||
grep_open_files = true,
|
||||
prompt_title = 'Live Grep in Open Files',
|
||||
}
|
||||
end, { desc = '[S]earch [/] in Open Files' })
|
||||
end, { desc = 'Telescope Live Grep in Open Files' })
|
||||
|
||||
-- Shortcut for searching your Neovim configuration files
|
||||
vim.keymap.set('n', '<leader>sn', function()
|
||||
vim.keymap.set('n', '<leader>fn', function()
|
||||
builtin.find_files { cwd = vim.fn.stdpath 'config' }
|
||||
end, { desc = '[S]earch [N]eovim files' })
|
||||
end, { desc = 'Telescope Nvim Files' })
|
||||
end,
|
||||
},
|
||||
|
||||
|
|
@ -514,39 +515,39 @@ require('lazy').setup({
|
|||
-- Jump to the definition of the word under your cursor.
|
||||
-- This is where a variable was first declared, or where a function is defined, etc.
|
||||
-- To jump back, press <C-t>.
|
||||
map('gd', require('telescope.builtin').lsp_definitions, '[G]oto [D]efinition')
|
||||
map('gd', require('telescope.builtin').lsp_definitions, 'Goto Definition')
|
||||
|
||||
-- Find references for the word under your cursor.
|
||||
map('gr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences')
|
||||
map('grr', require('telescope.builtin').lsp_references, 'Goto References')
|
||||
|
||||
-- Jump to the implementation of the word under your cursor.
|
||||
-- Useful when your language has ways of declaring types without an actual implementation.
|
||||
map('gI', require('telescope.builtin').lsp_implementations, '[G]oto [I]mplementation')
|
||||
map('gI', require('telescope.builtin').lsp_implementations, 'Goto Implementation')
|
||||
|
||||
-- Jump to the type of the word under your cursor.
|
||||
-- Useful when you're not sure what type a variable is and you want to see
|
||||
-- the definition of its *type*, not where it was *defined*.
|
||||
map('<leader>D', require('telescope.builtin').lsp_type_definitions, 'Type [D]efinition')
|
||||
map('gDt', require('telescope.builtin').lsp_type_definitions, 'Goto Type Definition')
|
||||
|
||||
-- Fuzzy find all the symbols in your current document.
|
||||
-- Symbols are things like variables, functions, types, etc.
|
||||
map('<leader>ds', require('telescope.builtin').lsp_document_symbols, '[D]ocument [S]ymbols')
|
||||
map('<leader>fd', require('telescope.builtin').lsp_document_symbols, 'Telescope Document Symbols')
|
||||
|
||||
-- Fuzzy find all the symbols in your current workspace.
|
||||
-- Similar to document symbols, except searches over your entire project.
|
||||
map('<leader>ws', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols')
|
||||
map('<leader>fw', require('telescope.builtin').lsp_dynamic_workspace_symbols, 'Telescope Workspace Symbols')
|
||||
|
||||
-- Rename the variable under your cursor.
|
||||
-- Most Language Servers support renaming across files, etc.
|
||||
map('<leader>rn', vim.lsp.buf.rename, '[R]e[n]ame')
|
||||
map('grn', vim.lsp.buf.rename, 'Rename')
|
||||
|
||||
-- Execute a code action, usually your cursor needs to be on top of an error
|
||||
-- or a suggestion from your LSP for this to activate.
|
||||
map('<leader>ca', vim.lsp.buf.code_action, '[C]ode [A]ction', { 'n', 'x' })
|
||||
map('gra', vim.lsp.buf.code_action, 'Code Action', { 'n', 'x' })
|
||||
|
||||
-- WARN: This is not Goto Definition, this is Goto Declaration.
|
||||
-- For example, in C this would take you to the header.
|
||||
map('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration')
|
||||
map('gDd', vim.lsp.buf.declaration, 'Goto Declaration')
|
||||
|
||||
-- The following two autocommands are used to highlight references of the
|
||||
-- word under your cursor when your cursor rests there for a little while.
|
||||
|
|
@ -582,9 +583,9 @@ require('lazy').setup({
|
|||
--
|
||||
-- This may be unwanted, since they displace some of your code
|
||||
if client and client.supports_method(vim.lsp.protocol.Methods.textDocument_inlayHint) then
|
||||
map('<leader>th', function()
|
||||
map('<leader>ch', function()
|
||||
vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled { bufnr = event.buf })
|
||||
end, '[T]oggle Inlay [H]ints')
|
||||
end, 'Toggle Inlay Hints')
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
|
@ -618,8 +619,8 @@ require('lazy').setup({
|
|||
local servers = {
|
||||
-- clangd = {},
|
||||
-- gopls = {},
|
||||
-- pyright = {},
|
||||
-- rust_analyzer = {},
|
||||
pyright = {},
|
||||
rust_analyzer = {},
|
||||
-- ... etc. See `:help lspconfig-all` for a list of all the pre-configured LSPs
|
||||
--
|
||||
-- Some languages (like typescript) have entire language plugins that can be useful:
|
||||
|
|
@ -639,7 +640,7 @@ require('lazy').setup({
|
|||
callSnippet = 'Replace',
|
||||
},
|
||||
-- You can toggle below to ignore Lua_LS's noisy `missing-fields` warnings
|
||||
-- diagnostics = { disable = { 'missing-fields' } },
|
||||
diagnostics = { disable = { 'missing-fields' } },
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
@ -675,6 +676,7 @@ require('lazy').setup({
|
|||
require('lspconfig')[server_name].setup(server)
|
||||
end,
|
||||
},
|
||||
automatic_installation = true,
|
||||
}
|
||||
end,
|
||||
},
|
||||
|
|
@ -685,12 +687,12 @@ require('lazy').setup({
|
|||
cmd = { 'ConformInfo' },
|
||||
keys = {
|
||||
{
|
||||
'<leader>f',
|
||||
'<leader>p',
|
||||
function()
|
||||
require('conform').format { async = true, lsp_format = 'fallback' }
|
||||
end,
|
||||
mode = '',
|
||||
desc = '[F]ormat buffer',
|
||||
desc = 'format',
|
||||
},
|
||||
},
|
||||
opts = {
|
||||
|
|
@ -738,6 +740,9 @@ require('lazy').setup({
|
|||
end
|
||||
return 'make install_jsregexp'
|
||||
end)(),
|
||||
config = function(_, _)
|
||||
-- require('luasnip.loaders.from_lua').lazy_load { paths = './lua/luasnippets/' }
|
||||
end,
|
||||
dependencies = {
|
||||
-- `friendly-snippets` contains a variety of premade snippets.
|
||||
-- See the README about individual language/framework/plugin snippets:
|
||||
|
|
@ -750,8 +755,10 @@ require('lazy').setup({
|
|||
-- },
|
||||
},
|
||||
},
|
||||
'saadparwaiz1/cmp_luasnip',
|
||||
|
||||
{
|
||||
'franchioping/cmp_luasnip',
|
||||
dev = true,
|
||||
},
|
||||
-- Adds other completion capabilities.
|
||||
-- nvim-cmp does not ship with all sources by default. They are split
|
||||
-- into multiple repos for maintenance purposes.
|
||||
|
|
@ -762,7 +769,7 @@ require('lazy').setup({
|
|||
-- See `:help cmp`
|
||||
local cmp = require 'cmp'
|
||||
local luasnip = require 'luasnip'
|
||||
luasnip.config.setup {}
|
||||
luasnip.config.setup { enable_autosnippets = true }
|
||||
|
||||
cmp.setup {
|
||||
snippet = {
|
||||
|
|
@ -789,7 +796,7 @@ require('lazy').setup({
|
|||
-- Accept ([y]es) the completion.
|
||||
-- This will auto-import if your LSP supports it.
|
||||
-- This will expand snippets if the LSP sent a snippet.
|
||||
['<C-y>'] = cmp.mapping.confirm { select = true },
|
||||
['<C-Space>'] = cmp.mapping.confirm { select = true },
|
||||
|
||||
-- If you prefer more traditional completion keymaps,
|
||||
-- you can uncomment the following lines
|
||||
|
|
@ -800,7 +807,7 @@ require('lazy').setup({
|
|||
-- Manually trigger a completion from nvim-cmp.
|
||||
-- Generally you don't need this, because nvim-cmp will display
|
||||
-- completions whenever it has completion options available.
|
||||
['<C-Space>'] = cmp.mapping.complete {},
|
||||
['<C-S-Space>'] = cmp.mapping.complete {},
|
||||
|
||||
-- Think of <c-l> as moving to the right of your snippet expansion.
|
||||
-- So if you have a snippet that's like:
|
||||
|
|
@ -810,12 +817,12 @@ require('lazy').setup({
|
|||
--
|
||||
-- <c-l> will move you to the right of each of the expansion locations.
|
||||
-- <c-h> is similar, except moving you backwards.
|
||||
['<C-l>'] = cmp.mapping(function()
|
||||
if luasnip.expand_or_locally_jumpable() then
|
||||
luasnip.expand_or_jump()
|
||||
['<Tab>'] = cmp.mapping(function()
|
||||
if luasnip.locally_jumpable(1) then
|
||||
luasnip.jump(1)
|
||||
end
|
||||
end, { 'i', 's' }),
|
||||
['<C-h>'] = cmp.mapping(function()
|
||||
['<S-Tab>'] = cmp.mapping(function()
|
||||
if luasnip.locally_jumpable(-1) then
|
||||
luasnip.jump(-1)
|
||||
end
|
||||
|
|
@ -831,7 +838,10 @@ require('lazy').setup({
|
|||
group_index = 0,
|
||||
},
|
||||
{ name = 'nvim_lsp' },
|
||||
{ name = 'luasnip' },
|
||||
{ name = 'luasnip', opts = { label_aliases = {
|
||||
['(?<!\\\\)(sec)'] = 'sec',
|
||||
['(?<!\\\\)(sec*)'] = 'sec*',
|
||||
} } },
|
||||
{ name = 'path' },
|
||||
},
|
||||
}
|
||||
|
|
@ -911,6 +921,7 @@ require('lazy').setup({
|
|||
-- If you are experiencing weird indenting issues, add the language to
|
||||
-- the list of additional_vim_regex_highlighting and disabled languages for indent.
|
||||
additional_vim_regex_highlighting = { 'ruby' },
|
||||
disable = { 'latex' },
|
||||
},
|
||||
indent = { enable = true, disable = { 'ruby' } },
|
||||
},
|
||||
|
|
@ -933,8 +944,8 @@ require('lazy').setup({
|
|||
--
|
||||
-- require 'kickstart.plugins.debug',
|
||||
-- require 'kickstart.plugins.indent_line',
|
||||
-- require 'kickstart.plugins.lint',
|
||||
-- require 'kickstart.plugins.autopairs',
|
||||
require 'kickstart.plugins.lint',
|
||||
require 'kickstart.plugins.autopairs',
|
||||
-- require 'kickstart.plugins.neo-tree',
|
||||
-- require 'kickstart.plugins.gitsigns', -- adds gitsigns recommend keymaps
|
||||
|
||||
|
|
@ -942,7 +953,7 @@ require('lazy').setup({
|
|||
-- This is the easiest way to modularize your config.
|
||||
--
|
||||
-- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going.
|
||||
-- { import = 'custom.plugins' },
|
||||
{ import = 'custom.plugins' },
|
||||
--
|
||||
-- For additional information with loading, sourcing and examples see `:help lazy.nvim-🔌-plugin-spec`
|
||||
-- Or use telescope!
|
||||
|
|
@ -968,7 +979,18 @@ require('lazy').setup({
|
|||
lazy = '💤 ',
|
||||
},
|
||||
},
|
||||
dev = {
|
||||
-- Directory where you store your local plugin projects. If a function is used,
|
||||
-- the plugin directory (e.g. `~/projects/plugin-name`) must be returned.
|
||||
---@type string | fun(plugin: LazyPlugin): string
|
||||
path = './devplugins',
|
||||
---@type string[] plugins that match these patterns will use your local versions instead of being fetched from GitHub
|
||||
patterns = {}, -- For example {"folke"}
|
||||
fallback = true, -- Fallback to git when local plugin doesn't exist
|
||||
},
|
||||
})
|
||||
|
||||
require 'custom.custom-keybinds'
|
||||
|
||||
-- The line beneath this is called `modeline`. See `:help modeline`
|
||||
-- vim: ts=2 sts=2 sw=2 et
|
||||
|
|
|
|||
|
|
@ -0,0 +1,50 @@
|
|||
-- local function map(mode, lhs, rhs, opts)
|
||||
-- local options = { noremap = true, silent = true }
|
||||
-- if opts then
|
||||
-- if opts.desc then
|
||||
-- opts.desc = 'keymaps.lua: ' .. opts.desc
|
||||
-- end
|
||||
-- options = vim.tbl_extend('force', options, opts)
|
||||
-- end
|
||||
-- vim.keymap.set(mode, lhs, rhs, options)
|
||||
-- end
|
||||
--
|
||||
-- vim.keymap.set('n', '<leader>/', 'gcc', { remap = true })
|
||||
-- vim.keymap.set('v', '<leader>/', 'gc', { remap = true })
|
||||
--
|
||||
|
||||
local operator_rhs = function()
|
||||
return require('vim._comment').operator()
|
||||
end
|
||||
vim.keymap.set({ 'x' }, '<leader>/', operator_rhs, { expr = true, desc = 'Toggle comment' })
|
||||
|
||||
local line_rhs = function()
|
||||
return require('vim._comment').operator() .. '_'
|
||||
end
|
||||
vim.keymap.set('n', '<leader>/', line_rhs, { expr = true, desc = 'Toggle comment line' })
|
||||
|
||||
vim.g.tex_flavor = 'latex'
|
||||
|
||||
local list_snips = function()
|
||||
local ft_list = require('luasnip').available()[vim.o.filetype]
|
||||
local ft_snips = {}
|
||||
for _, item in pairs(ft_list) do
|
||||
ft_snips[item.trigger] = item.name
|
||||
end
|
||||
print(vim.inspect(ft_snips))
|
||||
end
|
||||
|
||||
vim.api.nvim_create_user_command('SnipList', list_snips, {})
|
||||
|
||||
local list_all_snips = function()
|
||||
local ft_lists = require('luasnip').available()
|
||||
local ft_snips = {}
|
||||
for _, ft_list in pairs(ft_lists) do
|
||||
for _, item in pairs(ft_list) do
|
||||
ft_snips[item.trigger] = item.name
|
||||
end
|
||||
end
|
||||
print(vim.inspect(ft_snips))
|
||||
end
|
||||
|
||||
vim.api.nvim_create_user_command('SnipListAll', list_all_snips, {})
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
return {
|
||||
-- {
|
||||
-- 'akinsho/toggleterm.nvim',
|
||||
-- version = '*',
|
||||
-- opts = {--[[ things you want to change go here]]
|
||||
-- },
|
||||
-- keys = {
|
||||
-- { '<leader>t', ':ToggleTerm direction=float<CR>', desc = 'Terminal', silent = true },
|
||||
-- },
|
||||
-- config = function()
|
||||
-- local opts = { buffer = 0 }
|
||||
-- vim.keymap.set('t', '<esc>', [[<C-\><C-n>]], opts)
|
||||
-- vim.keymap.set('t', 'jk', [[<C-\><C-n>]], opts)
|
||||
-- vim.keymap.set('t', '<C-h>', [[<Cmd>wincmd h<CR>]], opts)
|
||||
-- vim.keymap.set('t', '<C-j>', [[<Cmd>wincmd j<CR>]], opts)
|
||||
-- vim.keymap.set('t', '<C-k>', [[<Cmd>wincmd k<CR>]], opts)
|
||||
-- vim.keymap.set('t', '<C-l>', [[<Cmd>wincmd l<CR>]], opts)
|
||||
-- vim.keymap.set('t', '<C-w>', [[<C-\><C-n><C-w>]], opts)
|
||||
-- end,
|
||||
-- },
|
||||
}
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
-- You can add your own plugins here or in other files in this directory!
|
||||
-- I promise not to create any merge conflicts in this directory :)
|
||||
--
|
||||
-- See the kickstart.nvim README for more information
|
||||
return {}
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
return {
|
||||
|
||||
{
|
||||
'lervag/vimtex',
|
||||
lazy = false, -- we don't want to lazy load VimTeX
|
||||
-- tag = "v2.15", -- uncomment to pin to a specific release
|
||||
init = function()
|
||||
-- VimTeX configuration goes here, e.g.
|
||||
vim.g.vimtex_view_method = 'zathura'
|
||||
end,
|
||||
-- config = function()
|
||||
-- vim.g.vimtex_indent_enabled = 0
|
||||
-- end,
|
||||
},
|
||||
{
|
||||
'franchioping/luasnip-latex-snippets.nvim',
|
||||
dev = true,
|
||||
},
|
||||
-- {
|
||||
-- 'iurimateus/luasnip-latex-snippets.nvim',
|
||||
-- -- vimtex isn't required if using treesitter
|
||||
-- requires = { 'L3MON4D3/LuaSnip', 'lervag/vimtex' },
|
||||
-- config = function()
|
||||
-- require('luasnip-latex-snippets').setup()
|
||||
-- -- or setup({ use_treesitter = true })
|
||||
-- require('luasnip').config.setup { enable_autosnippets = true }
|
||||
-- end,
|
||||
-- },
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
-- You can add your own plugins here or in other files in this directory!
|
||||
-- I promise not to create any merge conflicts in this directory :)
|
||||
--
|
||||
-- See the kickstart.nvim README for more information
|
||||
return {
|
||||
|
||||
{
|
||||
'nvim-neo-tree/neo-tree.nvim',
|
||||
branch = 'v3.x',
|
||||
dependencies = {
|
||||
'nvim-lua/plenary.nvim',
|
||||
'nvim-tree/nvim-web-devicons', -- not strictly required, but recommended
|
||||
'MunifTanjim/nui.nvim',
|
||||
-- "3rd/image.nvim", -- Optional image support in preview window: See `# Preview Mode` for more information
|
||||
},
|
||||
|
||||
cmd = 'Neotree',
|
||||
keys = {
|
||||
{ '<leader>e', ':Neotree toggle<CR>', desc = 'Explorer', silent = true },
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
return {
|
||||
'debugloop/telescope-undo.nvim',
|
||||
dependencies = { -- note how they're inverted to above example
|
||||
{
|
||||
'nvim-telescope/telescope.nvim',
|
||||
dependencies = { 'nvim-lua/plenary.nvim' },
|
||||
},
|
||||
},
|
||||
keys = {
|
||||
{ -- lazy style key map
|
||||
'<leader>fu',
|
||||
'<cmd>Telescope undo<cr>',
|
||||
desc = 'Telescope Undo History',
|
||||
},
|
||||
},
|
||||
opts = {
|
||||
-- don't use `defaults = { }` here, do this in the main telescope spec
|
||||
extensions = {
|
||||
undo = {
|
||||
-- telescope-undo.nvim config, see below
|
||||
},
|
||||
-- no other extensions here, they can have their own spec too
|
||||
},
|
||||
},
|
||||
config = function(_, opts)
|
||||
-- Calling telescope's setup from multiple specs does not hurt, it will happily merge the
|
||||
-- configs for us. We won't use data, as everything is in it's own namespace (telescope
|
||||
-- defaults, as well as each extension).
|
||||
require('telescope').setup(opts)
|
||||
require('telescope').load_extension 'undo'
|
||||
end,
|
||||
}
|
||||
|
|
@ -5,9 +5,9 @@ return {
|
|||
event = { 'BufReadPre', 'BufNewFile' },
|
||||
config = function()
|
||||
local lint = require 'lint'
|
||||
lint.linters_by_ft = {
|
||||
markdown = { 'markdownlint' },
|
||||
}
|
||||
-- lint.linters_by_ft = {
|
||||
-- markdown = { 'markdownlint' },
|
||||
-- }
|
||||
|
||||
-- To allow other plugins to add linters to require('lint').linters_by_ft,
|
||||
-- instead set linters_by_ft like this:
|
||||
|
|
|
|||
|
|
@ -0,0 +1,31 @@
|
|||
local ls = require 'luasnip'
|
||||
local s = ls.snippet
|
||||
local sn = ls.snippet_node
|
||||
local isn = ls.indent_snippet_node
|
||||
local t = ls.text_node
|
||||
local i = ls.insert_node
|
||||
local f = ls.function_node
|
||||
local c = ls.choice_node
|
||||
local d = ls.dynamic_node
|
||||
local r = ls.restore_node
|
||||
local events = require 'luasnip.util.events'
|
||||
local ai = require 'luasnip.nodes.absolute_indexer'
|
||||
local extras = require 'luasnip.extras'
|
||||
local l = extras.lambda
|
||||
local rep = extras.rep
|
||||
local p = extras.partial
|
||||
local m = extras.match
|
||||
local n = extras.nonempty
|
||||
local dl = extras.dynamic_lambda
|
||||
local fmt = require('luasnip.extras.fmt').fmt
|
||||
local fmta = require('luasnip.extras.fmt').fmta
|
||||
local conds = require 'luasnip.extras.expand_conditions'
|
||||
local postfix = require('luasnip.extras.postfix').postfix
|
||||
local types = require 'luasnip.util.types'
|
||||
local parse = require('luasnip.util.parser').parse_snippet
|
||||
local ms = ls.multi_snippet
|
||||
local k = require('luasnip.nodes.key_indexer').new_key
|
||||
|
||||
return {
|
||||
s('date', t(os.date '%Y-%m-%d')),
|
||||
}
|
||||
|
|
@ -0,0 +1,80 @@
|
|||
local ls = require 'luasnip'
|
||||
local s = ls.snippet
|
||||
local sn = ls.snippet_node
|
||||
local isn = ls.indent_snippet_node
|
||||
local t = ls.text_node
|
||||
local i = ls.insert_node
|
||||
local f = ls.function_node
|
||||
local c = ls.choice_node
|
||||
local d = ls.dynamic_node
|
||||
local r = ls.restore_node
|
||||
local events = require 'luasnip.util.events'
|
||||
local ai = require 'luasnip.nodes.absolute_indexer'
|
||||
local extras = require 'luasnip.extras'
|
||||
local l = extras.lambda
|
||||
local rep = extras.rep
|
||||
local p = extras.partial
|
||||
local m = extras.match
|
||||
local n = extras.nonempty
|
||||
local dl = extras.dynamic_lambda
|
||||
local fmt = require('luasnip.extras.fmt').fmt
|
||||
local fmta = require('luasnip.extras.fmt').fmta
|
||||
local conds = require 'luasnip.extras.expand_conditions'
|
||||
local postfix = require('luasnip.extras.postfix').postfix
|
||||
local types = require 'luasnip.util.types'
|
||||
local parse = require('luasnip.util.parser').parse_snippet
|
||||
local ms = ls.multi_snippet
|
||||
local k = require('luasnip.nodes.key_indexer').new_key
|
||||
|
||||
local utils = require 'luasnip-latex-snippets.util.utils'
|
||||
local is_math = utils.with_opts(utils.is_math, false) -- true to use treesitter
|
||||
local not_math = utils.with_opts(utils.not_math, false) -- true to use treesitter
|
||||
local as = require('luasnip').extend_decorator.apply(s, { snippetType = 'autosnippet' })
|
||||
|
||||
local ret = {}
|
||||
|
||||
-- dynamic node
|
||||
-- generally, postfix comes in the form PRE-CAPTURE-POST, so in this case, arg1 is the "pre" text, arg2 the "post" text
|
||||
local dynamic_postfix = function(_, parent, _, user_arg1, user_arg2)
|
||||
local capture = parent.snippet.env.POSTFIX_MATCH
|
||||
if #capture > 0 then
|
||||
return sn(
|
||||
nil,
|
||||
fmta(
|
||||
[[
|
||||
<><><><>
|
||||
]],
|
||||
{ t(user_arg1), t(capture), t(user_arg2), i(0) }
|
||||
)
|
||||
)
|
||||
else
|
||||
local visual_placeholder = ''
|
||||
if #parent.snippet.env.SELECT_RAW > 0 then
|
||||
visual_placeholder = parent.snippet.env.SELECT_RAW
|
||||
end
|
||||
return sn(
|
||||
nil,
|
||||
fmta(
|
||||
[[
|
||||
<><><><>
|
||||
]],
|
||||
{ t(user_arg1), i(1, visual_placeholder), t(user_arg2), i(0) }
|
||||
)
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
local function postfix_std(trig, result_start, result_end)
|
||||
return postfix(
|
||||
{ trig = trig, snippetType = 'autosnippet' },
|
||||
{ d(1, dynamic_postfix, {}, { user_args = { result_start, result_end } }) },
|
||||
{ condition = is_math, show_condition = is_math }
|
||||
)
|
||||
end
|
||||
|
||||
-- table.insert(ret, postfix_std('vec', '\\vec{', '}'))
|
||||
-- table.insert(ret, postfix_std('hat', '\\hat{', '}'))
|
||||
-- table.insert(ret, postfix_std('dot', '\\dot{', '}'))
|
||||
-- table.insert(ret, postfix_std('bar', '\\bar{', '}'))
|
||||
|
||||
return ret
|
||||
|
|
@ -0,0 +1,87 @@
|
|||
local ls = require 'luasnip'
|
||||
local s = ls.snippet
|
||||
local sn = ls.snippet_node
|
||||
local isn = ls.indent_snippet_node
|
||||
local t = ls.text_node
|
||||
local i = ls.insert_node
|
||||
local f = ls.function_node
|
||||
local c = ls.choice_node
|
||||
local d = ls.dynamic_node
|
||||
local r = ls.restore_node
|
||||
local events = require 'luasnip.util.events'
|
||||
local ai = require 'luasnip.nodes.absolute_indexer'
|
||||
local extras = require 'luasnip.extras'
|
||||
local l = extras.lambda
|
||||
local rep = extras.rep
|
||||
local p = extras.partial
|
||||
local m = extras.match
|
||||
local n = extras.nonempty
|
||||
local dl = extras.dynamic_lambda
|
||||
local fmt = require('luasnip.extras.fmt').fmt
|
||||
local fmta = require('luasnip.extras.fmt').fmta
|
||||
local conds = require 'luasnip.extras.expand_conditions'
|
||||
local postfix = require('luasnip.extras.postfix').postfix
|
||||
local types = require 'luasnip.util.types'
|
||||
local parse = require('luasnip.util.parser').parse_snippet
|
||||
local ms = ls.multi_snippet
|
||||
local k = require('luasnip.nodes.key_indexer').new_key
|
||||
|
||||
local utils = require 'luasnip-latex-snippets.util.utils'
|
||||
local is_math = utils.with_opts(utils.is_math, false) -- true to use treesitter
|
||||
local not_math = utils.with_opts(utils.not_math, false) -- true to use treesitter
|
||||
local as = require('luasnip').extend_decorator.apply(s, { snippetType = 'autosnippet' })
|
||||
|
||||
local ret = {}
|
||||
--
|
||||
-- table.insert(
|
||||
-- ret,
|
||||
-- as(
|
||||
-- {
|
||||
-- trig = 'rancc',
|
||||
-- regTrig = true,
|
||||
-- name = 'range closed close',
|
||||
-- dscr = 'ranges typing x_ -> x_{}',
|
||||
-- },
|
||||
-- fmta([[ \left[ <> ; <> \right] ]], {
|
||||
-- i(1),
|
||||
-- i(2),
|
||||
-- }),
|
||||
-- { condition = is_math }
|
||||
-- )
|
||||
-- )
|
||||
|
||||
local leters = { 'c', 'o' }
|
||||
for index, value in ipairs(leters) do
|
||||
for index2, value2 in ipairs(leters) do
|
||||
local char1
|
||||
local char2
|
||||
if index == 1 then
|
||||
char1 = '['
|
||||
else
|
||||
char1 = ']'
|
||||
end
|
||||
if index2 == 1 then
|
||||
char2 = ']'
|
||||
else
|
||||
char2 = '['
|
||||
end
|
||||
table.insert(
|
||||
ret,
|
||||
as(
|
||||
{
|
||||
trig = 'ran' .. value .. value2,
|
||||
regTrig = true,
|
||||
name = 'range ' .. value .. value2 .. ' - ' .. char1 .. char2,
|
||||
dscr = 'ranges',
|
||||
},
|
||||
fmta('\\left' .. char1 .. ' <> ; <> \\right' .. char2, {
|
||||
i(1),
|
||||
i(2),
|
||||
}),
|
||||
{ condition = is_math }
|
||||
)
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
return ret
|
||||
|
|
@ -0,0 +1,52 @@
|
|||
local ls = require 'luasnip'
|
||||
local s = ls.snippet
|
||||
local sn = ls.snippet_node
|
||||
local isn = ls.indent_snippet_node
|
||||
local t = ls.text_node
|
||||
local i = ls.insert_node
|
||||
local f = ls.function_node
|
||||
local c = ls.choice_node
|
||||
local d = ls.dynamic_node
|
||||
local r = ls.restore_node
|
||||
local events = require 'luasnip.util.events'
|
||||
local ai = require 'luasnip.nodes.absolute_indexer'
|
||||
local extras = require 'luasnip.extras'
|
||||
local l = extras.lambda
|
||||
local rep = extras.rep
|
||||
local p = extras.partial
|
||||
local m = extras.match
|
||||
local n = extras.nonempty
|
||||
local dl = extras.dynamic_lambda
|
||||
local fmt = require('luasnip.extras.fmt').fmt
|
||||
local fmta = require('luasnip.extras.fmt').fmta
|
||||
local conds = require 'luasnip.extras.expand_conditions'
|
||||
local postfix = require('luasnip.extras.postfix').postfix
|
||||
local types = require 'luasnip.util.types'
|
||||
local parse = require('luasnip.util.parser').parse_snippet
|
||||
local ms = ls.multi_snippet
|
||||
local k = require('luasnip.nodes.key_indexer').new_key
|
||||
|
||||
local utils = require 'luasnip-latex-snippets.util.utils'
|
||||
local is_math = utils.with_opts(utils.is_math, false) -- true to use treesitter
|
||||
local not_math = utils.with_opts(utils.not_math, false) -- true to use treesitter
|
||||
local as = require('luasnip').extend_decorator.apply(s, { snippetType = 'autosnippet' })
|
||||
|
||||
local ret = {
|
||||
as(
|
||||
{
|
||||
trig = '(%a)_',
|
||||
regTrig = true,
|
||||
name = 'auto subscript underscore',
|
||||
dscr = 'Auto subscript: typing x_ -> x_{}',
|
||||
},
|
||||
fmta([[<>_{<>}]], {
|
||||
f(function(_, snip)
|
||||
return snip.captures[1]
|
||||
end),
|
||||
i(1),
|
||||
}),
|
||||
{ condition = is_math }
|
||||
),
|
||||
}
|
||||
|
||||
return {}
|
||||
Loading…
Reference in New Issue