Compare commits
10 commits
24dfc6a297
...
d2309ca00a
| Author | SHA1 | Date | |
|---|---|---|---|
| d2309ca00a | |||
| 1b286b52c3 | |||
| 539d9099f8 | |||
| 2ccfe333b3 | |||
| 38864cc967 | |||
| 7ee9da2291 | |||
| 8adebcd46f | |||
| aa102cef62 | |||
| 68a76d94e9 | |||
| c5cdedfa66 |
8 changed files with 146 additions and 15 deletions
|
|
@ -1,14 +1,46 @@
|
||||||
require('luasnip').config.set_config({
|
local ls = require('luasnip')
|
||||||
|
local ll = require('luasnip.loaders.from_lua')
|
||||||
|
local types = require('luasnip.util.types')
|
||||||
|
|
||||||
|
ls.config.set_config({
|
||||||
enable_autosnippets = true,
|
enable_autosnippets = true,
|
||||||
store_selection_keys = '<C-s>',
|
store_selection_keys = '<C-s>',
|
||||||
history = true,
|
history = true,
|
||||||
updateevents = 'TextChanged,TextChangedI',
|
updateevents = 'TextChanged,TextChangedI',
|
||||||
delete_check_events = 'TextChanged',
|
delete_check_events = 'TextChanged',
|
||||||
|
ext_opts = {
|
||||||
|
[types.insertNode] = {
|
||||||
|
active = {},
|
||||||
|
unvisited = {
|
||||||
|
virt_text = { { '<- insert', 'DiagnosticVirtualTextHint' } }
|
||||||
|
},
|
||||||
|
visited = {},
|
||||||
|
passive = {},
|
||||||
|
snippet_passive = {},
|
||||||
|
},
|
||||||
|
[types.choiceNode] = {
|
||||||
|
active = {
|
||||||
|
virt_text = { { '<- insert', 'DiagnosticVirtualTextError' } },
|
||||||
|
},
|
||||||
|
}
|
||||||
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
require('luasnip.loaders.from_lua').load({ paths = { vim.fn.stdpath('config') .. '/snippets' } })
|
ll.load({ paths = { vim.fn.stdpath('config') .. '/snippets' } })
|
||||||
|
|
||||||
local keymap = vim.api.nvim_set_keymap
|
vim.keymap.set({ 'i', 's' }, '<C-j>', function()
|
||||||
local opts = { noremap = true, silent = true }
|
if ls.expand_or_jumpable() then
|
||||||
keymap('i', '<C-j>', '<cmd>lua require("luasnip").jump(1)<cr>', opts)
|
ls.expand_or_jump()
|
||||||
keymap('i', '<C-k>', '<cmd>lua require("luasnip").jump(-1)<cr>', opts)
|
end
|
||||||
|
end, { silent = true })
|
||||||
|
|
||||||
|
vim.keymap.set({ 'i', 's' }, '<C-k>', function()
|
||||||
|
if ls.jumpable(-1) then
|
||||||
|
ls.jump(-1)
|
||||||
|
end
|
||||||
|
end, { silent = true })
|
||||||
|
|
||||||
|
vim.keymap.set('n', '<leader><leader>s', function()
|
||||||
|
vim.cmd('source ' .. vim.fn.stdpath('config') .. '/after/plugin/luasnip.lua')
|
||||||
|
vim.notify('Sourced snippets', 'info', { title = 'LuaSnip' })
|
||||||
|
end)
|
||||||
|
|
|
||||||
|
|
@ -42,6 +42,11 @@ local function quickfix()
|
||||||
end
|
end
|
||||||
vim.keymap.set('n', '<leader>qf', quickfix)
|
vim.keymap.set('n', '<leader>qf', quickfix)
|
||||||
|
|
||||||
|
vim.keymap.set('v', '<leader>dgh', "<cmd>diffget LOCAL<cr>")
|
||||||
|
vim.keymap.set('v', '<leader>dgl', "<cmd>diffget REMOTE<cr>")
|
||||||
|
|
||||||
|
vim.keymap.set('n', '<leader>dgh', "<cmd>diffget LOCAL<cr>")
|
||||||
|
vim.keymap.set('n', '<leader>dgl', "<cmd>diffget REMOTE<cr>")
|
||||||
|
|
||||||
-- stay in visual mode after indenting/dedenting
|
-- stay in visual mode after indenting/dedenting
|
||||||
vim.keymap.set('v', '<', '<gv')
|
vim.keymap.set('v', '<', '<gv')
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
-- vim.opt.guicursor = ''
|
-- vim.opt.guicursor = ''
|
||||||
|
vim.notify = require('notify')
|
||||||
|
|
||||||
-- line numbers
|
-- line numbers
|
||||||
vim.opt.nu = true
|
vim.opt.nu = true
|
||||||
|
|
@ -30,3 +31,14 @@ vim.opt.scrolloff = 8
|
||||||
vim.opt.signcolumn = 'yes'
|
vim.opt.signcolumn = 'yes'
|
||||||
vim.opt.updatetime = 500
|
vim.opt.updatetime = 500
|
||||||
vim.opt.colorcolumn = '80'
|
vim.opt.colorcolumn = '80'
|
||||||
|
|
||||||
|
vim.api.nvim_create_autocmd('BufReadPost', {
|
||||||
|
callback = function(args)
|
||||||
|
local valid_line = vim.fn.line([['"]]) >= 1 and vim.fn.line([['"]]) < vim.fn.line('$')
|
||||||
|
local not_commit = vim.b[args.buf].filetype ~= 'commit'
|
||||||
|
|
||||||
|
if valid_line and not_commit then
|
||||||
|
vim.cmd([[normal! g`"]])
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
|
||||||
13
lua/plugins/catppuccin.lua
Normal file
13
lua/plugins/catppuccin.lua
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
return {
|
||||||
|
'catppuccin/nvim',
|
||||||
|
name = 'catppuccin',
|
||||||
|
priority = 1000,
|
||||||
|
config = function()
|
||||||
|
local catpuccin = require('catppuccin')
|
||||||
|
catpuccin.setup({
|
||||||
|
flavour = 'frappe',
|
||||||
|
styles = {
|
||||||
|
},
|
||||||
|
})
|
||||||
|
end
|
||||||
|
}
|
||||||
|
|
@ -5,6 +5,7 @@ return {
|
||||||
hasfile = vim.fn.stdpath('data') .. '/config-local',
|
hasfile = vim.fn.stdpath('data') .. '/config-local',
|
||||||
autocommands_create = true,
|
autocommands_create = true,
|
||||||
commands_create = true,
|
commands_create = true,
|
||||||
lookup_parents = false,
|
lookup_parents = true,
|
||||||
|
silent = false,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -12,11 +12,6 @@ return {
|
||||||
dependencies = {
|
dependencies = {
|
||||||
{ 'nvim-lua/plenary.nvim' } }
|
{ 'nvim-lua/plenary.nvim' } }
|
||||||
},
|
},
|
||||||
{
|
|
||||||
'catppuccin/nvim',
|
|
||||||
name = 'catppuccin',
|
|
||||||
priority = 1000
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
'tpope/vim-fugitive',
|
'tpope/vim-fugitive',
|
||||||
name = 'fugitive'
|
name = 'fugitive'
|
||||||
|
|
|
||||||
|
|
@ -61,7 +61,7 @@ local handlers = {
|
||||||
require('lspconfig').ruff_lsp.setup({
|
require('lspconfig').ruff_lsp.setup({
|
||||||
on_attach = function(client, bufnr)
|
on_attach = function(client, bufnr)
|
||||||
client.server_capabilities.hoverProvider = false
|
client.server_capabilities.hoverProvider = false
|
||||||
client.server_capabilities.documentFormattingProver = false
|
client.server_capabilities.documentFormattingProvider = false
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
end,
|
end,
|
||||||
|
|
@ -70,7 +70,7 @@ local handlers = {
|
||||||
settings = {
|
settings = {
|
||||||
texlab = {
|
texlab = {
|
||||||
build = {
|
build = {
|
||||||
onSave = true,
|
onSave = false,
|
||||||
forwardSearchAfter = true,
|
forwardSearchAfter = true,
|
||||||
},
|
},
|
||||||
chktex = {
|
chktex = {
|
||||||
|
|
@ -110,7 +110,7 @@ return {
|
||||||
opts = {
|
opts = {
|
||||||
handlers = handlers,
|
handlers = handlers,
|
||||||
ensure_installed = {
|
ensure_installed = {
|
||||||
'lua_ls', 'clangd', 'pylsp', 'yamlls', 'esbonio', 'ruff_lsp',
|
'lua_ls', 'clangd', 'pylsp', 'yamlls', 'esbonio', 'ruff_lsp', 'lemminx',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
||||||
73
snippets/rst/snippets.lua
Normal file
73
snippets/rst/snippets.lua
Normal file
|
|
@ -0,0 +1,73 @@
|
||||||
|
local ls = require('luasnip')
|
||||||
|
local s = ls.snippet
|
||||||
|
local sn = ls.snippet_node
|
||||||
|
local t = ls.text_node
|
||||||
|
local i = ls.insert_node
|
||||||
|
local f = ls.function_node
|
||||||
|
local d = ls.dynamic_node
|
||||||
|
local fmt = require('luasnip.extras.fmt').fmt
|
||||||
|
local fmta = require('luasnip.extras.fmt').fmta
|
||||||
|
local rep = require('luasnip.extras').rep
|
||||||
|
|
||||||
|
return {
|
||||||
|
s(
|
||||||
|
{
|
||||||
|
trig = 'console',
|
||||||
|
name = 'Console Code-Block',
|
||||||
|
dscr = 'Creates a console code block'
|
||||||
|
},
|
||||||
|
fmta(
|
||||||
|
[[
|
||||||
|
.. code-block:: console
|
||||||
|
|
||||||
|
$ <>
|
||||||
|
|
||||||
|
]],
|
||||||
|
{
|
||||||
|
i(1),
|
||||||
|
}
|
||||||
|
)
|
||||||
|
),
|
||||||
|
s(
|
||||||
|
{
|
||||||
|
trig = 'shell',
|
||||||
|
name = 'Shell Code-Block',
|
||||||
|
dscr = 'Create a shell code block'
|
||||||
|
},
|
||||||
|
fmta(
|
||||||
|
[[
|
||||||
|
.. code-block:: sh
|
||||||
|
<>
|
||||||
|
|
||||||
|
<>
|
||||||
|
|
||||||
|
]],
|
||||||
|
{
|
||||||
|
i(1),
|
||||||
|
i(2),
|
||||||
|
}
|
||||||
|
)
|
||||||
|
),
|
||||||
|
s(
|
||||||
|
{
|
||||||
|
trig = 'python',
|
||||||
|
name = 'Python Code-Block',
|
||||||
|
dscr = 'Create python code block',
|
||||||
|
},
|
||||||
|
fmta(
|
||||||
|
[[
|
||||||
|
.. code-block:: python
|
||||||
|
:linenos:
|
||||||
|
:caption: <>
|
||||||
|
:emphasize-lines: <>
|
||||||
|
|
||||||
|
<>
|
||||||
|
]],
|
||||||
|
{
|
||||||
|
i(1),
|
||||||
|
i(2),
|
||||||
|
i(3),
|
||||||
|
}
|
||||||
|
)
|
||||||
|
),
|
||||||
|
}
|
||||||
Loading…
Reference in a new issue