1
0
mirror of https://github.com/amix/vimrc synced 2025-07-12 22:24:59 +08:00

Merge branch 'Linux' of https://github.com/Geezus42/vimrc into Linux

This commit is contained in:
geezus
2021-06-30 13:19:18 -05:00
235 changed files with 6246 additions and 1351 deletions

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

@ -32,3 +32,12 @@ endsnippet
snippet fld "type field documentation" b
#' @field ${1:name}::${2:Type} ${0:Description}
endsnippet
# Debugging
snippet deb "Debugger breakpoint" b
Main.@bp
endsnippet
snippet inf "Infiltrator breakpoint" b
Main.@infiltrate
endsnippet

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

@ -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:

View File

@ -1 +1,59 @@
extends cpp
snippet kern "Kernel definition"
__global__ void ${1:kernel}(${2:void}) {
${0:// TODO: Implement}
}
snippet dev "Device function definition"
__device__ ${1:int} ${2:foo}(${3:void}) {
${0:// TODO: Implement}
return 0;
}
snippet call "Kernel call"
${1:kernel}<<<${2:args}>>>(${3});${0}
snippet sync "Synchonize threads"
__syncthreads();
snippet tid "Thread Index"
threadIdx.${0}
snippet bid "Block Index"
blockIdx.${0}
snippet bdim "Block Dimension"
blockDim.${0}
snippet ii "Get current index (1D)"
int ${1:index} = threadIdx.${2:x} + blockIdx.$2 * blockDim.$2;
snippet ix "Get current X index (1D)"
int ${1:x} = threadIdx.x + blockIdx.x * blockDim.x;
snippet iy "Get current Y index (1D)"
int ${1:y} = threadIdx.y + blockIdx.y * blockDim.y;
snippet iz "Get current Z index (1D)"
int ${1:z} = threadIdx.z + blockIdx.z * blockDim.z;
snippet ixy "Get current X,Y index (2D)"
int ${1:x} = threadIdx.x + blockIdx.x * blockDim.x;
int ${2:y} = threadIdx.y + blockIdx.y * blockDim.y;
snippet ixz "Get current X,Z index (2D)"
int ${1:x} = threadIdx.x + blockIdx.x * blockDim.x;
int ${3:z} = threadIdx.z + blockIdx.z * blockDim.z;
snippet iyz "Get current Y,Z index (2D)"
int ${2:y} = threadIdx.y + blockIdx.y * blockDim.y;
int ${3:z} = threadIdx.z + blockIdx.z * blockDim.z;
snippet ixyz "Get current X,Y,Z index (3D)"
int ${1:x} = threadIdx.x + blockIdx.x * blockDim.x;
int ${2:y} = threadIdx.y + blockIdx.y * blockDim.y;
int ${3:z} = threadIdx.z + blockIdx.z * blockDim.z;
snippet share "Shared memory declaration"
__shared__ ${1:int} ${2:memo}[${3:SIZE}];${0}

View File

@ -0,0 +1,80 @@
snippet doc
/// ${0}
snippet comment
// ${0}
snippet let
let ${1} = ${0}
snippet lit
[<Literal>]
let ${1} = ${0}
snippet rec
type ${1} = { ${0} }
snippet arec
{| ${0} |}
snippet fn
let ${1} =
${0}
snippet fnr
let rec ${1} =
${0}
snippet lam
(fun ${1} -> ${0})
snippet mod
module ${1} =
${0}
snippet for
for ${1} in ${2} do
${0}
snippet if
if ${1} then
${2}
snippet ife
if ${1} then
${2}
else
${0}
snippet ifee
if ${1} then
${2}
elif ${3} then
${4}
else
${0}
snippet eif
elif ${1} then
${0}
snippet el
else
${0}
snippet try
try
${1}
with ${0}
snippet match
match ${1} with
| ${2} -> ${0}
snippet |
| ${1} -> ${0}
snippet p
|> ${0}
snippet pr
printfn "${1}" ${0}
snippet pri
printfn \$"${0}"
snippet amap
|> Array.map (fun ${1} -> ${0})
snippet lmap
|> List.map (fun ${1} -> ${0})
snippet smap
|> Seq.map (fun ${1} -> ${0})
snippet atap
|> Array.map (fun x -> printfn "%A" x; x) // tap
snippet ltap
|> List.map (fun x -> printfn "%A" x; x) // tap
snippet stap
|> Seq.map (fun x -> printfn "%A" x; x) // tap
snippet main
[<EntryPoint>]
let main argv =
${0}
0

View File

@ -449,7 +449,7 @@ snippet html5
</html>
snippet html5l
<!DOCTYPE html>
<html lang="${1:es}">
<html lang="${1:en}">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">

View File

@ -99,11 +99,11 @@ snippet terr
snippet ret
return ${0:result};
snippet for "for (...) {...}"
for (var ${1:i} = 0, ${2:len} = ${3:Things.length}; $1 < $2; $1++) {
for (let ${1:i} = 0, ${2:len} = ${3:Things.length}; $1 < $2; $1++) {
${0:${VISUAL}}
}
snippet forr "reversed for (...) {...}"
for (var ${2:i} = ${1:Things.length} - 1; $2 >= 0; $2--) {
for (let ${2:i} = ${1:Things.length} - 1; $2 >= 0; $2--) {
${0:${VISUAL}}
}
snippet wh "(condition) { ... }"
@ -116,7 +116,7 @@ snippet do "do { ... } while (condition)"
} while (${1:/* condition */});
# For in loop
snippet fori
for (var ${1:prop} in ${2:object}) {
for (let ${1:prop} in ${2:object}) {
${0:$2[$1]}
}
# Objects

View File

@ -241,7 +241,7 @@ snippet addsp
snippet addarg
parser.add_argument("${0:short_arg}", "${1:long_arg}", default=${2:None}, help="${3:Help text}")
snippet addnarg
parser.add_argument("${0:arg}", nargs="${1:*}", default"${2:None}, help="${3:Help text}")
parser.add_argument("${0:arg}", nargs="${1:*}", default=${2:None}, help="${3:Help text}")
snippet addaarg
parser.add_argument("${0:arg}", "${1:long_arg}", action="${2:store_true}", default=${3:False}, help="${4:Help text}")
snippet pargs

View File

@ -101,7 +101,7 @@ snippet crate "Define create meta attributes"
// Crate name
#![crate_name = "${1:crate_name}"]
// Additional metadata attributes
#![desc = "${2:Descrption.}"]
#![desc = "${2:Description.}"]
#![license = "${3:BSD}"]
#![comment = "${4:Comment.}"]
// Specify the output type

View File

@ -58,7 +58,7 @@ snippet al
end
# Module block
snippet mod
module ${1:module_name} (${2});
module ${1:`vim_snippets#Filename('$1', 'name')`} (${2});
${0}
endmodule
# For
@ -81,3 +81,19 @@ snippet task
task ${1:name}(${2});
${0}
endtask: $1
# Initial
snippet ini
initial begin
${0}
end
# typedef struct packed
snippet tdsp
typedef struct packed {
int ${2:data};
} ${1:`vim_snippets#Filename('$1_t', 'name')`};
# typedef eum
snippet tde
typedef enum ${2:logic[15:0]}
{
${3:REG = 16'h0000}
} ${1:my_dest_t};

View File

@ -43,8 +43,17 @@ snippet ife if ... else statement
endif
snippet au augroup ... autocmd block
augroup ${1:AU_NAME}
autocmd!
autocmd ${2:BufRead,BufNewFile} ${3:*.ext,*.ext3|<buffer[=N]>} ${0}
augroup END
<<<<<<< HEAD
=======
snippet auv augroupvisual ... autocmd block with visual placeholder
augroup ${1:AU_NAME}
autocmd!
${0:${VISUAL}}
augroup END
>>>>>>> 1cca3b1df2973096bb9526a0d79c7b93c04e66b3
snippet bun Vundle.vim Plugin definition
Plugin '${0}'
snippet plug vim-plug Plugin definition

View File

@ -118,7 +118,7 @@ snippet vfilter
snippet vfor
<div v-for="${1:item} in ${2:items}" :key="$1.id">
{{ $1 }}
</div
</div>
snippet vgetters
getters: {