Skip to content

Instantly share code, notes, and snippets.

@sakai-memoru
Last active November 16, 2019 21:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sakai-memoru/904944d49a8ad8c7b373d342d4a4a5c8 to your computer and use it in GitHub Desktop.
Save sakai-memoru/904944d49a8ad8c7b373d342d4a4a5c8 to your computer and use it in GitHub Desktop.

Sakura Macro : open_vim.jse

  • Sakura Editorで編集中のファイルを保存して、gvim.exeで開く。
(function(){
//
// vim で編集ファイルを開く
function doProcess(expandParam){
var target_ = Editor.ExpandParameter(expandParam);
var cmd_statement = "gvim.exe " + target_
Editor.ExecCommand(cmd_statement, 0)
}
// -------------- entry point
if(typeof(Editor) !== 'undefined'){
// $F : opened file's full path
// $f : opened file's name
// $e : opened file's folder path
// $b : opened file's extention
// $C : 選択中の場合、選択テキストの1行目のテキスト(改行コード除く)
// 選択中でない場合、カーソル位置の単語
doProcess('$F');
} else {
if(typeof(WScript) !== 'undefined'){
WScript.Echo('[Warn] This script is for sakura macro. A env is maybe wsh.')
} else {
console.log('[Warn] This script is for sakura macro. A env is maybe node.')
}
}
}())

reference

ExpandPrameter Description
画面上の選択、設定情報
$C 現在選択中のなかで改行コードを除く1行目のテキス。 選択範囲がない場合は現在のカーソル位置の単語を取得します。
$h Grep検索キーの先頭32byte
$x 現在の論理桁位置(先頭からのバイト数1開始)
$y 現在の論理行位置(1開始)
編集中のファイル情報
$F 開いているファイルのフルパス。名前がなければ(無題)。
$n 無題の通し番号
$f 開いているファイルの名前(ファイル名+拡張子のみ) 例:Main.cpp
$g 開いているファイルの名前(拡張子除く) 例:Main
$/ 開いているファイルのフルパス(パスの区切りが/) 例:D:/source/Main.cpp
$N 開いているファイルの名前(簡易表示) 例:ソース\Main.cpp(設定によります)
$E 開いているファイルのあるフォルダの名前(簡易表示)
$e 開いているファイルのあるフォルダの名前
$B タイプ別設定の名前
$b 開いているファイルの拡張子
システム情報
$d 現在の日付(共通設定の日付書式)
$t 現在の時刻(共通設定の時刻書式)
印刷時の情報
$Q 印刷ページ設定の名前
$p 現在のページ(印刷のヘッダ・フッダでのみ利用可能)
$P 総ページ(印刷のヘッダ・フッダでのみ利用可能)
$D ファイルのタイムスタンプ(共通設定の日付書式)
$T ファイルのタイムスタンプ(共通設定の時刻書式)
サクラエディタの情報
$A アプリ名(sakura)
$S サクラエディタのフルパス名 例:C:\Program files\sakura\sakura.exe
$V エディタのバージョン文字列
$I 現在参照しているiniファイルのパス
$M 現在実行中のマクロのフルパス名
$ プロファイル名(defaultの場合空文字列)
その他
$$ $文字自身
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment