forked from direnv/direnv
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathshell_vim.go
More file actions
34 lines (26 loc) · 674 Bytes
/
shell_vim.go
File metadata and controls
34 lines (26 loc) · 674 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package main
import (
"os"
"strings"
)
type vim int
var VIM vim
func (x vim) Hook() string {
log_error("this feature is not supported. Install the direnv.vim plugin instead.")
os.Exit(1)
return ""
}
// TODO: support keys with special chars or fail
func (x vim) EscapeKey(str string) string {
return str
}
// TODO: Make sure this escaping is valid
func (x vim) EscapeValue(str string) string {
return "'" + strings.Replace(str, "'", "''", -1) + "'"
}
func (x vim) Export(key, value string) string {
return "let $" + x.EscapeKey(key) + " = " + x.EscapeValue(value) + "\n"
}
func (x vim) Unset(key string) string {
return "unlet $" + x.EscapeKey(key) + "\n"
}