Skip to content

Commit

Permalink
support e (an alias to emacs, using emacsclient)
Browse files Browse the repository at this point in the history
  • Loading branch information
spytheman committed Mar 17, 2022
1 parent 17412ba commit 65cc94f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion veditline.v
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import os

fn main() {
final_editor_cmd := os.args[0][1..]
mut final_editor_cmd := os.args[0][1..]
if os.args.len < 2 {
eprintln('Usage: `v$final_editor_cmd FILE:LINE: ...`')
exit(1)
Expand All @@ -28,6 +28,7 @@ fn main() {
}
else {
match final_editor_cmd {
'e' { res << ['+${parts[1]}', parts[0]] }
'emacs' { res << ['+${parts[1]}', parts[0]] }
'kate' { res << [parts[0], '--line', parts[1]] }
'jed' { res << [parts[0], '-g', parts[1]] }
Expand All @@ -37,5 +38,9 @@ fn main() {
}
}
}
if final_editor_cmd == 'e' {
final_editor_cmd = 'emacsclient'
res.insert(0, ['--socket-name=/run/user/1000/emacs/server', "-a=''", '-nw'])
}
os.execvp(final_editor_cmd, res) ?
}

0 comments on commit 65cc94f

Please sign in to comment.