Update snippets
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
-- [[ Basic Keymaps ]]
|
||||
-- See `:help vim.keymap.set()`
|
||||
-- Basic Keymaps
|
||||
-- See `:help vim.keymap.set()`
|
||||
|
||||
-- Swap : and ; around
|
||||
vim.keymap.set({ 'n', 'v' }, ':', ';')
|
||||
@@ -12,6 +12,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', 'v' }, 'c', '"zc', { desc = 'Change without copying to clipboard' })
|
||||
vim.keymap.set({ 'n', 'v' }, 'x', '"zx', { desc = 'Cut without copying to clipboard' })
|
||||
vim.keymap.set('v', 'p', '"zdP', { desc = 'Paste over selection without yanking replaced text' })
|
||||
|
||||
-- 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
|
||||
-- is not what someone will guess without a bit more experience.
|
||||
@@ -235,6 +239,22 @@ vim.keymap.set('n', '<Leader>tc', function()
|
||||
require('neotest').output_panel.close()
|
||||
end, { desc = 'Close test panels' })
|
||||
|
||||
-- vim.keymap.set('i', '<Tab>', function()
|
||||
-- local copilot = require 'copilot.suggestion'
|
||||
-- local ls = require 'luasnip'
|
||||
-- if copilot.is_visible() then
|
||||
-- vim.api.nvim_echo({{'Accepting copilot suggestion'}}, false, {})
|
||||
-- copilot.accept()
|
||||
-- copilot.dismiss()
|
||||
-- elseif ls.jumpable(1) then
|
||||
-- vim.api.nvim_echo({{'Jumping in snippet'}}, false, {})
|
||||
-- ls.jump()
|
||||
-- else
|
||||
-- vim.api.nvim_echo({{'Inserting tab'}}, false, {})
|
||||
-- vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes('<Tab>', true, true, true), 'n', true)
|
||||
-- end
|
||||
-- end, { desc = 'Luasnip accept copilot or jump forward' })
|
||||
|
||||
-- Leaving this commented out, I will try the format command instead
|
||||
-- "A command to properly indent json code
|
||||
-- command! FormatJSON %!python -m json.tool
|
||||
@@ -243,8 +263,11 @@ end, { desc = 'Close test panels' })
|
||||
-- directory if the file does not exist
|
||||
vim.keymap.set('n', '<Leader>es', function()
|
||||
local ft = vim.bo.filetype
|
||||
if ft == 'vue' then
|
||||
ft = 'javascript'
|
||||
end
|
||||
local snippets_dir = vim.fn.stdpath 'config' .. '/lua/snippets'
|
||||
local snippets_file = snippets_dir .. '/' .. ft .. '.json'
|
||||
local snippets_file = snippets_dir .. '/' .. ft .. '.lua'
|
||||
vim.cmd('tabedit ' .. snippets_file)
|
||||
end, { desc = 'Edit snippets file' })
|
||||
|
||||
|
||||
Reference in New Issue
Block a user