私はいくつかのPHPコードを折りたたむことを試みています、そして私はポストの終わりに折りたたむことを試みているコードのいくつかの縮小版を含めました。
以下のvimコマンドを試しましたが、以下のexコマンドのみが機能します。ex以外のコマンドは機能せず、ステータス行に白地に赤のメッセージが表示されます。折り目が見つかりません。
:help folding
:help fold-commands
:help foldmethod
:set foldmethod=syntax
zi - toggle folding
zj - move to top of next fold
zk - move to bottom of previous fold
za - toggle current fold open and closed
zo - open current fold
zc - close current fold
zA - toggle all current folds at the current cursor position
zO - open all current folds at the current cursor position
zC - close all current folds at the current cursor position
どのように私は、例えばI(折り目を見つけるために、Vimを取得間でコードを折るしたいことができます{
と}
、あるいは間(
と)
。
ここにいくつかのサンプルコードがあります(それが構文的に正しく、したがってvimコマンドが機能することを示すためだけです):
function getTree() {
return array(
"node1" => array(
"node11" => array(
"node111" => "leaf111",
"node112" => "leaf112",
"node113" => "leaf113",
),
"node12" => array(
"node121" => "leaf121",
"node122" => "leaf122",
"node123" => "leaf123",
),
"node13" => array(
"node131" => "leaf131",
"node132" => "leaf132",
"node133" => "leaf133",
),
),
"node2" => array(
"node21" => array(
"node211" => "leaf211",
"node212" => "leaf212",
"node213" => "leaf213",
),
"node22" => array(
"node221" => "leaf221",
"node222" => "leaf222",
"node223" => "leaf223",
),
"node23" => array(
"node231" => "leaf231",
"node232" => "leaf232",
"node233" => "leaf233",
),
),
"node3" => array(
"node31" => array(
"node311" => "leaf311",
"node312" => "leaf312",
"node313" => "leaf313",
),
"node32" => array(
"node321" => "leaf321",
"node322" => "leaf322",
"node323" => "leaf323",
),
"node33" => array(
"node331" => "leaf331",
"node332" => "leaf332",
"node333" => "leaf333",
),
),
);
}