Saya mencoba melipat beberapa kode PHP, dan saya telah memasukkan versi cut-down beberapa kode yang saya coba lipat pada akhir posting.
Saya sudah mencoba perintah vim berikut, tetapi hanya perintah ex di bawah ini yang berfungsi. Perintah non-ex tidak berfungsi dan menghasilkan pesan putih-merah di baris status yang mengatakan: Saya tidak dapat menemukan lipatan.
: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
Bagaimana saya bisa mendapatkan vim untuk menemukan lipatan (misalnya saya ingin melipat kode antara {
dan }
, atau antara (
dan )
.
Berikut ini beberapa contoh kode (hanya untuk menunjukkan bahwa kode itu benar secara sintaksis dan karenanya perintah vim harus berfungsi):
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",
),
),
);
}