Accessing the repeat variable to make multiple files/dirs etc. #1180
-
If I press "j" I will move my selection down one step. If I instead press "12j" I will move my selection down 12 steps. I want to utilize this when making files and directories. I have the following in my lfrc:
...
################################################################# Now pressing "i" will make a new file, however pressing "3i" won't make 3 files. Only one file is touched.
UPDATE 1 Working flawlessly so far using the solution provided by @joelim-work! Absolutely love it! I changed my bash function to:
Changed the name from "touch" to "newfile" as to not mix up my own command with the shell command. One of my favorites so far is this one however:
Couldn't be happier with the results! UPDATE 2 The code has been pushed to the repo! Huge thanks to @joelim-work & @gokcehan! Expect this to work out of the box in v29 and onward. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 12 replies
-
When Currently, the command count is not exported, so your command won't work. An alternative approach is to define the
You can type |
Beta Was this translation helpful? Give feedback.
-
This behaviour is currently not supported in In order to achieve this, the code would have to be modified to export the command count as a variable: --- a/eval.go
+++ b/eval.go
@@ -1254,20 +1254,21 @@ func insert(app *app, arg string) {
}
fallthrough
default:
app.ui.menuBuf = nil
app.menuCompActive = false
app.ui.cmdAccLeft = append(app.ui.cmdAccLeft, []rune(arg)...)
}
}
func (e *callExpr) eval(app *app, args []string) {
+ os.Setenv("lf_count", strconv.Itoa(e.count))
switch e.name {
case "up":
if !app.nav.init {
return
}
if app.nav.up(e.count) {
app.ui.loadFile(app, true)
app.ui.loadFileInfo(app.nav)
}
case "half-up": With this change you should be able to use
|
Beta Was this translation helpful? Give feedback.
This behaviour is currently not supported in
lf
, because up until now nobody has ever mentioned such a use case.In order to achieve this, the code would have to be modified to export the command count as a variable: