-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.tsx
130 lines (98 loc) · 4.13 KB
/
config.tsx
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
import * as React from "C:\\Program Files (x86)\\Oni\\resources\\app\\node_modules\\react"
import * as Oni from "C:\\Program Files (x86)\\Oni\\resources\\app\\node_modules\\oni-api"
export const activate = (oni: Oni.Plugin.Api) => {
console.log("Config activated.")
// General helpers
const currentFile = oni.editors.activeEditor.activeBuffer.filePath
const currentExtension = oni.editors.activeEditor.activeBuffer.language
// Add a bookmarks menu to swap easily between different workspaces.
const makeBookmarksMenu = () => {
const bookmarkMenu = oni.menu.create()
const bookmarks = oni.configuration.getValue("oni.bookmarks") as any[]
const menuItems = bookmarks.map((s) => ({icon: "bookmark",
detail: s,
label: s.split("\\").pop()}))
bookmarkMenu.show()
bookmarkMenu.setItems(menuItems)
bookmarkMenu.onItemSelected.subscribe(menuItem => {
if (menuItem) {
oni.workspace.changeDirectory(menuItem.detail)
}
})
}
// Setup a terminal selection menu.
// Needs to have a vim-script setup function called to save references to each
// terminal.
const terminals = oni.configuration.getValue("oni.terminals") as any[]
oni.editors.activeEditor.neovim.command(`call Term_toggle_setup(${terminals.length})`)
const makeTermMenu = () => {
const termMenu = oni.menu.create()
let termId = 0
const menuItems = terminals.map((t) => ({
icon: "terminal",
detail: t.command,
label: t.name,
metadata: {id: termId++}
})) as any
termMenu.show()
termMenu.setItems(menuItems)
termMenu.onItemSelected.subscribe(menuItem => {
if (menuItem) {
oni.editors.activeEditor.neovim.command(`call Term_open(${menuItem.metadata.id},"${menuItem.detail}")`)
}
})
}
// Take a screenshot on Control+Enter is pressed
oni.input.bind("<c-enter>", () => oni.recorder.takeScreenshot())
// Set zoom factor to 1.5 when Control+= is pressed
oni.input.bind("<c-=>", () => require("electron").remote.getCurrentWindow().webContents.setZoomFactor(1.25))
// Set zoom factor to 1 when Control+- is pressed
oni.input.bind("<c-->", () => require("electron").remote.getCurrentWindow().webContents.setZoomFactor(1))
oni.input.bind("<s-c-w>", makeBookmarksMenu)
oni.input.bind("<s-c-n>", makeTermMenu)
}
export const deactivate = (oni: Oni.Plugin.Api) => {
console.log("Config deactivated.")
}
export const configuration = {
activate,
deactivate,
"oni.useDefaultConfig": false,
"oni.loadInitVim": true,
"ui.colorscheme": "onedark",
"editor.fontFamily": "Fira Code Retina",
"editor.quickOpen.filterStrategy": "regex",
"experimental.welcome.enabled": false,
"experimental.markdownPreview.enabled": true,
"experimental.browser.enabled": true,
"experimental.editor.textMateHighlighting.enabled": true,
"debug.showTypingPrediction": true,
"sidebar.marks.enabled": true,
"sidebar.plugins.enabled": true,
"vim.setting.autoread": true,
"autoClosingPairs.enabled": true,
"autoClosingPairs.default": [
{ "open": "{", "close": "}" },
{ "open": "[", "close": "]" },
{ "open": "(", "close": ")" },
{ "open": "<", "close": ">" },
{ "open": "'", "close": "'" },
{ "open": "`", "close": "`" },
{ "open": '"', "close": '"' },
],
"oni.bookmarks": [
"C:\\Users\\Ryan\\Documents\\Git\\uni_work",
"C:\\Users\\Ryan\\Documents\\Git\\meng_project",
"C:\\Users\\Ryan\\Documents\\Git\\oni",
"C:\\Users\\Ryan\\Documents\\Git\\dotfiles"
]
"oni.terminals": [
{"name": "CMD", "command": "cmd"},
{"name": "PowerShell", "command": "powershell"},
{"name": "Bash", "command": "bash"},
{"name": "Anaconda", "command":
"cmd /K " +
"F:/ProgramData/Anaconda/Scripts/activate.bat " +
"F:/ProgramData/Anaconda"},
],
}