Leap + local custom snippets

main
spike 2 years ago
parent ddb78b21d0
commit a5bfe2977e

@ -1,3 +1,4 @@
- per project lsp settings
- set neovim shell to bash/sh for faster commands (fish is slow)
see https://www.reddit.com/r/neovim/comments/opipij/guide_tips_and_tricks_to_reduce_startup_and/
- yank until end of line $ mapping

@ -1 +0,0 @@
../../dotfiles/nvim/.config/nvim/mysnippets

@ -0,0 +1,37 @@
priority -55
global !p
from vimsnippets import foldmarker, make_box, get_comment_format
endglobal
################
# ANSI Color Codes #
################
# The table starts with the original 16 colors (0-15).
# The proceeding 216 colors (16-231) or formed by a 3bpc RGB value offset by
# 16, packed into a single value.
# The final 24 colors (232-256) are grayscale
# starting from a shade slighly lighter than black, ranging up to shade slightly
# darker than white.
# Some emulators interpret these steps as linear
# increments from (256 / 24) on all three channels, although some emulators may
# explicitly define these values.
snippet ansi_fg "Foreground ANSI 256 Color Code" i
\033[38;5;${1:00}m
endsnippet
snippet ansi_bg "Background ANSI 256 Color Code" i
\033[48;5;${1:00}m
endsnippet
snippet ansi_reset "Reset ANSI 256 Color Code" i
\033[0m
endsnippet

@ -0,0 +1,64 @@
snippet errl "Error log fatal" b
if err != nil {
log.Fatal(err)
}
$0
# Log error shortcuts
snippet errlp "Error with log.Panic" b
if err != nil {
log.Panic(err)
}
$0
snippet err "if err ..."
if err != nil {
$1
}
snippet lerr "if err ... log.Error"
if err != nil {
log.Error($1)
}
snippet lerrf "if err ... log.Error"
if err != nil {
log.Errorf($1)
}
snippet msg "api message"
"message": "$1"
snippet nnil "if ? != nil"
if $1 != nil {
$2
}
snippet ln "fmt.Println()"
fmt.Println($1)
snippet init "init func"
func init(){
$1
}
$0
snippet rget "redis get"
DB.Redis.Do(radix.FlatCmd(${1:target}, "GET", ${2:key}))
snippet rset "redis set" i
DB.Redis.Do(radix.FlatCmd(nil, "SET", ${1:key}, ${2:val}))

@ -0,0 +1,4 @@
snippet fn
function()
$0
end

@ -0,0 +1,72 @@
global !p
from snippet_tools import *
def expand_link_bottom(snip):
buf = snip.buffer
if snip.tabstop == 0:
vim.command('normal G')
buf.append('[' + snip.tabstops[2].current_text + ']: "' + snip.tabstops[1].current_text + '"')
#snip.expand_anon('$1')
endglobal
post_jump "expand_link_bottom(snip)"
snippet lnk "Reference Link Inline"
[${1:${VISUAL:name}}][${2:id}] $0
endsnippet
snippet ml "Insert math"
{{< ml "${1:${VISUAL:1+1}}" >}}
$0
endsnippet
snippet mli "Insert math"
{{< mli "${1:${VISUAL:1+1}}" >}}
$0
endsnippet
snippet abbr "Abbreviation"
{{< abbr "${1:${VISUAL:abbr}}" "$2" >}}
endsnippet
snippet footnote "Footnote"
{{< footnote >}}
${1:${VISUAL:footenote}}
{{< /footnote >}}
$0
endsnippet
snippet btc# "bitcoin issue" i
[#${1:${VISUAL:number}}](https://github.com/bitcoin/bitcoin/issues/$1)
endsnippet
snippet btc## "bitcoin issue shortcut"
{{< ghi ${1:${VISUAL:number}} >}}
endsnippet
snippet bip "Bitcoin Improvement Proposal" i
https://github.com/bitcoin/bips/blob/master/bip-${1:${VISUAL:0001}}.mediawiki
endsnippet
snippet slip "SatoshiLabs Improvement Proposal" i
https://github.com/satoshilabs/slips/blob/master/slip-${1:${VISUAL:0001}}.md
endsnippet
snippet lnd# "LND Issue" i
[#${1:${VISUAL:42}}](https://github.com/lightningnetwork/lnd/issues/$1)
endsnippet
snippet cl# "c-lightning issue" i
[#${1:${VISUAL:42}}](https://github.com/ElementsProject/lightning/issues/$1)
endsnippet
snippet hl "highlight"
{{< highlight $1 >}}
$2
{{< /highlight >}}
$0
endsnippet

@ -0,0 +1,3 @@
snippet li "zk link to note"
[${1:${VISUAL:name}}](${2:id}) $0

@ -132,7 +132,7 @@ M.general = { --{{{
-- luasnip edit snippets
["<leader>se"] = {
["<leader>sne"] = {
function()
require("luasnip.loaders").edit_snippet_files()
end,

@ -0,0 +1,8 @@
local present, leap = pcall(require, "leap")
if not present then
return
end
leap.set_default_keymaps()
leap.opts.special_keys.next_match = "<Space>"
leap.opts.special_keys.prev_match = "<BS>"

@ -149,10 +149,15 @@ return {
keys = {"."},
},
["justinmk/vim-sneak"] = {
lock = true,
keys = {"s", "S"},
["ggandor/leap.nvim"] = {
config = function()
require "custom.plugins.configs.leap"
end
},
-- ["justinmk/vim-sneak"] = {
-- lock = true,
-- keys = {"s", "S"},
-- },
["tpope/vim-surround"] = {},
["godlygeek/tabular"] = {
cmd = "Tabularize"

Loading…
Cancel
Save