A metatable can be defined like
local t = setmetatable({}, {
__tostring = function() return 'custom tostring behavior!' end
})
Here are the metamethods that you can define, and their behavior
// [VSCode Macros] extension | |
// https://marketplace.visualstudio.com/items?itemName=EXCEEDSYSTEM.vscode-macros | |
// License:MIT | |
const vscode = require('vscode'); | |
// Create an output window for this macro | |
if (global.phee7Bie === undefined) { | |
// Store the output channel in the global variable for nodeJS | |
// ※The variable name 'phee7Bie' just means a unique global variable of this macro in the node JS | |
global.phee7Bie = { |
struct SomeStruct; | |
impl SomeStruct { | |
fn new(ctor: MixedInts) { | |
match ctor { | |
_ => println!("Match arms can construct the type in different ways"), | |
} | |
} | |
} |
I've been using this for several years now, so here are some of the ways I have set it up to be most productive.
See my taskrc
below for implementation details.
In general, I've had the most success by keeping lists of tasks short and to the point, avoiding the anxiety of seeing 100 tasks and feeling like I'm going to drown.
###################################################################### | |
# SCRIPT: Test-CodeQuality.ps1 # | |
###################################################################### | |
# Purpose # | |
# Script to check formatting and best practice before committing # | |
###################################################################### | |
# Author : Nicolas # | |
###################################################################### | |
# ChangeLog # | |
# 20201026 - Initial Release # |
Set-PSReadLineKeyHandler -Chord "c,i" -ViMode Command -ScriptBlock { VIChangeInnerBlock } | |
Set-PSReadLineKeyHandler -Chord "c,a" -ViMode Command -ScriptBlock { VIChangeOuterBlock } | |
Set-PSReadLineKeyHandler -Chord "d,i" -ViMode Command -ScriptBlock { VIDeleteInnerBlock } | |
Set-PSReadLineKeyHandler -Chord "d,a" -ViMode Command -ScriptBlock { VIDeleteOuterBlock } | |
Set-PSReadLineKeyHandler -Chord "c,s" -ViMode Command -ScriptBlock { VIChangeSurround } | |
Set-PSReadLineKeyHandler -Chord "d,s" -ViMode Command -ScriptBlock { VIDeleteSurround } | |
Set-PSReadLineKeyHandler -Chord "Ctrl+a" -ViMode Command ` | |
-ScriptBlock { VIIncrement $args[0] $args[1] } | |
Set-PSReadLineKeyHandler -Chord "Ctrl+x" -ViMode Command ` | |
-ScriptBlock { VIDecrement $args[0] $args[1] } |
# I really like the way this is laid out | |
# https://github.com/aldrichtr/poco/blob/master/src/ps1/poco.psd1 | |
@{ | |
## Module Info | |
ModuleVersion = '1.2.0' | |
Description = "Interactive filtering command based on peco" | |
GUID = 'fcdcab47-0505-4ba8-b845-538effc1d88e' | |
# HelpInfoURI = '' | |
## Module Components |
local M = { | |
"neoclide/coc.nvim", | |
branch = "master", | |
build = "yarn install --frozen-lockfile", | |
} | |
M.config = function() | |
-- Some servers have issues with backup files, see #649 | |
vim.opt.backup = false | |
vim.opt.writebackup = false |
// vscode-keybindings for navigation with I/J/K/L and additional functionality with surrounding characters | |
// Place your key bindings in this file to overwrite the defaults | |
// ALT + I/J/K/L: up/left/down/right | |
// ALT + SHIFT + I/J/K/L: mark text up/left/down/right | |
// CTRL + J/L: send cursor to start/end of line | |
// CTRL + ALT + J/L: send cursor to start/end of word | |
// CTRL + ALT + U/O: send cursor to "wordPartLeft"/"wordPartRight" | |
// CTRL + ALT + SHIFT + U/O: mark from cursor to "wordPartLeft"/"wordPartRight" | |
// CTRL + ALT + Y: got to declaration |
# See https://github.com/gui-cs/F7Hisoty which replaces this |