From 6cdd3b4b282d79130dc6f2b346cb509ddbb6fa48 Mon Sep 17 00:00:00 2001 From: srdusr Date: Thu, 20 Oct 2022 23:58:14 +0200 Subject: luasnip integration --- autoload/scripts.vim | 15 ++++ lua/user/autopairs.lua | 12 ++- lua/user/cmp.lua | 39 +++++---- lua/user/colorscheme.lua | 2 +- lua/user/keys.lua | 204 ++++++++++++++++++++++++++--------------------- lua/user/luasnip.lua | 127 ++++++++++++++++++++++------- lua/user/opts.lua | 1 + lua/user/pack.lua | 5 +- 8 files changed, 265 insertions(+), 140 deletions(-) create mode 100644 autoload/scripts.vim diff --git a/autoload/scripts.vim b/autoload/scripts.vim new file mode 100644 index 0000000..5c695d3 --- /dev/null +++ b/autoload/scripts.vim @@ -0,0 +1,15 @@ +if !exists('*scripts#save_and_exec') + function! scripts#save_and_exec() abort + if &filetype == 'vim' + :silent! write + :source % + elseif &filetype == 'lua' + :silent! write + :luafile % + endif + + return + endfunction +endif + + diff --git a/lua/user/autopairs.lua b/lua/user/autopairs.lua index 577e571..fc39d2e 100644 --- a/lua/user/autopairs.lua +++ b/lua/user/autopairs.lua @@ -11,9 +11,19 @@ npairs.setup { javascript = { "string", "template_string" }, java = false, }, + map = "", + pairs_map = { +['<'] = '>', +}, disable_filetype = { "TelescopePrompt", "spectre_panel" }, + disable_in_macro = true, + disable_in_visualblock = true, + enalbe_moveright = true, + enable_afterquote = true, -- add bracket pairs after quote + enable_check_bracket_line = true, --- check bracket in same line + enable_bracket_in_quote = true, -- + break_undo = true, -- switch for basic rule break undo sequence fast_wrap = { - map = "", chars = { "{", "[", "(", '"', "'" }, pattern = string.gsub([[ [%'%"%)%>%]%)%}%,] ]], "%s+", ""), offset = 0, -- Offset from pattern match diff --git a/lua/user/cmp.lua b/lua/user/cmp.lua index 77a4943..4dc7c45 100644 --- a/lua/user/cmp.lua +++ b/lua/user/cmp.lua @@ -1,7 +1,7 @@ -- Setup nvim-cmp. ---vim.opt.completeopt = "menu,menuone,noselect" -vim.g.completeopt = "menu,menuone,noselect,noinsert" +vim.opt.completeopt = "menu,menuone,noselect" +--vim.g.completeopt = "menu,menuone,noselect,noinsert" local cmp_status_ok, cmp = pcall(require, "cmp") if not cmp_status_ok then return @@ -39,7 +39,7 @@ require("symbols-outline").setup(opts) -- exclude = {}, --}) -require("luasnip.loaders.from_vscode").lazy_load() +--require("luasnip.loaders.from_vscode").lazy_load() local lspkind = require("lspkind") local kind_icons = { Text = "", @@ -70,17 +70,24 @@ local kind_icons = { } cmp.setup({ snippet = { - expand = function(args) - require("luasnip").lsp_expand(args.body) - end, + --expand = function(args) + -- require("luasnip").lsp_expand(args.body) + --end, + expand = function(args) + local luasnip = require("luasnip") + if not luasnip then + return + end + luasnip.lsp_expand(args.body) + end, }, mapping = cmp.mapping.preset.insert({ -- [""] = cmp.mapping.confirm({ -- behavior = cmp.ConfirmBehavior.Replace, -- select = true, -- }), - [""] = cmp.mapping(cmp.mapping.select_prev_item(), { 'i', 'c' }), - [""] = cmp.mapping(cmp.mapping.select_next_item(), { 'i', 'c' }), + --[""] = cmp.mapping(cmp.mapping.select_prev_item(), { 'i', 'c' }), + --[""] = cmp.mapping(cmp.mapping.select_next_item(), { 'i', 'c' }), [''] = cmp.mapping.confirm({ select = true }), --[""] = cmp.mapping.close(), [''] = cmp.mapping({ @@ -102,10 +109,12 @@ cmp.setup({ sources = cmp.config.sources({ { name = "path" }, - { name = "nvim_lua" }, + --{ name = "nvim_lua" }, { name = "gh_issues" }, { name = "nvim_lsp", keyword_length = 3 }, - { name = "luasnip", keyword_length = 4 }, + { name = 'luasnip', option = { use_show_condition = false } }, + --{ name = "luasnip" }, + --{ name = "luasnip", keyword_length = 4 }, --{ name = "buffer", keyword_length = 3 }, { name = "buffer", option = { get_bufnrs = function() return vim.api.nvim_list_bufs() @@ -144,11 +153,11 @@ cmp.setup({ format = lspkind.cmp_format { with_text = true, menu = { - buffer = "[buf]", nvim_lsp = "[LSP]", + luasnip = "[snip]", + buffer = "[buf]", nvim_lua = "[api]", path = "[path]", - luasnip = "[snip]", gh_issues = "[issues]", }, }, @@ -198,7 +207,7 @@ cmp.setup({ experimental = { ghost_text = true, hl_group = 'Nontext', - native_menu = false, + --native_menu = false, }, view = { @@ -236,8 +245,8 @@ cmp.setup.cmdline({ '/', '?' }, { cmp.setup.cmdline(":", { mapping = { - [""] = cmp.mapping(cmp.mapping.select_prev_item(), { 'i', 'c' }), - [""] = cmp.mapping(cmp.mapping.select_next_item(), { 'i', 'c' }), + [""] = cmp.mapping(cmp.mapping.select_prev_item(), { 'i', 'c' }), + [""] = cmp.mapping(cmp.mapping.select_next_item(), { 'i', 'c' }), [""] = cmp.mapping(cmp.mapping.confirm({ select = true }), { 'i', 'c' }), [""] = cmp.mapping(cmp.mapping.close(), { 'i', 'c' }), [""] = cmp.mapping(cmp.mapping.scroll_docs(-4), { 'i', 'c' }), diff --git a/lua/user/colorscheme.lua b/lua/user/colorscheme.lua index 3ded54c..dc0145d 100644 --- a/lua/user/colorscheme.lua +++ b/lua/user/colorscheme.lua @@ -1,6 +1,6 @@ -- Colorscheme -- ayu gruvbox molokai onedark srcery everblush vscode edge nightfly doom-one -local colorscheme = "doom-one" +local colorscheme = "onedark" local status_ok, _ = pcall(vim.cmd, "colorscheme " .. colorscheme) if not status_ok then vim.notify("colorscheme " .. colorscheme .. " not found!") diff --git a/lua/user/keys.lua b/lua/user/keys.lua index 4515cbc..1a2994b 100644 --- a/lua/user/keys.lua +++ b/lua/user/keys.lua @@ -1,17 +1,24 @@ --[[ key.lua ]] -- Shorten function name -local map = vim.api.nvim_set_keymap +--local keymap = vim.api.nvim_set_keymap +local keymap = vim.keymap -local function new_desc(d) - return { desc = d } -end - -local d = new_desc - -local opts = { noremap = true, silent = true } +--local function new_desc(d) +-- return { desc = d } +--end +-- +--local d = new_desc + +--local opts = { noremap = true, silent = true } +local term_opts = { noremap = true, silent = false } + local map = function(mode, l, r, opts) + opts = opts or {} + opts.silent = true + opts.noremap = true + keymap.set(mode, l, r, opts) + end -local term_opts = { silent = true } --------------- Standard Operations --------------- -- Semi-colon as leader key @@ -19,12 +26,12 @@ vim.g.mapleader = ";" --vim.g.maplocalleader = ";" -- "jj" to exit insert-mode -map("i", "jj", "", opts) +map("i", "jj", "") -- save quickly --map("n", ";w", ":w", d("Save buffer")) ---map("n", "so", ":luafile %", opts) +--map("n", "so", ":luafile %") --vim.cmd([[ --let $my_vimrc = $localappdata.'/nvim/init.lua' @@ -32,32 +39,40 @@ map("i", "jj", "", opts) --]]) --vim.api.nvim_set_keymap("n", "", "lua ReloadConfig()", { noremap = true, silent = false }) -vim.api.nvim_set_keymap("n", "", "luafile ~/.config/nvim/init.lua", { noremap = true, silent = false }) +map("n", "", "luafile ~/.config/nvim/init.lua", print ("Nvim configuration reloaded")) +-- +-- vim.notify("Nvim configuration reloaded!", vim.log.levels.INFO) + --vim.api.nvim_set_keymap('n', 'qr', ':lua require("plugins.telescope").reload()', { noremap = true, silent = true }) --Easier split navigations, just ctrl-j instead of ctrl-w then j -map("n", "", "", opts) -map("n", "", "", opts) -map("n", "", "", opts) -map("n", "", "", opts) +--map("n", "", "") +--map("n", "", "") +--map("n", "", "") +--map("n", "", "") -- Combine buffers list with buffer name -map("n", "b", ":buffers:buffer", opts) +map("n", "b", ":buffers:buffer") -- Map buffer next, prev and delete to -map("n", "n", ":bn", opts) -map("n", "p", ":bp", opts) -map("n", "d", ":bd", opts) +map("n", "n", ":bn") +map("n", "p", ":bp") +map("n", "d", ":bd") -- Disable default completion. -map('i', '', '', opts) -map('i', '', '', opts) +map('i', '', '') +map('i', '', '') -- Set alt + j/k to switch lines of texts or simply move them -map("n", "", ':let save_a=@a"add"ap:let @a=save_a', opts) -map("n", "", ':let save_a=@a"add"ap:let @a=save_a', opts) +map("n", "", ':let save_a=@a"add"ap:let @a=save_a') +map("n", "", ':let save_a=@a"add"ap:let @a=save_a') + +map("i", "", "") + +map("n", "", "!clear") + +map("n", "y", ":BufferPick") -map("n", "", "!clear", opts) vim.cmd([[ inoremap inoremap @@ -87,74 +102,74 @@ vim.cmd([[ ]]) -- move block easily -map("n", "<", "<<", d("Decrease indent")) -map("n", ">", ">>", d("Increase indent")) -map("x", "<", "", ">gv", d("Decrease indent")) +map("n", "<", "<<", term_opts) +map("n", ">", ">>", term_opts) +map("x", "<", "", ">gv", term_opts) -- Resize Panes -map("n", "+", ":resize +5", opts) -map("n", "-", ":resize -5", opts) -map("n", "<", ":vertical resize +5", opts) -map("n", ">", ":vertical resize -5", opts) -map("n", "=", "=", opts) +map("n", "+", ":resize +5") +map("n", "-", ":resize -5") +map("n", "<", ":vertical resize +5") +map("n", ">", ":vertical resize -5") +map("n", "=", "=") -- New tab -map("n", "e", ":tabedit", opts) +map("n", "e", ":tabedit") -- create tab like window -map("n", "h", ":tabprevious", d("Goto previous tab")) -map("n", "l", ":tabnext", d("Goto next tab")) -map("n", "n", ":tabnew", d("Create a new tab")) +map("n", "h", ":tabprevious") +map("n", "l", ":tabnext") +map("n", "n", ":tabnew") -- Vim TABs -map("n", "1", "1gt", opts) -map("n", "2", "2gt", opts) -map("n", "3", "3gt", opts) -map("n", "4", "4gt", opts) -map("n", "5", "5gt", opts) -map("n", "6", "6gt", opts) -map("n", "7", "7gt", opts) -map("n", "8", "8gt", opts) -map("n", "9", "9gt", opts) -map("n", "0", "10gt", opts) +map("n", "1", "1gt") +map("n", "2", "2gt") +map("n", "3", "3gt") +map("n", "4", "4gt") +map("n", "5", "5gt") +map("n", "6", "6gt") +map("n", "7", "7gt") +map("n", "8", "8gt") +map("n", "9", "9gt") +map("n", "0", "10gt") -- Split window -map("n", "h", ":split", opts) -map("n", "v", ":vsplit", opts) -map("n", "c", "c", opts) +map("n", "h", ":split") +map("n", "v", ":vsplit") +map("n", "c", "c") -- Toggle set number -map("n", "$", ":NumbersToggle", opts) -map("n", "%", ":NumbersOnOff", opts) +map("n", "$", ":NumbersToggle") +map("n", "%", ":NumbersOnOff") -- Change mode to executable -map("n", "x", ":!chmod +x %", opts) +map("n", "x", ":!chmod +x %") -- Paste without replace clipboard -map("v", "p", '"_dP', opts) +map("v", "p", '"_dP') -- Paste end of line ---map("n", ",", "$p", opts) +--map("n", ",", "$p") vim.cmd([[ nmap , $p ]]) -- Select entire buffer -map("v", "", "ggG", opts) +map("v", "", "ggG") -- Delete without changing the registers ---map('n', 'x', '"_x', opts) +--map('n', 'x', '"_x') -- Select all text in current buffer --map('n', 'a', ':keepjumps normal! ggVG') -- Swap two pieces of text, use x to cut in visual mode, then use Ctrl-x in -- visual mode to select text to swap with -map("v", "", "`.``gvP``P", opts) +map("v", "", "`.``gvP``P") -- Search and replace -map("v", "sr", 'y:%s/"//gc', opts) +map("v", "sr", 'y:%s/"//gc') --vnoremap ; :call Get_visual_selection() -- --function! Get_visual_selection() @@ -192,40 +207,45 @@ vim.cmd([[ map s :up \| saveas! %:p:r-=strftime("%y.%m.%d-%H:%M")-bak.=expand("%:e") \| 3sleep \| e # ]]) +-- Execute this file +--map("n", "x", ":call scripts#save_and_exec()", print("save & exec")) +vim.cmd([[ + " Execute this file + nnoremap x :call scripts#save_and_exec()\|:echom "save & exec . . ." + +]]) -------------- Telescope -------------- --Telescope find_files cwd=.. -map("n", "fc", "lua require('telescope.builtin').commands()", opts) +map("n", "fc", "lua require('telescope.builtin').commands()") map( "n", "ft", - "lua require('telescope.builtin').builtin(require('telescope.themes').get_dropdown({}))", - opts -) + "lua require('telescope.builtin').builtin(require('telescope.themes').get_dropdown({}))") -map("n", "fg", "lua require('telescope.builtin').live_grep()", opts) -map("n", "fb", "lua require('telescope.builtin').current_buffer_fuzzy_find()", opts) +map("n", "fg", "lua require('telescope.builtin').live_grep()") +map("n", "fb", "lua require('telescope.builtin').current_buffer_fuzzy_find()") - map("n", "fd", "lua require('telescope.builtin').diagnostics()", opts) ---map("n", "fz", ":FZF", opts) ---map("t", [[]], [[]], opts) + map("n", "fd", "lua require('telescope.builtin').diagnostics()") +--map("n", "fz", ":FZF") +--map("t", [[]], [[]]) --map("n", "ff", ":NvimTreeToggle", {}) map("n", "f", ":NvimTreeToggle", {}) -- This avoids crashing fzf menu running in TERMINAL MODE (:q if you do) -- Find files in config dirs --key_map("n", "e", ":lua require('plugins.telescope').find_configs()", opts) ---map("n", "f.", "lua require('plugins.telescope').find_configs({})", opts) -map("n", "ft", "lua require('plugins.telescope').file_explorer({})", opts) ---map("n", "fd", "lua require('plugins.telescope').find_notes({})", opts) -map("n", "fm", "lua require('telescope').extensions.media_files.media_files({})", opts) +--map("n", "f.", "lua require('plugins.telescope').find_configs({})") +map("n", "ft", "lua require('plugins.telescope').file_explorer({})") +--map("n", "fd", "lua require('plugins.telescope').find_notes({})") +map("n", "fm", "lua require('telescope').extensions.media_files.media_files({})") -- registers picker -map("n", "r", "lua require('telescope.builtin').registers({})", opts) +map("n", "r", "lua require('telescope.builtin').registers({})") -- find files including gitignored --keymap( -- "n", -- "fg", --- "lua require('telescope.builtin').find_files({find_command={'fd','--no-ignore-vcs'}})", opts) +-- "lua require('telescope.builtin').find_files({find_command={'fd','--no-ignore-vcs'}})") -- open available commands & run it -map("n", "fc", "lua require('telescope.builtin').commands({results_title='Commands Results'})", opts) +map("n", "fc", "lua require('telescope.builtin').commands({results_title='Commands Results'})") -------------- Autopairs -------------- Toggle_autopairs = function() @@ -259,7 +279,7 @@ vim.cmd([[ endfunction nnoremap tb :call Toggle_transparent_background() ]]) ---keymap('n', 'tb', ':Toggle_transparent_background', opts) +--keymap('n', 'tb', ':Toggle_transparent_background') -- Toggle zoom vim.cmd([[ @@ -276,10 +296,10 @@ vim.cmd([[ endfunction command! ZoomToggle call s:ZoomToggle() ]]) -map("n", "z", ":ZoomToggle", opts) +map("n", "z", ":ZoomToggle") -- "Zoom" a split window into a tab and/or close it ---keymap('n', ',', ':tabnew %', opts) ---keymap('n', '.', ':tabclose', opts) +--keymap('n', ',', ':tabnew %') +--keymap('n', '.', ':tabclose') -- Open last closed buffer vim.cmd([[ @@ -303,7 +323,7 @@ vim.cmd([[ execute 'b ' . last_buf endfunction ]]) -map("n", "", ":call OpenLastClosed() ", opts) +map("n", "", ":call OpenLastClosed() ") -- Tabularize vim.cmd([[ @@ -329,8 +349,8 @@ vim.cmd([[ --EasyAlign /--/ --:'<,'>Tabularize /-- -map("n", ",", ":hide", opts) -map("n", ".", ":unhide", opts) +map("n", ",", ":hide") +map("n", ".", ":unhide") --" Clean trailing whitespace --nnoremap ww mz:%s/\s\+$//:let @/=''`z @@ -339,12 +359,12 @@ map("n", ".", ":unhide", opts) --vim.api.nvim_create_user_command('W', 'w !sudo tee > /dev/null %', {}) -- Copy and Paste with and ---keymap('n', ' p', (v:register =--= '"' && &clipboard =~ 'unnamed' ? '"*p' : '"' . v:register . 'p')'', opts) +--keymap('n', ' p', (v:register =--= '"' && &clipboard =~ 'unnamed' ? '"*p' : '"' . v:register . 'p')'') -- Use command :Vb for Visual Block or since is used for Copy --command! Vb normal! -- Map to save/edit a root permission/read-only file, only works in -- traditional vim and not neovim ---keymap('c', 'w!! %!sudo tee > /dev/null', opts) +--keymap('c', 'w!! %!sudo tee > /dev/null') --" Copying text to the system clipboard. --" --" For some reason Vim no longer wants to talk to the OS X pasteboard through "*. @@ -385,8 +405,8 @@ map("n", ".", ":unhide", opts) ---- Open the current file in the default program (on Mac this should just be just `open`) --keymap('n', 'x', ':!xdg-open %') -map("n", "ff", "lua require('telescope.builtin').find_files()", opts) ---keymap("n", "ff", "lua require('telescope.builtin').find_files cwd=..()", opts) +map("n", "ff", "lua require('telescope.builtin').find_files()") +--keymap("n", "ff", "lua require('telescope.builtin').find_files cwd=..()") --keymap('n', 'k', ':nohlsearch') -- --"This unsets the "last search pattern" register by hitting return @@ -407,8 +427,8 @@ vim.cmd([[ ---- http://ddrscott.github.io/blog/2016/yank-without-jank/ --keymap('v', 'y', 'myy`y') --keymap('v', 'Y', 'myY`y') ---keymap("n", "", ":q", opts) ---keymap("n", "", ":qa!", opts) +--keymap("n", "", ":q") +--keymap("n", "", ":qa!") --" Sort lines --nnoremap s vip:!sort @@ -525,7 +545,7 @@ vim.cmd([[ -- ALE: toggle _ALE activity --keymap('n', 'a',[[:ALEToggle]]) ---keymap('n', 'cd', ':call fzf#run({'source': 'fd -t d -H . ~', 'sink': 'cd'})', opts) --- ":lua require('neogen').generate()", opts) ---keymap("n", "ww", ":set wrap!", opts) +--keymap('n', 'cd', ':call fzf#run({'source': 'fd -t d -H . ~', 'sink': 'cd'})') +-- ":lua require('neogen').generate()") +--keymap("n", "ww", ":set wrap!") -- diff --git a/lua/user/luasnip.lua b/lua/user/luasnip.lua index 12352e8..7a6066e 100644 --- a/lua/user/luasnip.lua +++ b/lua/user/luasnip.lua @@ -4,7 +4,8 @@ end --local luasnip = require("luasnip") local ls = require "luasnip" -- local types = require "luasnip.util.types" -- -local options = { +--local options = { +ls.config.set_config { history = true, updateevents = "TextChanged,TextChangedI", -- Autosnippets: @@ -17,45 +18,113 @@ local options = { }, -- }, -- } --- is my expansion key --- this will expand the current item or jump to the next item within the snippet. -vim.keymap.set({ "i", "s" }, "", function() - if ls.expand_or_jumpable() then - ls.expand_or_jump() - end -end, { silent = true }) +-- ls.expand_or_jump() +-- end +--nd, { silent = true }) -- is my jump backwards key. -- this always moves to the previous item within the snippet -vim.keymap.set({ "i", "s" }, "", function() - if ls.jumpable(-1) then - ls.jump(-1) - end -end, { silent = true }) +--im.keymap.set({ "i", "s" }, "", function() +-- if ls.jumpable(-1) then +-- ls.jump(-1) +-- end +--nd, { silent = true }) -- is selecting within a list of options. -- This is useful for choice nodes (introduced in the forthcoming episode 2) -vim.keymap.set("i", "", function() - if ls.choice_active() then - ls.change_choice(1) - end -end) +--vim.keymap.set("i", "", function() +-- if ls.choice_active() then +-- ls.change_choice(1) +-- end +--end) -vim.keymap.set("i", "", require "luasnip.extras.select_choice") +--vim.keymap.set("i", "", require "luasnip.extras.select_choice") -- shorcut to source my luasnips file again, which will reload my snippets -vim.keymap.set("n", "s", "source ~/.config/nvim/lua/plugins/luasnip.lua") +--vim.keymap.set("n", "s", "source ~/.config/nvim/lua/user/plugins/luasnip.lua") -- ls.parser.parse_snippet(, ) -ls.snippets = { - all = { - -- Available in any filetype - ls.parser.parse_snippet("expand", "-- this is what was expanded!"), - }, - lua = { - -- Lua specific snippets go here. - }, -} +--ls.snippets = { +-- all = { +-- -- Available in any filetype +-- ls.parser.parse_snippet("expand", "-- this is what was expanded!"), +--s.snippets = { +-- all = { +-- -- Available in any filetype +-- ls.parser.parse_snippet("expand", "-- this is what was expanded!"), +-- }, +-- lua = { +-- -- Lua specific snippets go here. +-- ls.parser.parse_snippet("lf", "local $1 = function($2)\n $0\nend") +-- }, +-- +--}) +local snip = ls.snippet +local node = ls.snippet_node +local text = ls.text_node +local insert = ls.insert_node +local func = ls.function_node +local choice = ls.choice_node +local dynamicn = ls.dynamic_node + +local date = function() return {os.date('%Y-%m-%d')} end + +ls.add_snippets(nil, { + all = { + --snip({ + -- trig = "date", + -- namr = "Date", + -- dscr = "Date in the form of YYYY-MM-DD", + --}, { + -- func(date, {}), + --}), + snip({ + trig = "meta", + namr = "Metadata", + dscr = "Yaml metadata format for markdown" +}, +{ + }), + }, +}) +--local opts = { noremap = true, silent = true } +--keymap("i", "", "lua require'luasnip'.jump(1)", opts) +--keymap("s", "", "lua require'luasnip'.jump(1)", opts) +--keymap("i", "", "lua require'luasnip'.jump(-1)", opts) +--local keymap = vim.api.nvim_set_keymap +local keymap = vim.keymap +local term_opts = { noremap = true, silent = false } + local map = function(mode, l, r, opts) + opts = opts or {} + opts.silent = true + opts.noremap = true + keymap.set(mode, l, r, opts) + end + +map("i", "", "luasnip-expand-or-jump") +map("i", "", "luasnip-jump-prev * lua require'luasnip'.jump(-1)") +map("s", "", "luasnip-expand-or-jump") +map("s", "", "luasnip-jump-prev * lua require'luasnip'.jump(-1)") +--keymap("s", "", "lua require'luasnip'.jump(-1)", opts) +--map("i", "", "luasnip-expand-or-jump") + +--! luasnip-expand-repeat * lua require'luasnip'.expand_repeat() +--! luasnip-delete-check * lua require'luasnip'.unlink_current_if_deleted() +--i luasnip-jump-prev * lua require'luasnip'.jump(-1) +--i luasnip-jump-next * lua require'luasnip'.jump(1) +--i luasnip-prev-choice * lua require'luasnip'.change_choice(-1) +--i luasnip-next-choice * lua require'luasnip'.change_choice(1) +--i luasnip-expand-snippet * lua require'luasnip'.expand() +--i luasnip-expand-or-jump * lua require'luasnip'.expand_or_jump() + + + + + + + + + diff --git a/lua/user/opts.lua b/lua/user/opts.lua index 51b3628..3200cd5 100644 --- a/lua/user/opts.lua +++ b/lua/user/opts.lua @@ -53,6 +53,7 @@ vim.opt.ttimeoutlen = 10 -- -- Indent/tab vim.opt.breakindent = true -- vim.opt.autoindent = true -- Indent according to previous line. +vim.opt.copyindent = true -- Copy indent from the previous line vim.opt.smarttab = false -- vim.opt.tabstop = 2 -- vim.opt.expandtab = true -- Indent according to previous line. diff --git a/lua/user/pack.lua b/lua/user/pack.lua index 8df4216..55b52cd 100644 --- a/lua/user/pack.lua +++ b/lua/user/pack.lua @@ -174,7 +174,8 @@ return packer.startup(function(use) use("saadparwaiz1/cmp_luasnip") -- snippets - use("L3MON4D3/LuaSnip") --snippet engine + --use("L3MON4D3/LuaSnip") --snippet engine + use({"L3MON4D3/LuaSnip", tag = "v.*"}) use("rafamadriz/friendly-snippets") -- a bunch of snippets to use --use("github/copilot.vim") --use({ @@ -301,7 +302,7 @@ return packer.startup(function(use) -- Utilities use("nathom/filetype.nvim") - use("christoomey/vim-tmux-navigator") + --use("christoomey/vim-tmux-navigator") --use("preservim/vimux") use("myusuf3/numbers.vim") use("windwp/nvim-autopairs") -- cgit v1.2.3