1
0
mirror of https://github.com/amix/vimrc synced 2025-06-16 09:35:01 +08:00

Updated plugins

This commit is contained in:
Amir
2021-05-05 10:25:00 +02:00
parent 8e54cbc92e
commit a7a471a207
265 changed files with 7773 additions and 1880 deletions

View File

@ -30,6 +30,13 @@ endglobal
###########################################################################
# TextMate Snippets #
###########################################################################
snippet main
int main()
{
${0}
}
endsnippet
snippet forc "general for loop (for)"
for (${6:auto} ${1:i} = ${2:v.begin()}; `!p import re; snip.rv = re.split("[^\w]",t[1])[-1]` ${4:!=} ${3:`!p m = re.search(r'^(?:(.*)(\.|->)begin\(\)|((?:std|boost)::)?begin\((.*)\))$', t[2]); snip.rv = (((m.group(3) if m.group(3) else "") + "end(" + m.group(4) + ")") if m.group(4) else (m.group(1) + m.group(2) + "end()")) if m else ""`}; ${5:++`!p snip.rv = t[1].split(" ")[-1]`}) {
${VISUAL}$0

View File

@ -0,0 +1,61 @@
# https://www.conventionalcommits.org/en/v1.0.0-beta.2/#specification
snippet fix "fix conventional commit"
fix(${1:scope}): ${2:title}
${0:${VISUAL}}
endsnippet
snippet feat "feat conventional commit"
feat(${1:scope}): ${2:title}
${0:${VISUAL}}
endsnippet
snippet chore "chore conventional commit"
chore(${1:scope}): ${2:title}
${0:${VISUAL}}
endsnippet
snippet docs "docs conventional commit"
docs(${1:scope}): ${2:title}
${0:${VISUAL}}
endsnippet
snippet improvement "improvement conventional commit"
improvement(${1:scope}): ${2:title}
${0:${VISUAL}}
endsnippet
snippet perf "perf conventional commit"
perf(${1:scope}): ${2:title}
${0:${VISUAL}}
endsnippet
snippet refactor "refactor conventional commit"
refactor(${1:scope}): ${2:title}
${0:${VISUAL}}
endsnippet
snippet test "test conventional commit"
test(${1:scope}): ${2:title}
${0:${VISUAL}}
endsnippet
snippet ci "ci conventional commit"
ci(${1:scope}): ${2:title}
${0:${VISUAL}}
endsnippet
snippet build "build conventional commit"
build(${1:scope}): ${2:title}
${0:${VISUAL}}
endsnippet

View File

@ -1,3 +1,11 @@
global !p
# Capitalize the first letter without affecting the rest of the letters
def capitalize_first(word):
if(word):
word = word[0].upper() + word[1:]
return word
endglobal
# Functional components
snippet rfc "react functional component" b
import React, {useState} from "react"
@ -14,7 +22,7 @@ export default $4`!p snip.rv = snip.basename`
endsnippet
# React Hooks
snippet useS "useState Hook" b
const [${1}, set`!p snip.rv=t[1].title()`] = useState(${3:"${4}"})
const [${1}, set`!p snip.rv=capitalize_first(t[1])`] = useState(${3:"${4}"})
endsnippet
snippet useE "useEffect Hook" b
useEffect(() => {

View File

@ -8,6 +8,15 @@ snippet #! "#!/usr/bin/env lua" b
$0
endsnippet
snippet assert "Assertion" b
assert(${1:condition}`!p
if t[2]:
snip.rv = ", "
else:
snip.rv = ""
`${2:msg})
endsnippet
snippet !fun(ction)?! "New function" br
function ${1:new_function}(${2:args})
$0

View File

@ -8,11 +8,13 @@ global !p
import vim
import os.path
def get_module_namespace_and_basename():
"""This function will try to guess the current class or define name you are
trying to create. Note that for this to work you should be using the module
structure as per the style guide. Examples inputs and it's output
"""This function will try to guess the current class, define or type
name you are trying to create. Note that for this to work you should be
using the module structure as per the style guide. Examples inputs and
it's output
* /home/nikolavp/puppet/modules/collectd/manifests/init.pp -> collectd
* /home/nikolavp/puppet/modules/collectd/manfistes/mysql.pp -> collectd::mysql
* /home/nikolavp/puppet/modules/collectd/manifests/mysql.pp -> collectd::mysql
* /home/nikolavp/puppet/modules/collectd/types/dbname.pp -> Collectd::Dbname
"""
first_time = True
current_file_path_without_ext = vim.eval('expand("%:p:r")') or ""
@ -25,8 +27,12 @@ def get_module_namespace_and_basename():
first_time = False
parts = os.path.split(parts[0])
continue
if parts[1] == 'manifests':
return os.path.split(parts[0])[1] + ('::' + namespace).rstrip(':')
if parts[1] in ['manifests', 'types']:
parsed_name = os.path.split(
parts[0])[1] + ('::' + namespace).rstrip(':')
if parts[1] == 'types':
parsed_name = parsed_name.title()
return parsed_name
else:
namespace = parts[1] + '::' + namespace
parts = os.path.split(parts[0])
@ -51,6 +57,16 @@ define ${1:`!p snip.rv = get_module_namespace_and_basename()`} {
}
endsnippet
snippet type "Data type alias" b
type ${1:`!p snip.rv = get_module_namespace_and_basename()`} = ${2:Type}
endsnippet
snippet lambda "Lambda function chain-called on a variable"
$${1:varname}.${2:each} |${3:Type} $${4:param}| {
$0
}
endsnippet
#################################################################
# Puppet Types #
# See http://docs.puppetlabs.com/references/latest/type.html #
@ -197,6 +213,14 @@ snippet hiera_include "Hiera Include Function" b
hiera_include("${1:Lookup}")$0
endsnippet
snippet lookup "Lookup data from hiera"
$${1:varname} = lookup('${2:hiera::key}')$0
endsnippet
snippet trocla "Lookup or generate sensitive information"
trocla('${1:lookup_key}', '${2:plain}', ${3:'length: 32'})$0
endsnippet
snippet include "Include Function" b
include ${1:classname}$0
endsnippet

View File

@ -138,7 +138,7 @@ def format_arg(arg, style):
elif style == NORMAL:
return ":%s: TODO" % arg
elif style == GOOGLE:
return "%s (TODO): TODO" % arg
return "%s (%s): TODO" % (arg, arg.type or "TODO")
elif style == JEDI:
return ":type %s: TODO" % arg
elif style == NUMPY: