Update used snippets
parent
58f395081f
commit
6d7ed000ee
|
@ -23,10 +23,7 @@ return require("packer").startup {
|
||||||
use "airblade/vim-gitgutter" -- Git signs
|
use "airblade/vim-gitgutter" -- Git signs
|
||||||
use "godlygeek/tabular" -- Tabular command for alignment
|
use "godlygeek/tabular" -- Tabular command for alignment
|
||||||
use "vim-scripts/utl.vim" -- Universal text linking
|
use "vim-scripts/utl.vim" -- Universal text linking
|
||||||
use {
|
use {"mbbill/undotree", cmd = "UndotreeToggle"} -- Undos in a tree for easy access
|
||||||
"mbbill/undotree",
|
|
||||||
cmd = "UndotreeToggle"
|
|
||||||
} -- Undos in a tree for easy access
|
|
||||||
use "mhinz/vim-grepper" -- Grepper command - improved grepping throughout project
|
use "mhinz/vim-grepper" -- Grepper command - improved grepping throughout project
|
||||||
use "radenling/vim-dispatch-neovim" -- vim-dispatch for neovim - uses terminal
|
use "radenling/vim-dispatch-neovim" -- vim-dispatch for neovim - uses terminal
|
||||||
use "wellle/targets.vim" -- Additional targets for inside and around motions
|
use "wellle/targets.vim" -- Additional targets for inside and around motions
|
||||||
|
@ -47,10 +44,9 @@ return require("packer").startup {
|
||||||
use "jbyuki/one-small-step-for-vimkind" -- Debugger for Nvim-Lua
|
use "jbyuki/one-small-step-for-vimkind" -- Debugger for Nvim-Lua
|
||||||
|
|
||||||
-- Snippets
|
-- Snippets
|
||||||
if vim.g.loaded_python3_provider ~= 0 then
|
use "L3MON4D3/LuaSnip" -- snippets support
|
||||||
use "SirVer/ultisnips" -- Snippets in python format
|
use "rafamadriz/friendly-snippets" -- Collection of snippets
|
||||||
use "honza/vim-snippets" -- Collection of snippets for UltiSnips
|
use "saadparwaiz1/cmp_luasnip" -- cmp snippets support
|
||||||
end
|
|
||||||
|
|
||||||
-- Language support
|
-- Language support
|
||||||
use "tpope/vim-rails" -- Enables all rails command through vim and integrates with projectionist
|
use "tpope/vim-rails" -- Enables all rails command through vim and integrates with projectionist
|
||||||
|
@ -69,10 +65,7 @@ return require("packer").startup {
|
||||||
use "cdelledonne/vim-cmake" -- CMake integration
|
use "cdelledonne/vim-cmake" -- CMake integration
|
||||||
|
|
||||||
-- Treesitter
|
-- Treesitter
|
||||||
use {
|
use {"nvim-treesitter/nvim-treesitter", run = ":TSUpdate"} -- Treesitter integration
|
||||||
"nvim-treesitter/nvim-treesitter",
|
|
||||||
run = ":TSUpdate"
|
|
||||||
} -- Treesitter integration
|
|
||||||
use "nvim-treesitter/playground" -- TSPlaygroundToggle - access treesitter data
|
use "nvim-treesitter/playground" -- TSPlaygroundToggle - access treesitter data
|
||||||
|
|
||||||
-- LSP
|
-- LSP
|
||||||
|
@ -82,7 +75,6 @@ return require("packer").startup {
|
||||||
use "hrsh7th/cmp-buffer" -- Buffer source for nvim-cmp
|
use "hrsh7th/cmp-buffer" -- Buffer source for nvim-cmp
|
||||||
use "hrsh7th/cmp-path" -- Path source for nvim-cmp
|
use "hrsh7th/cmp-path" -- Path source for nvim-cmp
|
||||||
use "hrsh7th/cmp-nvim-lua" -- Nvim-Lua source for nvim-cmp
|
use "hrsh7th/cmp-nvim-lua" -- Nvim-Lua source for nvim-cmp
|
||||||
use "quangnguyen30192/cmp-nvim-ultisnips" -- Ultisnips source for nvim-cmp
|
|
||||||
use "hrsh7th/nvim-cmp" -- completion integration
|
use "hrsh7th/nvim-cmp" -- completion integration
|
||||||
use "nvim-lua/lsp_extensions.nvim" -- LSP extensions (like closing labels for Dart)
|
use "nvim-lua/lsp_extensions.nvim" -- LSP extensions (like closing labels for Dart)
|
||||||
use "jose-elias-alvarez/null-ls.nvim" -- Linting and formatting
|
use "jose-elias-alvarez/null-ls.nvim" -- Linting and formatting
|
||||||
|
|
|
@ -1,16 +1,15 @@
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
-- - LSP completion config -
|
-- - LSP completion config -
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
|
|
||||||
-- Set completeopt to have a better completion experience
|
-- Set completeopt to have a better completion experience
|
||||||
vim.o.completeopt = "menu,menuone,noselect"
|
vim.o.completeopt = "menu,menuone,noselect"
|
||||||
|
|
||||||
local cmp = require "cmp"
|
local cmp = require "cmp"
|
||||||
|
local luasnip = require("luasnip")
|
||||||
|
|
||||||
cmp.setup {
|
cmp.setup {
|
||||||
snippet = {
|
snippet = {
|
||||||
expand = function(args)
|
expand = function(args) require'luasnip'.lsp_expand(args.body) end
|
||||||
vim.fn["UltiSnips#Anon"](args.body)
|
|
||||||
end
|
|
||||||
},
|
},
|
||||||
mapping = {
|
mapping = {
|
||||||
["<C-d>"] = cmp.mapping.scroll_docs(-4),
|
["<C-d>"] = cmp.mapping.scroll_docs(-4),
|
||||||
|
@ -31,13 +30,24 @@ cmp.setup {
|
||||||
else
|
else
|
||||||
fallback()
|
fallback()
|
||||||
end
|
end
|
||||||
|
end,
|
||||||
|
["<C-j>"] = cmp.mapping(function(fallback)
|
||||||
|
if luasnip.jumpable(1) then
|
||||||
|
luasnip.jump(1)
|
||||||
|
else
|
||||||
|
fallback()
|
||||||
end
|
end
|
||||||
|
end, {"i", "s"}),
|
||||||
|
["<C-k>"] = cmp.mapping(function(fallback)
|
||||||
|
if luasnip.jumpable(-1) then
|
||||||
|
luasnip.jump(-1)
|
||||||
|
else
|
||||||
|
fallback()
|
||||||
|
end
|
||||||
|
end, {"i", "s"})
|
||||||
},
|
},
|
||||||
sources = {
|
sources = {
|
||||||
{name = "nvim_lsp"},
|
{name = "nvim_lsp"}, {name = "nvim_lua"}, {name = "path"},
|
||||||
{name = "nvim_lua"},
|
{name = "luasnip"}, {name = "buffer"}
|
||||||
{name = "path"},
|
|
||||||
{name = "ultisnips"},
|
|
||||||
{name = "buffer"}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
local luasnip = require("luasnip")
|
||||||
|
local s = luasnip.snippet
|
||||||
|
local f = luasnip.function_node
|
||||||
|
|
||||||
|
luasnip.add_snippets("all", {
|
||||||
|
s("date", {f(function(_, _) return os.date("%Y-%m-%d") end)}),
|
||||||
|
s("datetime", {f(function(_, _) return os.date("%Y-%m-%d %H:%M:%S") end)}),
|
||||||
|
s("diso", {f(function(_, _) return os.date("%Y-%m-%dT%H:%M:%S") end)})
|
||||||
|
})
|
||||||
|
|
||||||
|
require("luasnip.loaders.from_vscode").lazy_load()
|
|
@ -1,6 +0,0 @@
|
||||||
" -----------------------------------------------------------------------------
|
|
||||||
" - UltiSnips configuration -
|
|
||||||
" -----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
" Force ultisnips to use vim directory (for supporting both NeoVim and Vim)
|
|
||||||
let g:UltiSnipsSnippetDirectories=[$OVIMHOME."/UltiSnips"]
|
|
Loading…
Reference in New Issue