Skip to content

Commit bbeec8b

Browse files
committed
some updates for Mac 😢
1 parent 9518a0c commit bbeec8b

8 files changed

Lines changed: 340 additions & 38 deletions

File tree

xdg_config/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
iterm2/
2+
karabiner/automatic_backups/
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{
2+
"title": "Change caps_lock to Esc and Control",
3+
"rules": [
4+
{
5+
"description": "Post Esc if Caps is tapped, Control if held.",
6+
"manipulators": [
7+
{
8+
"type": "basic",
9+
"from": {
10+
"key_code": "left_control",
11+
"modifiers": {
12+
"optional": [
13+
"any"
14+
]
15+
}
16+
},
17+
"to": [
18+
{
19+
"key_code": "left_control",
20+
"lazy": true
21+
}
22+
],
23+
"to_if_alone": [
24+
{
25+
"key_code": "escape"
26+
}
27+
]
28+
}
29+
]
30+
}
31+
]
32+
}
Lines changed: 194 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,194 @@
1+
{
2+
"global": {
3+
"check_for_updates_on_startup": true,
4+
"show_in_menu_bar": true,
5+
"show_profile_name_in_menu_bar": false
6+
},
7+
"profiles": [
8+
{
9+
"complex_modifications": {
10+
"parameters": {
11+
"basic.simultaneous_threshold_milliseconds": 50,
12+
"basic.to_delayed_action_delay_milliseconds": 500,
13+
"basic.to_if_alone_timeout_milliseconds": 500,
14+
"basic.to_if_held_down_threshold_milliseconds": 500,
15+
"mouse_motion_to_scroll.speed": 100
16+
},
17+
"rules": [
18+
{
19+
"description": "Post Esc if Caps is tapped, Control if held.",
20+
"manipulators": [
21+
{
22+
"from": {
23+
"key_code": "left_control",
24+
"modifiers": {
25+
"optional": [
26+
"any"
27+
]
28+
}
29+
},
30+
"to": [
31+
{
32+
"key_code": "left_control",
33+
"lazy": true
34+
}
35+
],
36+
"to_if_alone": [
37+
{
38+
"key_code": "escape"
39+
}
40+
],
41+
"type": "basic"
42+
}
43+
]
44+
}
45+
]
46+
},
47+
"devices": [],
48+
"fn_function_keys": [
49+
{
50+
"from": {
51+
"key_code": "f1"
52+
},
53+
"to": [
54+
{
55+
"consumer_key_code": "display_brightness_decrement"
56+
}
57+
]
58+
},
59+
{
60+
"from": {
61+
"key_code": "f2"
62+
},
63+
"to": [
64+
{
65+
"consumer_key_code": "display_brightness_increment"
66+
}
67+
]
68+
},
69+
{
70+
"from": {
71+
"key_code": "f3"
72+
},
73+
"to": [
74+
{
75+
"apple_vendor_keyboard_key_code": "mission_control"
76+
}
77+
]
78+
},
79+
{
80+
"from": {
81+
"key_code": "f4"
82+
},
83+
"to": [
84+
{
85+
"apple_vendor_keyboard_key_code": "spotlight"
86+
}
87+
]
88+
},
89+
{
90+
"from": {
91+
"key_code": "f5"
92+
},
93+
"to": [
94+
{
95+
"consumer_key_code": "dictation"
96+
}
97+
]
98+
},
99+
{
100+
"from": {
101+
"key_code": "f6"
102+
},
103+
"to": [
104+
{
105+
"key_code": "f6"
106+
}
107+
]
108+
},
109+
{
110+
"from": {
111+
"key_code": "f7"
112+
},
113+
"to": [
114+
{
115+
"consumer_key_code": "rewind"
116+
}
117+
]
118+
},
119+
{
120+
"from": {
121+
"key_code": "f8"
122+
},
123+
"to": [
124+
{
125+
"consumer_key_code": "play_or_pause"
126+
}
127+
]
128+
},
129+
{
130+
"from": {
131+
"key_code": "f9"
132+
},
133+
"to": [
134+
{
135+
"consumer_key_code": "fast_forward"
136+
}
137+
]
138+
},
139+
{
140+
"from": {
141+
"key_code": "f10"
142+
},
143+
"to": [
144+
{
145+
"consumer_key_code": "mute"
146+
}
147+
]
148+
},
149+
{
150+
"from": {
151+
"key_code": "f11"
152+
},
153+
"to": [
154+
{
155+
"consumer_key_code": "volume_decrement"
156+
}
157+
]
158+
},
159+
{
160+
"from": {
161+
"key_code": "f12"
162+
},
163+
"to": [
164+
{
165+
"consumer_key_code": "volume_increment"
166+
}
167+
]
168+
}
169+
],
170+
"name": "Default profile",
171+
"parameters": {
172+
"delay_milliseconds_before_open_device": 1000
173+
},
174+
"selected": true,
175+
"simple_modifications": [
176+
{
177+
"from": {
178+
"key_code": "caps_lock"
179+
},
180+
"to": [
181+
{
182+
"key_code": "left_control"
183+
}
184+
]
185+
}
186+
],
187+
"virtual_hid_keyboard": {
188+
"country_code": 0,
189+
"indicate_sticky_modifier_keys_state": true,
190+
"mouse_key_xy_scale": 100
191+
}
192+
}
193+
]
194+
}

xdg_config/nvim/after/plugin/cyclist.vim

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ call cyclist#add_listchar_option_set('limited', {
99
\ 'tab': '» ',
1010
\ 'trail': '·',
1111
\ 'extends': '<',
12-
\ 'precedes': '>',
12+
\ 'precedes': '>',
1313
\ 'conceal': '',
1414
\ 'nbsp': '',
1515
\ })
@@ -20,7 +20,7 @@ call cyclist#add_listchar_option_set('busy', {
2020
\ 'space': '',
2121
\ 'trail': '-',
2222
\ 'extends': '',
23-
\ 'precedes': '',
23+
\ 'precedes': '',
2424
\ 'conceal': '',
2525
\ 'nbsp': '',
2626
\ })
@@ -33,4 +33,9 @@ if $USER == 'tj-wsl'
3333
call cyclist#activate_listchars('wsl')
3434
endif
3535

36+
" I can't figure out fonts and stuff on mac.
37+
if has("macunix")
38+
silent! call cyclist#activate_listchars('limited')
39+
endif
40+
3641
nmap <leader>cl <Plug>CyclistNext

xdg_config/nvim/lua/tj/lsp/init.lua

Lines changed: 75 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ if not has_lsp then
66
return
77
end
88

9+
local is_mac = vim.fn.has "macunix" == 1
10+
911
local lspconfig_util = require "lspconfig.util"
1012

1113
local ok, nvim_status = pcall(require, "lsp-status")
@@ -281,33 +283,83 @@ for server, config in pairs(servers) do
281283
setup_server(server, config)
282284
end
283285

284-
-- Load lua configuration from nlua.
285-
_ = require("nlua.lsp.nvim").setup(lspconfig, {
286-
on_init = custom_init,
287-
on_attach = custom_attach,
288-
capabilities = updated_capabilities,
286+
if is_mac then
287+
local sumneko_cmd, sumneko_env = nil, nil
288+
require("nvim-lsp-installer").setup {
289+
automatic_installation = false,
290+
ensure_installed = { "sumneko_lua" },
291+
}
289292

290-
root_dir = function(fname)
291-
if string.find(vim.fn.fnamemodify(fname, ":p"), "xdg_config/nvim/") then
292-
return vim.fn.expand "~/git/config_manager/xdg_config/nvim/"
293-
end
293+
sumneko_cmd = {
294+
vim.fn.stdpath "data" .. "/lsp_servers/sumneko_lua/extension/server/bin/lua-language-server",
295+
}
294296

295-
-- ~/git/config_manager/xdg_config/nvim/...
296-
return lspconfig_util.find_git_ancestor(fname) or lspconfig_util.path.dirname(fname)
297-
end,
297+
local process = require "nvim-lsp-installer.core.process"
298+
local path = require "nvim-lsp-installer.core.path"
298299

299-
globals = {
300-
-- Colorbuddy
301-
"Color",
302-
"c",
303-
"Group",
304-
"g",
305-
"s",
300+
sumneko_env = {
301+
cmd_env = {
302+
PATH = process.extend_path {
303+
path.concat { vim.fn.stdpath "data", "lsp_servers", "sumneko_lua", "extension", "server", "bin" },
304+
},
305+
},
306+
}
306307

307-
-- Custom
308-
"RELOAD",
309-
},
310-
})
308+
setup_server("sumneko_lua", {
309+
settings = {
310+
Lua = {
311+
diagnostics = {
312+
globals = {
313+
-- Colorbuddy
314+
"Color",
315+
"c",
316+
"Group",
317+
"g",
318+
"s",
319+
320+
-- Custom
321+
"RELOAD",
322+
},
323+
},
324+
325+
workspace = {
326+
-- Make the server aware of Neovim runtime files
327+
library = vim.api.nvim_get_runtime_file("", true),
328+
},
329+
},
330+
},
331+
})
332+
else
333+
-- Load lua configuration from nlua.
334+
_ = require("nlua.lsp.nvim").setup(lspconfig, {
335+
cmd = sumneko_cmd,
336+
cmd_env = sumneko_env,
337+
on_init = custom_init,
338+
on_attach = custom_attach,
339+
capabilities = updated_capabilities,
340+
341+
root_dir = function(fname)
342+
if string.find(vim.fn.fnamemodify(fname, ":p"), "xdg_config/nvim/") then
343+
return vim.fn.expand "~/git/config_manager/xdg_config/nvim/"
344+
end
345+
346+
-- ~/git/config_manager/xdg_config/nvim/...
347+
return lspconfig_util.find_git_ancestor(fname) or lspconfig_util.path.dirname(fname)
348+
end,
349+
350+
globals = {
351+
-- Colorbuddy
352+
"Color",
353+
"c",
354+
"Group",
355+
"g",
356+
"s",
357+
358+
-- Custom
359+
"RELOAD",
360+
},
361+
})
362+
end
311363

312364
if pcall(require, "sg.lsp") then
313365
require("sg.lsp").setup {

0 commit comments

Comments
 (0)