@@ -4,258 +4,9 @@ import misc/[timer]
44
55embedSource ()
66
7- proc exploreRoot * () {.expose (" explore-root" ).} =
8- # # Open file explorer in the root of the VFS
9- exploreFiles (" " )
10-
11- proc exploreWorkspace * (index: int = 0 ) {.expose (" explore-workspace" ).} =
12- # # Open file explorer in the root of the first (nth) workspace (ws<index>://)
13- exploreFiles (& " ws{ index} :// " )
14-
15- proc exploreUserConfig * () {.expose (" explore-user-config" ).} =
16- # # Open file explorer in the user config directory (home://.nev)
17- exploreFiles (" home://.nev" )
18-
19- proc exploreAppConfig * () {.expose (" explore-app-config" ).} =
20- # # Open file explorer in the app config directory (app://config)
21- exploreFiles (" app://config" )
22-
23- proc exploreWorkspaceConfig * () {.expose (" explore-workspace-config" ).} =
24- # # Open file explorer in the workspace config directory (ws0://.nev)
25- exploreFiles (" ws0://.nev" )
26-
27- proc exploreHelp * () {.expose (" explore-help" ).} =
28- # # Open file explorer in the documentation directory (app://docs)
29- exploreFiles (" app://docs" )
30-
31- proc loadDefaultKeybindings * (clearExisting: bool = false ) {.expose (" load-default-keybindings" ).} =
32- let t = startTimer ()
33- defer :
34- infof " loadDefaultKeybindings: {t.elapsed.ms} ms"
35-
36- info " Applying default keybindings"
37-
38- if clearExisting:
39- clearCommands " editor"
40- clearCommands " editor.model.completion"
41- clearCommands " editor.model.goto"
42- clearCommands " command-line-low"
43- clearCommands " command-line-high"
44- clearCommands " popup.selector"
45-
46- setLeaders @ [" <SPACE>" , " <C-b>" ]
47-
48- addCommand " editor" , " <C-x><C-x>" , " quit"
49-
50- addCommand " editor" , " <LEADER>ot" , " toggle-flag" , " editor.log-frame-time"
51- addCommand " editor" , " <LEADER>ol" , " toggle-flag" , " logging"
52- addCommand " editor" , " <LEADER>os" , " toggle-flag" , " render-selected-value"
53- addCommand " editor" , " <LEADER>or" , " toggle-flag" , " log-render-duration"
54- addCommand " editor" , " <LEADER>od" , " toggle-flag" , " render-debug-info"
55- addCommand " editor" , " <LEADER>oo" , " toggle-flag" , " render-execution-output"
56- addCommand " editor" , " <LEADER>og" , " toggle-flag" , " text.print-scopes"
57- addCommand " editor" , " <LEADER>om" , " toggle-flag" , " text.print-matches"
58- addCommand " editor" , " <LEADER>oh" , " toggle-flag" , " text.show-node-highlight"
59- addCommand " editor" , " <LEADER>ok" , " toggle-flag" , " ui.which-key-no-progress"
60- addCommandBlockDesc " editor" , " <C-5>" , " " :
61- setOption (" text.node-highlight-parent-index" , clamp (getOption [int ](" text.node-highlight-parent-index" ) - 1 , 0 , 100000 ))
62- echo " text.node-highlight-parent-index: " , getOption [int ](" text.node-highlight-parent-index" )
63- addCommandBlockDesc " editor" , " <C-6>" , " " :
64- setOption (" text.node-highlight-parent-index" , clamp (getOption [int ](" text.node-highlight-parent-index" ) + 1 , 0 , 100000 ))
65- echo " text.node-highlight-parent-index: " , getOption [int ](" text.node-highlight-parent-index" )
66- addCommandBlockDesc " editor" , " <C-2>" , " " :
67- setOption (" text.node-highlight-sibling-index" , clamp (getOption [int ](" text.node-highlight-sibling-index" ) - 1 , - 100000 , 100000 ))
68- echo " text.node-highlight-sibling-index: " , getOption [int ](" text.node-highlight-sibling-index" )
69- addCommandBlockDesc " editor" , " <C-3>" , " " :
70- setOption (" text.node-highlight-sibling-index" , clamp (getOption [int ](" text.node-highlight-sibling-index" ) + 1 , - 100000 , 100000 ))
71-
72- # addCommand "editor", "<S-SPACE><*-l>", ""
73- # addCommand "editor", "<LEADER>ff", "log-options"
74- addCommand " editor" , " <ESCAPE>" , " escape"
75-
76- # Window stuff <LEADER>w
77- withKeys " <LEADER>w" , " <C-w>" :
78- addCommand " editor" , " <*-f>-" , " change-font-size" , - 1
79- addCommand " editor" , " <*-f>+" , " change-font-size" , 1
80- addCommand " editor" , " b" , " toggle-status-bar-location"
81- addCommand " editor" , " 1" , " set-layout" , " horizontal"
82- addCommand " editor" , " 2" , " set-layout" , " vertical"
83- addCommand " editor" , " 3" , " set-layout" , " fibonacci"
84- addCommand " editor" , " x" , " close-current-view" , keepHidden= true
85- addCommand " editor" , " h" , " focus-view-left"
86- addCommand " editor" , " j" , " focus-view-down"
87- addCommand " editor" , " k" , " focus-view-up"
88- addCommand " editor" , " l" , " focus-view-right"
89- addCommand " editor" , " T" , " move-view" , " #new-tab"
90- addCommand " editor" , " z" , " open-prev-view"
91- addCommand " editor" , " y" , " open-next-view"
92- addCommand " editor" , " s" , " wrap-layout" , " vertical-temp"
93- addCommand " editor" , " v" , " wrap-layout" , " horizontal-temp"
94-
95- addCommand " editor" , " <C-s>" , " write-file"
96- addCommand " editor" , " <CS-r>" , " load-file"
97- addCommand " editor" , " <CS-s>" , " save-app-state"
98- addCommand " editor" , " <LEADER><LEADER>" , " command-line"
99- addCommand " editor" , " <LEADER>gt" , " choose-theme"
100- addCommand " editor" , " <LEADER>gf" , " choose-file"
101- addCommand " editor" , " <LEADER>go" , " choose-open"
102- addCommand " editor" , " <LEADER>gd" , " choose-open-document"
103- addCommand " editor" , " <LEADER>gl" , " choose-location"
104- addCommand " editor" , " <LEADER>gg" , " choose-git-active-files" , false
105- addCommand " editor" , " <LEADER>GG" , " choose-git-active-files" , true
106-
107- addCommand " editor" , " <LEADER>ge" , " explore-root"
108- addCommand " editor" , " <LEADER>gv" , " explore-files" , " " , showVFS= true
109- addCommand " editor" , " <LEADER>gw" , " explore-workspace"
110- addCommand " editor" , " <LEADER>gW" , " explore-files" , " ws0://" .normalizePath
111- addCommand " editor" , " <LEADER>gu" , " explore-user-config"
112- addCommand " editor" , " <LEADER>ga" , " explore-app-config"
113- addCommand " editor" , " <LEADER>gh" , " explore-help"
114-
115- addCommand " editor" , " <LEADER>gp" , " explore-current-file-directory"
116- addCommand " editor" , " <LEADER>gs" , " search-global-interactive"
117- addCommand " editor" , " <LEADER>gk" , " browse-keybinds"
118- addCommand " editor" , " <LEADER>gi" , " browse-settings"
119- addCommand " editor" , " <LEADER>gn" , " open-last-view"
120- addCommandBlockDesc " editor" , " <LEADER>log" , " Show log file" :
121- logs (slot = " #default" , focus = false , scrollToBottom = true )
122-
123- addCommand " editor" , " <LEADER>fl" , " load-file"
124- addCommand " editor" , " <LEADER>fs" , " write-file"
125-
126- addCommand " command-line-low" , " <ESCAPE>" , " exit-command-line"
127- addCommand " command-line-low" , " <ENTER>" , " execute-command-line"
128- addCommand " command-line-low" , " <UP>" , " select-previous-command-in-history"
129- addCommand " command-line-low" , " <DOWN>" , " select-next-command-in-history"
130- addCommand " command-line-results-low" , " <ESCAPE>" , " exit-command-line"
131-
132- addCommand " popup.selector" , " <ENTER>" , " accept"
133- addCommand " popup.selector" , " <C-y>" , " accept"
134- addCommand " popup.selector" , " <TAB>" , " accept"
135- addCommand " popup.selector" , " <ESCAPE>" , " cancel"
136- addCommand " popup.selector" , " <UP>" , " prev"
137- addCommand " popup.selector" , " <C-p>" , " prev"
138- addCommand " popup.selector" , " <DOWN>" , " next"
139- addCommand " popup.selector" , " <C-n>" , " next"
140- addCommand " popup.selector" , " <C-u>" , " prev" , 5
141- addCommand " popup.selector" , " <C-d>" , " next" , 5
142- addCommand " popup.selector" , " <C-b>" , " toggle-preview"
143- addCommand " popup.selector" , " <TAB>" , " toggle-focus-preview"
144- addCommand " popup.selector" , " <C-k>s" , " sort" , " Toggle"
145- addCommand " popup.selector" , " <C-k>n" , " normalize-scores" , " Toggle"
146- addCommand " popup.selector" , " <C-k>f" , " set-min-score" , 0.0
147- addCommand " popup.selector" , " <C-k>F" , " set-min-score" , - 1.0
148- addCommand " popup.selector" , " <C-k>+" , " set-min-score" , 0.2 , add = true
149- addCommand " popup.selector" , " <C-k>-" , " set-min-score" , - 0.2 , add = true
150- addCommand " popup.selector.preview" , " <TAB>" , " toggle-focus-preview"
151- addCommandBlockDesc " popup.selector" , " <C-l>" , " Save location list" :
152- setLocationListFromCurrentPopup ()
153-
154- addCommand " editor" , " <C-n>" , " goto-prev-location"
155- addCommand " editor" , " <C-t>" , " goto-next-location"
156-
157- addCommand " popup.selector.open" , " <C-x>" , " close-selected"
158-
159- addCommand " popup.selector.git" , " <C-a>" , " stage-selected"
160- addCommand " popup.selector.git" , " <C-u>" , " unstage-selected"
161- addCommand " popup.selector.git" , " <C-q>a" , " revert-selected"
162-
163- addCommand " popup.selector.git" , " <C-h>" , " prev-change"
164- addCommand " popup.selector.git" , " <C-f>" , " next-change"
165- addCommand " popup.selector.git" , " <C-s>" , " stage-change"
166- addCommand " popup.selector.git" , " <C-q>h" , " revert-change"
167- addCommandDescription " popup.selector" , " <C-k>" , " Scoring"
168- addCommandDescription " popup.selector.git" , " <C-q>" , " Revert"
169-
170- addCommand " popup.selector.file-explorer" , " <C-UP>" , " go-up"
171- addCommand " popup.selector.file-explorer" , " <C-r>" , " go-up"
172- addCommand " popup.selector.file-explorer" , " <CS-y>" , " enter-normalized"
173- addCommand " popup.selector.file-explorer" , " <C-a>" , " add-workspace-folder"
174- addCommand " popup.selector.file-explorer" , " <C-x>" , " remove-workspace-folder"
175- addCommand " popup.selector.file-explorer" , " <C-f>" , " create-file"
176- addCommand " popup.selector.file-explorer" , " <C-g>f" , " create-file"
177- addCommand " popup.selector.file-explorer" , " <C-g>d" , " create-directory"
178- addCommand " popup.selector.file-explorer" , " <C-g>x" , " delete-file-or-dir"
179- addCommand " popup.selector.file-explorer" , " <C-u>" , " refresh"
180- addCommandDescription " popup.selector.file-explorer" , " <C-g>" , " File operations"
181-
182- addCommand " popup.selector.settings" , " <C-t>" , " toggle-flag"
183- addCommand " popup.selector.settings" , " <C-s>" , " update-setting"
184-
185- addCommandBlockDesc " editor" , " <LEADER>al" , " Run last configuration" :
186- runLastConfiguration ()
187- showDebuggerView ()
188-
189- addCommandBlockDesc " editor" , " <LEADER>av" , " Choose run configuration" :
190- chooseRunConfiguration ()
191- showDebuggerView ()
192-
193- addCommandBlockDesc " editor" , " <LEADER>ab" , " Toggle breakpoint" :
194- if getActiveEditor ().isTextEditor editor:
195- addBreakpoint (editor.id, editor.selection.last.line)
196-
197- addCommand " editor" , " <LEADER>ac" , " continue-execution"
198- addCommand " editor" , " <LEADER>ar" , " step-over"
199- addCommand " editor" , " <LEADER>at" , " step-in"
200- addCommand " editor" , " <LEADER>an" , " step-out"
201- addCommand " editor" , " <LEADER>ae" , " edit-breakpoints"
202- addCommand " editor" , " <LEADER>am" , " toggle-breakpoints-enabled"
203-
204- addCommand " popup.selector.breakpoints" , " <C-x>" , " delete-breakpoint"
205- addCommand " popup.selector.breakpoints" , " <C-e>" , " toggle-breakpoint-enabled"
206- addCommand " popup.selector.breakpoints" , " <C-o>" , " toggle-all-breakpoints-enabled"
207-
208- addCommand " editor" , " <LEADER>gb" , " show-debugger-view"
209-
210- addCommand " debugger" , " <C-k>" , " prev-debugger-view"
211- addCommand " debugger" , " <C-h>" , " next-debugger-view"
212-
213- addCommand " debugger.variables" , " <UP>" , " prev-variable"
214- addCommand " debugger.variables" , " <C-p>" , " prev-variable"
215- addCommand " debugger.variables" , " <DOWN>" , " next-variable"
216- addCommand " debugger.variables" , " <C-n>" , " next-variable"
217- addCommand " debugger.variables" , " <RIGHT>" , " expand-variable"
218- addCommand " debugger.variables" , " <C-y>" , " expand-variable"
219- addCommand " debugger.variables" , " <LEFT>" , " collapse-variable"
220- addCommand " debugger.variables" , " <HOME>" , " select-first-variable"
221- addCommand " debugger.variables" , " <END>" , " select-last-variable"
222-
223- addCommand " debugger.threads" , " <UP>" , " prev-thread"
224- addCommand " debugger.threads" , " <C-p>" , " prev-thread"
225- addCommand " debugger.threads" , " <DOWN>" , " next-thread"
226- addCommand " debugger.threads" , " <C-n>" , " next-thread"
227- addCommand " debugger.threads" , " <C-y>" , " set-debugger-view" , " StackTrace"
228-
229- addCommand " debugger.stacktrace" , " <UP>" , " prev-stack-frame"
230- addCommand " debugger.stacktrace" , " <C-p>" , " prev-stack-frame"
231- addCommand " debugger.stacktrace" , " <DOWN>" , " next-stack-frame"
232- addCommand " debugger.stacktrace" , " <C-n>" , " next-stack-frame"
233- addCommand " debugger.stacktrace" , " <ENTER>" , " open-file-for-current-frame"
234- addCommand " debugger.stacktrace" , " <C-y>" , " open-file-for-current-frame"
235-
236- addCommandBlock " debugger" , " <C-u>" :
237- for i in 0 .. 10 :
238- prevVariable ()
239-
240- addCommandBlock " debugger" , " <C-d>" :
241- for i in 0 .. 10 :
242- nextVariable ()
243-
244- addCommandDescription " editor" , " <LEADER>g" , " Global pickers"
245- addCommandDescription " editor.text" , " <LEADER>g" , " Document pickers"
246- addCommandDescription " editor" , " <LEADER>a" , " Debugger"
247- addCommandDescription " editor" , " <LEADER>a" , " Debugger"
248- addCommandDescription " editor" , " <LEADER>o" , " Options"
249- addCommandDescription " editor" , " <LEADER>ff" , " Rendering"
250- addCommandDescription " editor" , " <LEADER>w" , " Window"
251- addCommandDescription " editor" , " <LEADER>wf" , " Change font size"
252- addCommandDescription " editor" , " <LEADER>wk" , " Split size ratio"
253- addCommandDescription " editor" , " <LEADER>r" , " Run"
254- addCommandDescription " editor" , " <LEADER>f" , " File"
255- addCommandDescription " editor" , " <LEADER>m" , " Toggle fullscreen"
256-
257- # addCommand "editor.text", "<C-SPACE>ts", "reload-treesitter"
258-
7+ # todo : move these to keybindings.json at some point
8+ # proc loadDefaultKeybindings*(clearExisting: bool = false) {.expose("load-default-keybindings").} =
9+ # discard
25910 # setHandleInputs("editor.model", true)
26011 # addCommand("editor.model", "<LEFT>", "move-cursor-left-line")
26112 # addCommand("editor.model", "<RIGHT>", "move-cursor-right-line")
@@ -309,9 +60,3 @@ proc loadDefaultKeybindings*(clearExisting: bool = false) {.expose("load-default
30960 # addCommand("editor.model.completion", "<TAB>", "apply-selected-completion")
31061
31162 # addCommand "editor.model.goto", "<END>", "end"
312-
313- proc exampleScriptAction * (a: int , b: string ): string {.expose (" example-script-action" ).} =
314- # # Test documentation stuff
315- infof " exampleScriptAction called with {a}, {b}"
316- return b & $ a
317-
0 commit comments