Neovim update
Signed-off-by: TiagoRG <tiago.rgarcia@ua.pt>
This commit is contained in:
parent
9d35bd8aae
commit
80a94eeb8b
|
@ -0,0 +1,31 @@
|
||||||
|
require('chatgpt').setup {
|
||||||
|
api_key_cmd = 'gpg --decrypt /home/tiagorg/.gnupg/openai_key.txt.gpg',
|
||||||
|
chat = {
|
||||||
|
keymaps = {
|
||||||
|
close = "<C-c>",
|
||||||
|
yank_last = "<C-y>",
|
||||||
|
yank_last_code = "<C-k>",
|
||||||
|
scroll_up = "<C-u>",
|
||||||
|
scroll_down = "<C-d>",
|
||||||
|
new_session = "<C-n>",
|
||||||
|
cycle_windows = "<C-t>",
|
||||||
|
cycle_modes = "<C-f>",
|
||||||
|
next_message = "<C-j>",
|
||||||
|
prev_message = "<C-k>",
|
||||||
|
select_session = "<Space>",
|
||||||
|
rename_session = "r",
|
||||||
|
delete_session = "d",
|
||||||
|
draft_message = "<C-r>",
|
||||||
|
edit_message = "e",
|
||||||
|
delete_message = "d",
|
||||||
|
toggle_settings = "<C-o>",
|
||||||
|
toggle_sessions = "<C-p>",
|
||||||
|
toggle_help = "<C-h>",
|
||||||
|
toggle_message_role = "<C-r>",
|
||||||
|
toggle_system_role_open = "<C-s>",
|
||||||
|
stop_generating = "<C-x>",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
vim.keymap.set("n", "<leader>gpt", "<cmd>ChatGPT<cr>", { noremap = true, silent = true })
|
|
@ -9,9 +9,16 @@ require("presence").setup({
|
||||||
log_level = nil, -- Log messages at or above this level (one of the following: "debug", "info", "warn", "error")
|
log_level = nil, -- Log messages at or above this level (one of the following: "debug", "info", "warn", "error")
|
||||||
debounce_timeout = 1, -- Number of seconds to debounce events (or calls to `:lua package.loaded.presence:update(<filename>, true)`)
|
debounce_timeout = 1, -- Number of seconds to debounce events (or calls to `:lua package.loaded.presence:update(<filename>, true)`)
|
||||||
enable_line_number = false, -- Displays the current line number instead of the current project
|
enable_line_number = false, -- Displays the current line number instead of the current project
|
||||||
blacklist = {"glua-atas", "toggleterm"},-- A list of strings or Lua patterns that disable Rich Presence if the current file name, path, or workspace matches
|
blacklist = { -- A list of strings or Lua patterns that disable Rich Presence if the current file name, path, or workspace matches
|
||||||
|
"glua-atas",
|
||||||
|
"glua-regulamento",
|
||||||
|
"toggleterm",
|
||||||
|
"curriculum-vitae",
|
||||||
|
"Nextcloud",
|
||||||
|
},
|
||||||
buttons = true, -- Configure Rich Presence button(s), either a boolean to enable/disable, a static table (`{{ label = "<label>", url = "<url>" }, ...}`, or a function(buffer: string, repo_url: string|nil): table)
|
buttons = true, -- Configure Rich Presence button(s), either a boolean to enable/disable, a static table (`{{ label = "<label>", url = "<url>" }, ...}`, or a function(buffer: string, repo_url: string|nil): table)
|
||||||
file_assets = {}, -- Custom file asset definitions keyed by file names and extensions (see default config at `lua/presence/file_assets.lua` for reference)
|
file_assets = { -- Custom file asset definitions keyed by file names and extensions (see default config at `lua/presence/file_assets.lua` for reference)
|
||||||
|
},
|
||||||
show_time = true, -- Show the timer
|
show_time = true, -- Show the timer
|
||||||
|
|
||||||
-- Rich Presence text options
|
-- Rich Presence text options
|
||||||
|
|
|
@ -5,13 +5,13 @@ require("tabset").setup({
|
||||||
},
|
},
|
||||||
languages = {
|
languages = {
|
||||||
{
|
{
|
||||||
filetypes = { "html", "json", "yaml", "xml" },
|
filetypes = { "html", "json", "yaml", "xml", "markdown" },
|
||||||
config = {
|
config = {
|
||||||
tabwidth = 2
|
tabwidth = 2
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
filetypes = { "asm" },
|
filetypes = { "asm", "s" },
|
||||||
config = {
|
config = {
|
||||||
tabwidth = 8,
|
tabwidth = 8,
|
||||||
expandtab = false
|
expandtab = false
|
||||||
|
|
|
@ -111,4 +111,17 @@ return require('packer').startup(function(use)
|
||||||
|
|
||||||
-- Little friend
|
-- Little friend
|
||||||
use("github/copilot.vim")
|
use("github/copilot.vim")
|
||||||
|
|
||||||
|
-- trying out
|
||||||
|
use 'lervag/vimtex'
|
||||||
|
use {
|
||||||
|
'jackMort/ChatGPT.nvim',
|
||||||
|
requires = {
|
||||||
|
"MunifTanjim/nui.nvim",
|
||||||
|
"nvim-lua/plenary.nvim",
|
||||||
|
"nvim-telescope/telescope.nvim"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
use 'TiagoRG/liveshare.nvim'
|
||||||
end)
|
end)
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
--vim.keymap.set("n", "<leader>e", vim.cmd.E)
|
--vim.keymap.set("n", "<leader>e", vim.cmd.E)
|
||||||
vim.keymap.set("n", "<leader>w", vim.cmd.w)
|
vim.keymap.set("n", "<leader>w", vim.cmd.w)
|
||||||
|
vim.keymap.set({ "n", "i" }, "<C-s>", vim.cmd.w)
|
||||||
|
|
||||||
vim.keymap.set("v", "J", ":m '>+1<CR>gv=gv")
|
vim.keymap.set("v", "J", ":m '>+1<CR>gv=gv")
|
||||||
vim.keymap.set("v", "K", ":m '<-2<CR>gv=gv")
|
vim.keymap.set("v", "K", ":m '<-2<CR>gv=gv")
|
||||||
|
@ -36,7 +37,7 @@ vim.keymap.set("n", "<leader>j", "<cmd>lprev<CR>zz")
|
||||||
|
|
||||||
vim.keymap.set("n", "<leader>r", [[:%s/\<<C-r><C-w>\>/<C-r><C-w>/gI<Left><Left><Left>]])
|
vim.keymap.set("n", "<leader>r", [[:%s/\<<C-r><C-w>\>/<C-r><C-w>/gI<Left><Left><Left>]])
|
||||||
|
|
||||||
vim.keymap.set("n", "<leader>m", "<cmd>!make<CR>", { silent = true })
|
vim.keymap.set("n", "<leader>m", "<cmd>!make > /dev/null<CR>", { silent = true })
|
||||||
|
|
||||||
vim.keymap.set("n", "<leader>vpp", "<cmd>so ~/.config/nvim/lua/tiagorg/packer.lua<CR>");
|
vim.keymap.set("n", "<leader>vpp", "<cmd>so ~/.config/nvim/lua/tiagorg/packer.lua<CR>");
|
||||||
|
|
||||||
|
|
|
@ -26,9 +26,10 @@ vim.opt.guitablabel = "\\[%N\\]\\ %t\\ %M"
|
||||||
|
|
||||||
vim.opt.updatetime = 50
|
vim.opt.updatetime = 50
|
||||||
|
|
||||||
vim.opt.colorcolumn = "80"
|
vim.opt.colorcolumn = "0"
|
||||||
|
|
||||||
vim.g.copilot_node_command = "/usr/bin/nodenv"
|
vim.g.copilot_node_command = "/usr/bin/nodenv"
|
||||||
vim.g.copilot_assume_mapped = true
|
vim.g.copilot_assume_mapped = true
|
||||||
|
|
||||||
vim.g.mapleader = " "
|
vim.g.mapleader = " "
|
||||||
|
vim.g.mouse = "a"
|
||||||
|
|
|
@ -74,6 +74,11 @@ end
|
||||||
time([[try_loadstring definition]], false)
|
time([[try_loadstring definition]], false)
|
||||||
time([[Defining packer_plugins]], true)
|
time([[Defining packer_plugins]], true)
|
||||||
_G.packer_plugins = {
|
_G.packer_plugins = {
|
||||||
|
["ChatGPT.nvim"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/tiagorg/.local/share/nvim/site/pack/packer/start/ChatGPT.nvim",
|
||||||
|
url = "https://github.com/jackMort/ChatGPT.nvim"
|
||||||
|
},
|
||||||
["Comment.nvim"] = {
|
["Comment.nvim"] = {
|
||||||
loaded = true,
|
loaded = true,
|
||||||
path = "/home/tiagorg/.local/share/nvim/site/pack/packer/start/Comment.nvim",
|
path = "/home/tiagorg/.local/share/nvim/site/pack/packer/start/Comment.nvim",
|
||||||
|
@ -145,6 +150,11 @@ _G.packer_plugins = {
|
||||||
path = "/home/tiagorg/.local/share/nvim/site/pack/packer/start/indent-blankline.nvim",
|
path = "/home/tiagorg/.local/share/nvim/site/pack/packer/start/indent-blankline.nvim",
|
||||||
url = "https://github.com/lukas-reineke/indent-blankline.nvim"
|
url = "https://github.com/lukas-reineke/indent-blankline.nvim"
|
||||||
},
|
},
|
||||||
|
["liveshare.nvim"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/tiagorg/.local/share/nvim/site/pack/packer/start/liveshare.nvim",
|
||||||
|
url = "https://github.com/TiagoRG/liveshare.nvim"
|
||||||
|
},
|
||||||
["lsp-zero.nvim"] = {
|
["lsp-zero.nvim"] = {
|
||||||
loaded = true,
|
loaded = true,
|
||||||
path = "/home/tiagorg/.local/share/nvim/site/pack/packer/start/lsp-zero.nvim",
|
path = "/home/tiagorg/.local/share/nvim/site/pack/packer/start/lsp-zero.nvim",
|
||||||
|
@ -171,6 +181,11 @@ _G.packer_plugins = {
|
||||||
path = "/home/tiagorg/.local/share/nvim/site/pack/packer/start/monokai-pro.nvim",
|
path = "/home/tiagorg/.local/share/nvim/site/pack/packer/start/monokai-pro.nvim",
|
||||||
url = "https://github.com/loctvl842/monokai-pro.nvim"
|
url = "https://github.com/loctvl842/monokai-pro.nvim"
|
||||||
},
|
},
|
||||||
|
["nui.nvim"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/tiagorg/.local/share/nvim/site/pack/packer/start/nui.nvim",
|
||||||
|
url = "https://github.com/MunifTanjim/nui.nvim"
|
||||||
|
},
|
||||||
["nvim-cmp"] = {
|
["nvim-cmp"] = {
|
||||||
loaded = true,
|
loaded = true,
|
||||||
path = "/home/tiagorg/.local/share/nvim/site/pack/packer/start/nvim-cmp",
|
path = "/home/tiagorg/.local/share/nvim/site/pack/packer/start/nvim-cmp",
|
||||||
|
@ -268,6 +283,11 @@ _G.packer_plugins = {
|
||||||
path = "/home/tiagorg/.local/share/nvim/site/pack/packer/start/vim-wakatime",
|
path = "/home/tiagorg/.local/share/nvim/site/pack/packer/start/vim-wakatime",
|
||||||
url = "https://github.com/wakatime/vim-wakatime"
|
url = "https://github.com/wakatime/vim-wakatime"
|
||||||
},
|
},
|
||||||
|
vimtex = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/tiagorg/.local/share/nvim/site/pack/packer/start/vimtex",
|
||||||
|
url = "https://github.com/lervag/vimtex"
|
||||||
|
},
|
||||||
["vscode.nvim"] = {
|
["vscode.nvim"] = {
|
||||||
loaded = true,
|
loaded = true,
|
||||||
path = "/home/tiagorg/.local/share/nvim/site/pack/packer/start/vscode.nvim",
|
path = "/home/tiagorg/.local/share/nvim/site/pack/packer/start/vscode.nvim",
|
||||||
|
@ -286,10 +306,10 @@ time([[Defining packer_plugins]], false)
|
||||||
time([[Config for aerial.nvim]], true)
|
time([[Config for aerial.nvim]], true)
|
||||||
try_loadstring("\27LJ\2\n4\0\0\3\0\3\0\0066\0\0\0'\2\1\0B\0\2\0029\0\2\0B\0\1\1K\0\1\0\nsetup\vaerial\frequire\0", "config", "aerial.nvim")
|
try_loadstring("\27LJ\2\n4\0\0\3\0\3\0\0066\0\0\0'\2\1\0B\0\2\0029\0\2\0B\0\1\1K\0\1\0\nsetup\vaerial\frequire\0", "config", "aerial.nvim")
|
||||||
time([[Config for aerial.nvim]], false)
|
time([[Config for aerial.nvim]], false)
|
||||||
-- Config for: wrapping.nvim
|
-- Config for: monokai-pro.nvim
|
||||||
time([[Config for wrapping.nvim]], true)
|
time([[Config for monokai-pro.nvim]], true)
|
||||||
try_loadstring("\27LJ\2\n6\0\0\3\0\3\0\0066\0\0\0'\2\1\0B\0\2\0029\0\2\0B\0\1\1K\0\1\0\nsetup\rwrapping\frequire\0", "config", "wrapping.nvim")
|
try_loadstring("\27LJ\2\n9\0\0\3\0\3\0\0066\0\0\0'\2\1\0B\0\2\0029\0\2\0B\0\1\1K\0\1\0\nsetup\16monokai-pro\frequire\0", "config", "monokai-pro.nvim")
|
||||||
time([[Config for wrapping.nvim]], false)
|
time([[Config for monokai-pro.nvim]], false)
|
||||||
-- Config for: nvim-surround
|
-- Config for: nvim-surround
|
||||||
time([[Config for nvim-surround]], true)
|
time([[Config for nvim-surround]], true)
|
||||||
try_loadstring("\27LJ\2\n?\0\0\3\0\3\0\a6\0\0\0'\2\1\0B\0\2\0029\0\2\0004\2\0\0B\0\2\1K\0\1\0\nsetup\18nvim-surround\frequire\0", "config", "nvim-surround")
|
try_loadstring("\27LJ\2\n?\0\0\3\0\3\0\a6\0\0\0'\2\1\0B\0\2\0029\0\2\0004\2\0\0B\0\2\1K\0\1\0\nsetup\18nvim-surround\frequire\0", "config", "nvim-surround")
|
||||||
|
@ -298,10 +318,10 @@ time([[Config for nvim-surround]], false)
|
||||||
time([[Config for tabset.nvim]], true)
|
time([[Config for tabset.nvim]], true)
|
||||||
try_loadstring("\27LJ\2\n4\0\0\3\0\3\0\0066\0\0\0'\2\1\0B\0\2\0029\0\2\0B\0\1\1K\0\1\0\nsetup\vtabset\frequire\0", "config", "tabset.nvim")
|
try_loadstring("\27LJ\2\n4\0\0\3\0\3\0\0066\0\0\0'\2\1\0B\0\2\0029\0\2\0B\0\1\1K\0\1\0\nsetup\vtabset\frequire\0", "config", "tabset.nvim")
|
||||||
time([[Config for tabset.nvim]], false)
|
time([[Config for tabset.nvim]], false)
|
||||||
-- Config for: monokai-pro.nvim
|
-- Config for: wrapping.nvim
|
||||||
time([[Config for monokai-pro.nvim]], true)
|
time([[Config for wrapping.nvim]], true)
|
||||||
try_loadstring("\27LJ\2\n9\0\0\3\0\3\0\0066\0\0\0'\2\1\0B\0\2\0029\0\2\0B\0\1\1K\0\1\0\nsetup\16monokai-pro\frequire\0", "config", "monokai-pro.nvim")
|
try_loadstring("\27LJ\2\n6\0\0\3\0\3\0\0066\0\0\0'\2\1\0B\0\2\0029\0\2\0B\0\1\1K\0\1\0\nsetup\rwrapping\frequire\0", "config", "wrapping.nvim")
|
||||||
time([[Config for monokai-pro.nvim]], false)
|
time([[Config for wrapping.nvim]], false)
|
||||||
|
|
||||||
_G._packer.inside_compile = false
|
_G._packer.inside_compile = false
|
||||||
if _G._packer.needs_bufread == true then
|
if _G._packer.needs_bufread == true then
|
||||||
|
|
|
@ -0,0 +1,252 @@
|
||||||
|
#################
|
||||||
|
# Rust Snippets #
|
||||||
|
#################
|
||||||
|
|
||||||
|
# Functions
|
||||||
|
snippet fn "Function definition"
|
||||||
|
fn ${1:function_name}(${2})${3} {
|
||||||
|
${0}
|
||||||
|
}
|
||||||
|
snippet pfn "Function definition"
|
||||||
|
pub fn ${1:function_name}(${2})${3} {
|
||||||
|
${0}
|
||||||
|
}
|
||||||
|
snippet afn "Async function definition"
|
||||||
|
async fn ${1:function_name}(${2})${3} {
|
||||||
|
${0}
|
||||||
|
}
|
||||||
|
snippet pafn "Async function definition"
|
||||||
|
pub async fn ${1:function_name}(${2})${3} {
|
||||||
|
${0}
|
||||||
|
}
|
||||||
|
snippet bench "Bench function" b
|
||||||
|
#[bench]
|
||||||
|
fn ${1:bench_function_name}(b: &mut test::Bencher) {
|
||||||
|
b.iter(|| {
|
||||||
|
${0}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
snippet new "Constructor function"
|
||||||
|
pub fn new(${2}) -> ${1:Self} {
|
||||||
|
$1 { ${3} }
|
||||||
|
}
|
||||||
|
snippet main "Main function"
|
||||||
|
pub fn main() {
|
||||||
|
${0}
|
||||||
|
}
|
||||||
|
snippet let "let variable declaration with type inference"
|
||||||
|
let ${1} = ${2};
|
||||||
|
snippet lett "let variable declaration with explicit type annotation"
|
||||||
|
let ${1}: ${2} = ${3};
|
||||||
|
snippet letm "let mut variable declaration with type inference"
|
||||||
|
let mut ${1} = ${2};
|
||||||
|
snippet lettm "let mut variable declaration with explicit type annotation"
|
||||||
|
let mut ${1}: ${2} = ${3};
|
||||||
|
snippet pri "print!"
|
||||||
|
print!("${1}");
|
||||||
|
snippet pri, "print! with format param"
|
||||||
|
print!("${1}{${2}}", ${3});
|
||||||
|
snippet pln "println!"
|
||||||
|
println!("${1}");
|
||||||
|
snippet pln, "println! with format param"
|
||||||
|
println!("${1}{${2}}", ${3});
|
||||||
|
snippet fmt "format!"
|
||||||
|
format!("${1}{${2}}", ${3});
|
||||||
|
snippet d "dbg! debugging macro"
|
||||||
|
dbg!(${0:${VISUAL}})
|
||||||
|
snippet d; "dbg! debugging macro statement"
|
||||||
|
dbg!(&${1});
|
||||||
|
${0}
|
||||||
|
# Modules
|
||||||
|
snippet ec "extern crate"
|
||||||
|
extern crate ${1:sync};
|
||||||
|
snippet ecl "extern crate log"
|
||||||
|
#[macro_use]
|
||||||
|
extern crate log;
|
||||||
|
snippet mod
|
||||||
|
mod ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} {
|
||||||
|
${0}
|
||||||
|
} /* $1 */
|
||||||
|
# Testing
|
||||||
|
snippet as "assert!"
|
||||||
|
assert!(${1:predicate});
|
||||||
|
snippet ase "assert_eq!"
|
||||||
|
assert_eq!(${1:expected}, ${2:actual});
|
||||||
|
snippet test "Unit test function"
|
||||||
|
#[test]
|
||||||
|
fn ${1:function_name}_test() {
|
||||||
|
${0}
|
||||||
|
}
|
||||||
|
snippet testmod "Test module" b
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
use super::${1:*};
|
||||||
|
|
||||||
|
test${0}
|
||||||
|
}
|
||||||
|
snippet ig "#[ignore]"
|
||||||
|
#[ignore]
|
||||||
|
# Attributes
|
||||||
|
snippet allow "allow lint attribute" b
|
||||||
|
#[allow(${1:unused_variables})]
|
||||||
|
snippet cfg "cfg attribute" b
|
||||||
|
#[cfg(${1:target_os = "linux"})]
|
||||||
|
snippet feat "feature attribute" b
|
||||||
|
#![feature(${1:plugin})]
|
||||||
|
snippet der "#[derive(..)]" b
|
||||||
|
#[derive(${1:Debug})]
|
||||||
|
snippet attr "#[..]" b
|
||||||
|
#[${1:inline}]
|
||||||
|
snippet crate "Define create meta attributes"
|
||||||
|
// Crate name
|
||||||
|
#![crate_name = "${1:crate_name}"]
|
||||||
|
// Additional metadata attributes
|
||||||
|
#![desc = "${2:Description.}"]
|
||||||
|
#![license = "${3:BSD}"]
|
||||||
|
#![comment = "${4:Comment.}"]
|
||||||
|
// Specify the output type
|
||||||
|
#![crate_type = "${5:lib}"]
|
||||||
|
# Common types
|
||||||
|
snippet opt "Option<T>"
|
||||||
|
Option<${1:i32}>
|
||||||
|
snippet res "Result<T, E>"
|
||||||
|
Result<${1:&str}, ${2:()}>
|
||||||
|
# Control structures
|
||||||
|
snippet if
|
||||||
|
if ${1} {
|
||||||
|
${0:${VISUAL}}
|
||||||
|
}
|
||||||
|
snippet ife "if / else"
|
||||||
|
if ${1} {
|
||||||
|
${2:${VISUAL}}
|
||||||
|
} else {
|
||||||
|
${0}
|
||||||
|
}
|
||||||
|
snippet ifl "if let (...)"
|
||||||
|
if let ${1:Some($2)} = $3 {
|
||||||
|
${0:${VISUAL}}
|
||||||
|
}
|
||||||
|
snippet el "else"
|
||||||
|
else {
|
||||||
|
${0:${VISUAL}}
|
||||||
|
}
|
||||||
|
snippet eli "else if"
|
||||||
|
else if ${1} {
|
||||||
|
${0:${VISUAL}}
|
||||||
|
}
|
||||||
|
snippet mat "match pattern"
|
||||||
|
match ${1} {
|
||||||
|
${2} => ${3}
|
||||||
|
}
|
||||||
|
snippet case "Case clause of pattern match"
|
||||||
|
${1:_} => ${2:expression}
|
||||||
|
snippet = "=> "
|
||||||
|
=> $0
|
||||||
|
snippet loop "loop {}" b
|
||||||
|
loop {
|
||||||
|
${0:${VISUAL}}
|
||||||
|
}
|
||||||
|
snippet wh "while loop"
|
||||||
|
while $1 {
|
||||||
|
${0:${VISUAL}}
|
||||||
|
}
|
||||||
|
snippet whl "while let (...)"
|
||||||
|
while let ${1:Some($2)} = $3 {
|
||||||
|
${0:${VISUAL}}
|
||||||
|
}
|
||||||
|
snippet for "for ... in ... loop"
|
||||||
|
for ${1:i} in ${2} {
|
||||||
|
${0}
|
||||||
|
}
|
||||||
|
# TODO commenting
|
||||||
|
snippet todo "TODO comment"
|
||||||
|
// TODO: $0
|
||||||
|
snippet fixme "FIXME comment"
|
||||||
|
// FIXME: $0
|
||||||
|
# Struct
|
||||||
|
snippet st "Struct definition"
|
||||||
|
struct ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} {
|
||||||
|
${0}
|
||||||
|
}
|
||||||
|
snippet impl "Struct/Trait implementation"
|
||||||
|
impl ${1:Type/Trait}${2: for $3} {
|
||||||
|
${0}
|
||||||
|
}
|
||||||
|
snippet stn "Struct with new constructor"
|
||||||
|
pub struct ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} {
|
||||||
|
${0}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl$2 $1$2 {
|
||||||
|
pub fn new(${4}) -> Self {
|
||||||
|
$1 { ${5} }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
snippet ty "Type alias"
|
||||||
|
type ${1:NewName} = $2;
|
||||||
|
snippet enum "enum definition"
|
||||||
|
enum ${1:Name} {
|
||||||
|
${2},
|
||||||
|
}
|
||||||
|
snippet penum "pub enum definition"
|
||||||
|
pub enum ${1:Name} {
|
||||||
|
${2},
|
||||||
|
}
|
||||||
|
# Traits
|
||||||
|
snippet trait "Trait definition"
|
||||||
|
trait ${1:Name} {
|
||||||
|
${0}
|
||||||
|
}
|
||||||
|
snippet drop "Drop trait implementation (destructor)"
|
||||||
|
impl Drop for $1 {
|
||||||
|
fn drop(&mut self) {
|
||||||
|
${0}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
# Statics
|
||||||
|
snippet ss "static string declaration"
|
||||||
|
static ${1}: &'static str = "${0}";
|
||||||
|
snippet stat "static item declaration"
|
||||||
|
static ${1}: ${2:usize} = ${0};
|
||||||
|
# Concurrency
|
||||||
|
snippet spawn "spawn a thread"
|
||||||
|
thread::spawn(${1:move }|| {
|
||||||
|
${0}
|
||||||
|
});
|
||||||
|
snippet chan "Declare (Sender, Receiver) pair of asynchronous channel()"
|
||||||
|
let (${1:tx}, ${2:rx}): (Sender<${3:i32}>, Receiver<${4:i32}>) = channel();
|
||||||
|
# Implementations
|
||||||
|
snippet asref "AsRef trait implementation"
|
||||||
|
impl AsRef<${1:Ref}> for ${2:Type} {
|
||||||
|
fn as_ref(&self) -> &${3:$1} {
|
||||||
|
&self.${0:field}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
snippet asmut "AsMut trait implementation"
|
||||||
|
impl AsMut<${1:Ref}> for ${2:Type} {
|
||||||
|
fn as_mut(&mut self) -> &mut ${3:$1} {
|
||||||
|
&mut self.${0:field}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
snippet fd "Struct field definition" w
|
||||||
|
${1:name}: ${2:Type},
|
||||||
|
snippet || "Closure, anonymous function (inline)" i
|
||||||
|
${1:move }|$2| { $3 }
|
||||||
|
snippet |} "Closure, anonymous function (block)" i
|
||||||
|
${1:move }|$2| {
|
||||||
|
$3
|
||||||
|
}
|
||||||
|
snippet macro "macro_rules!" b
|
||||||
|
macro_rules! ${1:name} {
|
||||||
|
(${2:matcher}) => (
|
||||||
|
$3
|
||||||
|
)
|
||||||
|
}
|
||||||
|
snippet boxp "Box::new()"
|
||||||
|
Box::new(${0:${VISUAL}})
|
||||||
|
snippet rc "Rc::new()"
|
||||||
|
Rc::new(${0:${VISUAL}})
|
||||||
|
snippet unim "unimplemented!()"
|
||||||
|
unimplemented!()
|
||||||
|
snippet use "use ...;" b
|
||||||
|
use ${1:std::$2};
|
|
@ -0,0 +1,427 @@
|
||||||
|
#version 1
|
||||||
|
#PREAMBLE
|
||||||
|
#documentclass without options
|
||||||
|
snippet dcl \documentclass{}
|
||||||
|
\\documentclass{${1:class}} ${0}
|
||||||
|
#documentclass with options
|
||||||
|
snippet dclo \documentclass[]{}
|
||||||
|
\\documentclass[${1:options}]{${2:class}} ${0}
|
||||||
|
|
||||||
|
#newcommand
|
||||||
|
snippet nc \newcommand
|
||||||
|
\\newcommand{\\${1:cmd}}[${2:opt}]{${3:realcmd}} ${0}
|
||||||
|
#usepackage
|
||||||
|
snippet up \usepackage
|
||||||
|
\\usepackage[${1:options}]{${2:package}} ${0}
|
||||||
|
#newunicodechar
|
||||||
|
snippet nuc \newunicodechar
|
||||||
|
\\newunicodechar{${1}}{${2:\\ensuremath}${3:tex-substitute}}} ${0}
|
||||||
|
#DeclareMathOperator
|
||||||
|
snippet dmo \DeclareMathOperator
|
||||||
|
\\DeclareMathOperator{${1}}{${2}} ${0}
|
||||||
|
|
||||||
|
#DOCUMENT
|
||||||
|
# \begin{}...\end{}
|
||||||
|
snippet begin \begin{} ... \end{} block
|
||||||
|
\\begin{${1:env}}
|
||||||
|
${0:${VISUAL}}
|
||||||
|
\\end{$1}
|
||||||
|
|
||||||
|
# Maketitle
|
||||||
|
snippet mkt maketitle
|
||||||
|
\\maketitle
|
||||||
|
|
||||||
|
# Tabular
|
||||||
|
snippet tab tabular (or arbitrary) environment
|
||||||
|
\\begin{${1:tabular}}{${2:c}}
|
||||||
|
${0:${VISUAL}}
|
||||||
|
\\end{$1}
|
||||||
|
snippet thm thm (or arbitrary) environment with optional argument
|
||||||
|
\\begin[${1:author}]{${2:thm}}
|
||||||
|
${0:${VISUAL}}
|
||||||
|
\\end{$2}
|
||||||
|
snippet center center environment
|
||||||
|
\\begin{center}
|
||||||
|
${0:${VISUAL}}
|
||||||
|
\\end{center}
|
||||||
|
# Align(ed)
|
||||||
|
snippet ali align(ed) environment
|
||||||
|
\\begin{align${1:ed}}
|
||||||
|
\\label{eq:${2}}
|
||||||
|
${0:${VISUAL}}
|
||||||
|
\\end{align$1}
|
||||||
|
# Gather(ed)
|
||||||
|
snippet gat gather(ed) environment
|
||||||
|
\\begin{gather${1:ed}}
|
||||||
|
${0:${VISUAL}}
|
||||||
|
\\end{gather$1}
|
||||||
|
# Equation
|
||||||
|
snippet eq equation environment
|
||||||
|
\\begin{equation}
|
||||||
|
${0:${VISUAL}}
|
||||||
|
\\end{equation}
|
||||||
|
# Equation
|
||||||
|
snippet eql Labeled equation environment
|
||||||
|
\\begin{equation}
|
||||||
|
\\label{eq:${2}}
|
||||||
|
${0:${VISUAL}}
|
||||||
|
\\end{equation}
|
||||||
|
# Equation
|
||||||
|
snippet eq* unnumbered equation environment
|
||||||
|
\\begin{equation*}
|
||||||
|
${0:${VISUAL}}
|
||||||
|
\\end{equation*}
|
||||||
|
# Unnumbered Equation
|
||||||
|
snippet \ unnumbered equation: \[ ... \]
|
||||||
|
\\[
|
||||||
|
${0:${VISUAL}}
|
||||||
|
\\]
|
||||||
|
# Equation array
|
||||||
|
snippet eqnarray eqnarray environment
|
||||||
|
\\begin{eqnarray}
|
||||||
|
${0:${VISUAL}}
|
||||||
|
\\end{eqnarray}
|
||||||
|
# Label
|
||||||
|
snippet lab \label
|
||||||
|
\\label{${1:eq:}${2:fig:}${3:tab:}${0}}
|
||||||
|
# Enumerate
|
||||||
|
snippet enum enumerate environment
|
||||||
|
\\begin{enumerate}
|
||||||
|
\\item ${0}
|
||||||
|
\\end{enumerate}
|
||||||
|
snippet enuma enumerate environment
|
||||||
|
\\begin{enumerate}[(a)]
|
||||||
|
\\item ${0}
|
||||||
|
\\end{enumerate}
|
||||||
|
snippet enumi enumerate environment
|
||||||
|
\\begin{enumerate}[(i)]
|
||||||
|
\\item ${0}
|
||||||
|
\\end{enumerate}
|
||||||
|
# Itemize
|
||||||
|
snippet item itemize environment
|
||||||
|
\\begin{itemize}
|
||||||
|
\\item ${0}
|
||||||
|
\\end{itemize}
|
||||||
|
snippet it \item
|
||||||
|
\\item ${1:${VISUAL}}
|
||||||
|
# Description
|
||||||
|
snippet desc description environment
|
||||||
|
\\begin{description}
|
||||||
|
\\item[${1}] ${0}
|
||||||
|
\\end{description}
|
||||||
|
# Endless new item
|
||||||
|
snippet ]i \item (recursive)
|
||||||
|
\\item ${1}
|
||||||
|
${0:]i}
|
||||||
|
# Matrix
|
||||||
|
snippet mat smart matrix environment
|
||||||
|
\\begin{${1:p/b/v/V/B/small}matrix}
|
||||||
|
${0:${VISUAL}}
|
||||||
|
\\end{$1matrix}
|
||||||
|
# Cases
|
||||||
|
snippet cas cases environment
|
||||||
|
\\begin{cases}
|
||||||
|
${1:equation}, &\\text{ if }${2:case}\\
|
||||||
|
${0:${VISUAL}}
|
||||||
|
\\end{cases}
|
||||||
|
# Split
|
||||||
|
snippet spl split environment
|
||||||
|
\\begin{split}
|
||||||
|
${0:${VISUAL}}
|
||||||
|
\\end{split}
|
||||||
|
# Part
|
||||||
|
snippet part document \part
|
||||||
|
\\part{${1:part name}} % (fold)%
|
||||||
|
\\label{prt:${2:$1}}
|
||||||
|
${0}
|
||||||
|
% part $2 (end)
|
||||||
|
# Chapter
|
||||||
|
snippet cha \chapter
|
||||||
|
\\chapter{${1:chapter name}}%
|
||||||
|
\\label{cha:${2:$1}}
|
||||||
|
${0}
|
||||||
|
# Section
|
||||||
|
snippet sec \section
|
||||||
|
\\section{${1:section name}}%
|
||||||
|
\\label{sec:${2:$1}}
|
||||||
|
${0}
|
||||||
|
# Section without number
|
||||||
|
snippet sec* \section*
|
||||||
|
\\section*{${1:section name}}%
|
||||||
|
\\label{sec:${2:$1}}
|
||||||
|
${0}
|
||||||
|
# Sub Section
|
||||||
|
snippet sub \subsection
|
||||||
|
\\subsection{${1:subsection name}}%
|
||||||
|
\\label{sub:${2:$1}}
|
||||||
|
${0}
|
||||||
|
# Sub Section without number
|
||||||
|
snippet sub* \subsection*
|
||||||
|
\\subsection*{${1:subsection name}}%
|
||||||
|
\\label{sub:${2:$1}}
|
||||||
|
${0}
|
||||||
|
# Sub Sub Section
|
||||||
|
snippet ssub \subsubsection
|
||||||
|
\\subsubsection{${1:subsubsection name}}%
|
||||||
|
\\label{ssub:${2:$1}}
|
||||||
|
${0}
|
||||||
|
# Sub Sub Section without number
|
||||||
|
snippet ssub* \subsubsection*
|
||||||
|
\\subsubsection*{${1:subsubsection name}}%
|
||||||
|
\\label{ssub:${2:$1}}
|
||||||
|
${0}
|
||||||
|
# Paragraph
|
||||||
|
snippet par \paragraph
|
||||||
|
\\paragraph{${1:paragraph name}}%
|
||||||
|
\\label{par:${2:$1}}
|
||||||
|
${0}
|
||||||
|
# Paragraph*
|
||||||
|
snippet par* \paragraph*
|
||||||
|
\\paragraph*{${1:paragraph name}}%
|
||||||
|
\\label{par:${2:$1}}
|
||||||
|
${0}
|
||||||
|
# Sub Paragraph
|
||||||
|
snippet subp \subparagraph
|
||||||
|
\\subparagraph{${1:subparagraph name}}%
|
||||||
|
\\label{subp:${2:$1}}
|
||||||
|
${0}
|
||||||
|
# Sub Paragraph*
|
||||||
|
snippet subp* \subparagraph*
|
||||||
|
\\subparagraph*{${1:subparagraph name}}%
|
||||||
|
\\label{subp:${2:$1}}
|
||||||
|
${0}
|
||||||
|
snippet ni \noindent
|
||||||
|
\\noindent
|
||||||
|
${0}
|
||||||
|
#References
|
||||||
|
snippet itd description \item
|
||||||
|
\\item[${1:description}] ${0:item}
|
||||||
|
snippet figure reference to a figure
|
||||||
|
${1:Figure}~\\ref{${2:fig:}}
|
||||||
|
snippet table reference to a table
|
||||||
|
${1:Table}~\\ref{${2:tab:}}
|
||||||
|
snippet listing reference to a listing
|
||||||
|
${1:Listing}~\\ref{${2:list}}
|
||||||
|
snippet section reference to a section
|
||||||
|
${1:Section}~\\ref{sec:${2}} ${0}
|
||||||
|
snippet page reference to a page
|
||||||
|
${1:page}~\\pageref{${2}} ${0}
|
||||||
|
snippet index \index
|
||||||
|
\\index{${1:index}} ${0}
|
||||||
|
#Citations
|
||||||
|
snippet citen \citen
|
||||||
|
\\citen{${1}} ${0}
|
||||||
|
# natbib citations
|
||||||
|
snippet citep \citep
|
||||||
|
\\citep{${1}} ${0}
|
||||||
|
snippet citet \citet
|
||||||
|
\\citet{${1}} ${0}
|
||||||
|
snippet cite \cite[]{}
|
||||||
|
\\cite[${1}]{${2}} ${0}
|
||||||
|
snippet citea \citeauthor
|
||||||
|
\\citeauthor{${1}} ${0}
|
||||||
|
snippet citey \citeyear
|
||||||
|
\\citeyear{${1}} ${0}
|
||||||
|
snippet fcite \footcite[]{}
|
||||||
|
\\footcite[${1}]{${2}}${0}
|
||||||
|
#Formating text: italic, bold, underline, small capital, emphase ..
|
||||||
|
snippet ita italic text
|
||||||
|
\\textit{${1:${VISUAL:text}}}${0}
|
||||||
|
snippet bf bold face text
|
||||||
|
\\textbf{${1:${VISUAL:text}}}${0}
|
||||||
|
snippet under underline text
|
||||||
|
\\underline{${1:${VISUAL:text}}}${0}
|
||||||
|
snippet over overline text
|
||||||
|
\\overline{${1:${VISUAL:text}}}${0}
|
||||||
|
snippet emp emphasize text
|
||||||
|
\\emph{${1:${VISUAL:text}}}${0}
|
||||||
|
snippet sc small caps text
|
||||||
|
\\textsc{${1:${VISUAL:text}}}${0}
|
||||||
|
#Choosing font
|
||||||
|
snippet sf sans serife text
|
||||||
|
\\textsf{${1:${VISUAL:text}}}${0}
|
||||||
|
snippet rm roman font text
|
||||||
|
\\textrm{${1:${VISUAL:text}}}${0}
|
||||||
|
snippet tt typewriter (monospace) text
|
||||||
|
\\texttt{${1:${VISUAL:text}}}${0}
|
||||||
|
snippet tsub subscripted text
|
||||||
|
\\textsubscript{${1:${VISUAL:text}}}${0}
|
||||||
|
snippet tsup superscripted text
|
||||||
|
\\textsuperscript{${1:${VISUAL:text}}}${0}
|
||||||
|
#Math font
|
||||||
|
snippet mf mathfrak
|
||||||
|
\\mathfrak{${1:${VISUAL:text}}}${0}
|
||||||
|
snippet mc mathcal
|
||||||
|
\\mathcal{${1:${VISUAL:text}}}${0}
|
||||||
|
snippet ms mathscr
|
||||||
|
\\mathscr{${1:${VISUAL:text}}}${0}
|
||||||
|
#misc
|
||||||
|
snippet ft \footnote
|
||||||
|
\\footnote{${1:${VISUAL:text}}}${0}
|
||||||
|
snippet fig figure environment (includegraphics)
|
||||||
|
\\begin{figure}
|
||||||
|
\\begin{center}
|
||||||
|
\\includegraphics[scale=${1}]{Figures/${2}}
|
||||||
|
\\end{center}
|
||||||
|
\\caption{${3}}
|
||||||
|
\\label{fig:${4}}
|
||||||
|
\\end{figure}
|
||||||
|
${0}
|
||||||
|
snippet tikz figure environment (tikzpicture)
|
||||||
|
\\begin{figure}[htpb]
|
||||||
|
\\begin{center}
|
||||||
|
\\begin{tikzpicture}[scale=${1:1}, transform shape]
|
||||||
|
${2}
|
||||||
|
\\end{tikzpicture}
|
||||||
|
\\end{center}
|
||||||
|
\\caption{${3}}%
|
||||||
|
\\label{fig:${4}}
|
||||||
|
\\end{figure}
|
||||||
|
${0}
|
||||||
|
snippet subfig subfigure environment
|
||||||
|
\\begin{subfigure}[${1}]{${2:\\textwidth}}
|
||||||
|
\\begin{center}
|
||||||
|
${3}
|
||||||
|
\\end{center}
|
||||||
|
\\caption{${4}}
|
||||||
|
\\label{fig:${5}}
|
||||||
|
\\end{subfigure}
|
||||||
|
${0}
|
||||||
|
snippet tikzcd tikzcd environment in equation
|
||||||
|
\\begin{equation}
|
||||||
|
\\begin{tikzcd}
|
||||||
|
${1}
|
||||||
|
\\end{tikzcd}
|
||||||
|
\\end{equation}
|
||||||
|
${0}
|
||||||
|
snippet tikzcd* tikzcd environment in equation*
|
||||||
|
\\begin{equation*}
|
||||||
|
\\begin{tikzcd}
|
||||||
|
${1}
|
||||||
|
\\end{tikzcd}
|
||||||
|
\\end{equation*}
|
||||||
|
${0}
|
||||||
|
#math
|
||||||
|
snippet stackrel \stackrel{}{}
|
||||||
|
\\stackrel{${1:above}}{${2:below}} ${0}
|
||||||
|
snippet frac \frac{}{}
|
||||||
|
\\frac{${1:num}}{${2:denom}} ${0}
|
||||||
|
snippet sum \sum^{}_{}
|
||||||
|
\\sum^{${1:n}}_{${2:i=1}} ${0}
|
||||||
|
snippet lim \lim_{}
|
||||||
|
\\lim_{${1:n \\to \\infty}} ${0}
|
||||||
|
snippet frame frame environment
|
||||||
|
\\begin{frame}[${1:t}]
|
||||||
|
\frametitle{${2:title}}
|
||||||
|
\framesubtitle{${3:subtitle}}
|
||||||
|
${0:${VISUAL}}
|
||||||
|
\\end{frame}
|
||||||
|
snippet block block environment
|
||||||
|
\\begin{block}{${1:title}}
|
||||||
|
${0:${VISUAL}}
|
||||||
|
\\end{block}
|
||||||
|
snippet alert alert text
|
||||||
|
\\alert{${1:${VISUAL:text}}} ${0}
|
||||||
|
snippet alertblock alertblock environment
|
||||||
|
\\begin{alertblock}{${1:title}}
|
||||||
|
${0:${VISUAL}}
|
||||||
|
\\end{alertblock}
|
||||||
|
snippet example exampleblock environment
|
||||||
|
\\begin{exampleblock}{${1:title}}
|
||||||
|
${0:${VISUAL}}
|
||||||
|
\\end{exampleblock}
|
||||||
|
snippet col2 two-column environment
|
||||||
|
\\begin{columns}
|
||||||
|
\\begin{column}{0.5\\textwidth}
|
||||||
|
${1}
|
||||||
|
\\end{column}
|
||||||
|
\\begin{column}{0.5\\textwidth}
|
||||||
|
${0}
|
||||||
|
\\end{column}
|
||||||
|
\\end{columns}
|
||||||
|
snippet multicol2 two-column environment with multicol
|
||||||
|
\\begin{multicols}{2}
|
||||||
|
${1}
|
||||||
|
\columnbreak
|
||||||
|
${0}
|
||||||
|
\\end{multicols}
|
||||||
|
snippet \{ \{ \}
|
||||||
|
\\{ ${0} \\}
|
||||||
|
#delimiter
|
||||||
|
snippet lr left right
|
||||||
|
\\left${1} ${0:${VISUAL}} \\right$1
|
||||||
|
snippet lr( left( right)
|
||||||
|
\\left( ${0:${VISUAL}} \\right)
|
||||||
|
snippet lr| left| right|
|
||||||
|
\\left| ${0:${VISUAL}} \\right|
|
||||||
|
snippet lr{ left\{ right\}
|
||||||
|
\\left\\{ ${0:${VISUAL}} \\right\\}
|
||||||
|
snippet lr[ left[ right]
|
||||||
|
\\left[ ${0:${VISUAL}} \\right]
|
||||||
|
snippet lra langle rangle
|
||||||
|
\\langle ${0:${VISUAL}} \\rangle
|
||||||
|
# Code listings
|
||||||
|
snippet lst
|
||||||
|
\\begin{listing}[language=${1:language}]
|
||||||
|
${0:${VISUAL}}
|
||||||
|
\\end{listing}
|
||||||
|
snippet lsi
|
||||||
|
\\lstinline|${1}| ${0}
|
||||||
|
# Hyperlinks
|
||||||
|
snippet url
|
||||||
|
\\url{${1}} ${0}
|
||||||
|
snippet href
|
||||||
|
\\href{${1}}{${2}} ${0}
|
||||||
|
# URL from Clipboard.
|
||||||
|
snippet urlc
|
||||||
|
\\url{`@+`} ${0}
|
||||||
|
snippet hrefc
|
||||||
|
\\href{`@+`}{${1}} ${0}
|
||||||
|
# enquote from package csquotes
|
||||||
|
snippet enq enquote
|
||||||
|
\\enquote{${1:${VISUAL:text}}} ${0}
|
||||||
|
# Time derivative
|
||||||
|
snippet ddt time derivative
|
||||||
|
\\frac{d}{dt} {$1} {$0}
|
||||||
|
# Limit
|
||||||
|
snippet lim limit
|
||||||
|
\\lim_{{$1}} {{$2}} {$0}
|
||||||
|
# Partial derivative
|
||||||
|
snippet pdv partial derivation
|
||||||
|
\\frac{\\partial {$1}}{\\partial {$2}} {$0}
|
||||||
|
# Second order partial derivative
|
||||||
|
snippet ppdv second partial derivation
|
||||||
|
\\frac{\\partial^2 {$1}}{\\partial {$2} \\partial {$3}} {$0}
|
||||||
|
# Ordinary derivative
|
||||||
|
snippet dv derivative
|
||||||
|
\\frac{d {$1}}{d {$2}} {$0}
|
||||||
|
# Summation
|
||||||
|
snippet summ summation
|
||||||
|
\\sum_{{$1}} {$0}
|
||||||
|
# Shorthand for time derivative
|
||||||
|
snippet dot dot
|
||||||
|
\\dot{{$1}} {$0}
|
||||||
|
# Shorthand for second order time derivative
|
||||||
|
snippet ddot ddot
|
||||||
|
\\ddot{{$1}} {$0}
|
||||||
|
# Vector
|
||||||
|
snippet vec vector
|
||||||
|
\\vec{{$1}} {$0}
|
||||||
|
# Bar
|
||||||
|
snippet bar bar
|
||||||
|
\\bar{{$1}} {$0}
|
||||||
|
# Cross product
|
||||||
|
snippet \x cross product
|
||||||
|
\\times {$0}
|
||||||
|
# Dot product
|
||||||
|
snippet . dot product
|
||||||
|
\\cdot {$0}
|
||||||
|
# Integral
|
||||||
|
snippet int integral
|
||||||
|
\\int_{{$1}}^{{$2}} {$3} \\: d{$4} {$0}
|
||||||
|
# Right arrow
|
||||||
|
snippet ra rightarrow
|
||||||
|
\\rightarrow {$0}
|
||||||
|
# Long right arrow
|
||||||
|
snippet lra longrightarrow
|
||||||
|
\\longrightarrow {$0}
|
|
@ -0,0 +1,137 @@
|
||||||
|
#
|
||||||
|
## Libraries
|
||||||
|
|
||||||
|
snippet lib
|
||||||
|
library ${1}
|
||||||
|
use $1.${2}
|
||||||
|
|
||||||
|
# Standard Libraries
|
||||||
|
snippet libs
|
||||||
|
library IEEE;
|
||||||
|
use IEEE.std_logic_1164.ALL;
|
||||||
|
use IEEE.numeric_std.ALL;
|
||||||
|
|
||||||
|
# Xilinx Library
|
||||||
|
snippet libx
|
||||||
|
library UNISIM;
|
||||||
|
use UNISIM.VCOMPONENTS.ALL;
|
||||||
|
|
||||||
|
## Entity Declaration
|
||||||
|
snippet ent
|
||||||
|
entity ${1:`vim_snippets#Filename()`} is
|
||||||
|
generic (
|
||||||
|
${2}
|
||||||
|
);
|
||||||
|
port (
|
||||||
|
${3}
|
||||||
|
);
|
||||||
|
end entity $1;
|
||||||
|
|
||||||
|
## Architecture
|
||||||
|
snippet arc
|
||||||
|
architecture ${1:behav} of ${2:`vim_snippets#Filename()`} is
|
||||||
|
|
||||||
|
${3}
|
||||||
|
|
||||||
|
begin
|
||||||
|
|
||||||
|
|
||||||
|
end $1;
|
||||||
|
|
||||||
|
## Declarations
|
||||||
|
# std_logic
|
||||||
|
snippet st
|
||||||
|
signal ${1} : std_logic;
|
||||||
|
# std_logic_vector
|
||||||
|
snippet sv
|
||||||
|
signal ${1} : std_logic_vector (${2} downto 0);
|
||||||
|
# std_logic in
|
||||||
|
snippet ist
|
||||||
|
${1} : in std_logic;
|
||||||
|
# std_logic_vector in
|
||||||
|
snippet isv
|
||||||
|
${1} : in std_logic_vector (${2} downto 0);
|
||||||
|
# std_logic out
|
||||||
|
snippet ost
|
||||||
|
${1} : out std_logic;
|
||||||
|
# std_logic_vector out
|
||||||
|
snippet osv
|
||||||
|
${1} : out std_logic_vector (${2} downto 0);
|
||||||
|
# unsigned
|
||||||
|
snippet un
|
||||||
|
signal ${1} : unsigned (${2} downto 0);
|
||||||
|
## Process Statements
|
||||||
|
# process
|
||||||
|
snippet pr
|
||||||
|
process (${1})
|
||||||
|
begin
|
||||||
|
${2}
|
||||||
|
end process;
|
||||||
|
# process with clock
|
||||||
|
snippet prc
|
||||||
|
process (${1:clk})
|
||||||
|
begin
|
||||||
|
if rising_edge ($1) then
|
||||||
|
${2}
|
||||||
|
end if;
|
||||||
|
end process;
|
||||||
|
# process with clock and reset
|
||||||
|
snippet prcr
|
||||||
|
process (${1:clk}, ${2:nrst})
|
||||||
|
begin
|
||||||
|
if ($2 = '${3:0}') then
|
||||||
|
${4}
|
||||||
|
elsif rising_edge($1) then
|
||||||
|
${5}
|
||||||
|
end if;
|
||||||
|
end process;
|
||||||
|
# process all
|
||||||
|
snippet pra
|
||||||
|
process (${1:all})
|
||||||
|
begin
|
||||||
|
${2}
|
||||||
|
end process;
|
||||||
|
## Control Statements
|
||||||
|
# if
|
||||||
|
snippet if
|
||||||
|
if ${1} then
|
||||||
|
${2}
|
||||||
|
end if;
|
||||||
|
# if
|
||||||
|
snippet ife
|
||||||
|
if ${1} then
|
||||||
|
${2}
|
||||||
|
else
|
||||||
|
${3}
|
||||||
|
end if;
|
||||||
|
# else
|
||||||
|
snippet el
|
||||||
|
else
|
||||||
|
${1}
|
||||||
|
# if
|
||||||
|
snippet eif
|
||||||
|
elsif ${1} then
|
||||||
|
${2}
|
||||||
|
# case
|
||||||
|
snippet ca
|
||||||
|
case ${1} is
|
||||||
|
${2}
|
||||||
|
end case;
|
||||||
|
# when
|
||||||
|
snippet wh
|
||||||
|
when ${1} =>
|
||||||
|
${2}
|
||||||
|
# for
|
||||||
|
snippet for
|
||||||
|
for ${1:i} in ${2} ${3:to} ${4} loop
|
||||||
|
${5}
|
||||||
|
end loop;
|
||||||
|
# while
|
||||||
|
snippet wh
|
||||||
|
while ${1} loop
|
||||||
|
${2}
|
||||||
|
end loop;
|
||||||
|
## Misc
|
||||||
|
# others
|
||||||
|
snippet oth
|
||||||
|
(others => '${1:0}');
|
Loading…
Reference in New Issue