mirror of
https://github.com/amix/vimrc
synced 2025-06-17 02:15:01 +08:00
Updated plugins
This commit is contained in:
@ -3,9 +3,9 @@ snippet do
|
||||
${0:${VISUAL}}
|
||||
end
|
||||
snippet put IO.puts
|
||||
IO.puts "${0}"
|
||||
IO.puts("${0}")
|
||||
snippet ins IO.inspect
|
||||
IO.inspect ${0}
|
||||
IO.inspect(${0})
|
||||
snippet insl IO.inspect with label
|
||||
IO.inspect(${0}label: "${1:label}")
|
||||
snippet if if .. do .. end
|
||||
@ -247,7 +247,7 @@ snippet >f pipe to filter
|
||||
snippet >r pipe to reduce
|
||||
|> Enum.reduce(${1:acc}, fn ${2}, ${3:acc} -> ${0} end)
|
||||
snippet >i pipe to inspect
|
||||
|> IO.inspect
|
||||
|> IO.inspect()
|
||||
snippet >il pipe to inspect with label
|
||||
|> IO.inspect(label: "${1:label}")
|
||||
snippet cs
|
||||
@ -265,22 +265,27 @@ snippet genserver basic genserver structure
|
||||
use GenServer
|
||||
|
||||
@doc false
|
||||
def start_link do
|
||||
GenServer.start_link(__MODULE__, ${1:Map.new})
|
||||
def start_link(init_args) do
|
||||
GenServer.start_link(__MODULE__, init_args, name: __MODULE__)
|
||||
end
|
||||
|
||||
@impl true
|
||||
def init(state) do
|
||||
{:ok, state}
|
||||
end
|
||||
snippet genserver: basic genserver structure
|
||||
use GenServer
|
||||
snippet super basic supervisor structure
|
||||
use Supervisor
|
||||
|
||||
@doc false
|
||||
def start_link, do: GenServer.start_link(__MODULE__, ${1:Map.new})
|
||||
def start_link(init_args) do
|
||||
Supervisor.start_link(__MODULE__, init_args, name: __MODULE__)
|
||||
end
|
||||
|
||||
@impl true
|
||||
def init(state), do: {:ok, state}
|
||||
def init(_init_args) do
|
||||
children = [${1}]
|
||||
Supervisor.init(children, strategy: :one_for_one)
|
||||
end
|
||||
snippet impl
|
||||
@impl true
|
||||
def ${1:name} do
|
||||
|
@ -199,18 +199,18 @@ snippet defds
|
||||
snippet am
|
||||
alias_method :${1:new_name}, :${0:old_name}
|
||||
snippet app
|
||||
if __FILE__ == $PROGRAM_NAME
|
||||
if __FILE__ == \$PROGRAM_NAME
|
||||
${0}
|
||||
end
|
||||
# usage_if()
|
||||
snippet usai
|
||||
if ARGV.${1}
|
||||
abort "Usage: #{$PROGRAM_NAME} ${2:ARGS_GO_HERE}"${0}
|
||||
abort "Usage: #{\$PROGRAM_NAME} ${2:ARGS_GO_HERE}"${0}
|
||||
end
|
||||
# usage_unless()
|
||||
snippet usau
|
||||
unless ARGV.${1}
|
||||
abort "Usage: #{$PROGRAM_NAME} ${2:ARGS_GO_HERE}"${0}
|
||||
abort "Usage: #{\$PROGRAM_NAME} ${2:ARGS_GO_HERE}"${0}
|
||||
end
|
||||
snippet array
|
||||
Array.new(${1:10}) { |${2:i}| ${0} }
|
||||
@ -439,7 +439,7 @@ snippet optp
|
||||
options = { ${0:default: 'args'} }
|
||||
|
||||
ARGV.options do |opts|
|
||||
opts.banner = "Usage: #{File.basename($PROGRAM_NAME)}"
|
||||
opts.banner = "Usage: #{File.basename(\$PROGRAM_NAME)}"
|
||||
end
|
||||
snippet opt
|
||||
opts.on('-${1:o}', '--${2:long-option-name}', ${3:String}, '${4:Option description.}') do |${5:opt}|
|
||||
|
Reference in New Issue
Block a user