Skip to content

Commit 40bcf87

Browse files
committed
going to barcelona for work, gotta push
1 parent 39445dc commit 40bcf87

18 files changed

Lines changed: 275 additions & 104 deletions

File tree

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11

2-
augroup MyTypescriptCommands
3-
au!
4-
" autocmd BufWritePost <buffer> :silent! !prettier --write %
5-
augroup END
2+
" augroup MyTypescriptCommands
3+
" au!
4+
" autocmd BufWritePost <buffer> :silent! Prettier
5+
" augroup END
66

77
setlocal shiftwidth=4
88
setlocal formatoptions-=o

xdg_config/nvim/after/plugin/lsiftyped.lua

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ if not ok then
33
return
44
end
55

6-
local group = vim.api.nvim_create_augroup("LsifTyped", { clear = true })
6+
local group = vim.api.nvim_create_augroup("scip", { clear = true })
77
vim.api.nvim_create_autocmd("BufReadCmd", {
88
group = group,
9-
pattern = "*.lsif-typed",
9+
pattern = "*.scip",
1010
callback = function()
1111
local bufnr = vim.api.nvim_get_current_buf()
1212
local file = vim.fn.expand "<afile>"
@@ -17,9 +17,9 @@ vim.api.nvim_create_autocmd("BufReadCmd", {
1717
Job
1818
:new({
1919
"protoc",
20-
"--decode=lib.codeintel.lsiftyped.Index",
21-
"--proto_path=/home/tjdevries/sourcegraph/sourcegraph.git/main/proto/lib/codeintel/lsiftyped",
22-
"lsif.proto",
20+
"--decode=scip.Index",
21+
"--proto_path=/home/tjdevries/sourcegraph/scip/",
22+
"scip.proto",
2323

2424
writer = Job:new { "cat", file },
2525

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
if vim.g.dbs == nil then
2+
vim.g.dbs = vim.empty_dict()
3+
end
4+
5+
local dbs = vim.g.dbs
6+
dbs["sg-local"] = "postgres://sourcegraph:sourcegraph@localhost:5432/sourcegraph"
7+
8+
vim.g.dbs = dbs

xdg_config/nvim/after/plugin/statusline.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ require("el").setup {
110110
{ " " },
111111
{ sections.split, required = true },
112112
{ git_icon },
113-
{ sections.maximum_width(builtin.make_responsive_file(140, 90), 0.40), required = true },
113+
{ sections.maximum_width(builtin.file_relative, 0.60), required = true },
114114
{ sections.collapse_builtin { { " " }, { builtin.modified_flag } } },
115115
{ sections.split, required = true },
116116
{ diagnostic_display },

xdg_config/nvim/after/plugin/treesitter.lua

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,14 @@ list.sql = {
1717
},
1818
}
1919

20+
list.rsx = {
21+
install_info = {
22+
url = "https://github.com/tjdevries/tree-sitter-rsx",
23+
files = { "src/parser.c", "src/scanner.cc" },
24+
branch = "master",
25+
},
26+
}
27+
2028
-- list.lua = nil
2129

2230
-- :h nvim-treesitter-query-extensions
@@ -58,6 +66,7 @@ local _ = require("nvim-treesitter.configs").setup {
5866
"go",
5967
"html",
6068
"javascript",
69+
"json",
6170
"markdown",
6271
"python",
6372
"query",
@@ -70,7 +79,7 @@ local _ = require("nvim-treesitter.configs").setup {
7079
highlight = {
7180
enable = true,
7281
use_languagetree = false,
73-
disable = { "json" },
82+
-- disable = { "json" },
7483
custom_captures = custom_captures,
7584
},
7685

xdg_config/nvim/init.lua

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,12 @@ if require "tj.first_load"() then
6161
return
6262
end
6363

64+
if vim.g.neovide then
65+
vim.g.neovide_cursor_trail_legnth = 0
66+
vim.g.neovide_cursor_animation_length = 0
67+
vim.o.guifont = "Jetbrains Mono"
68+
end
69+
6470
-- Leader key -> ","
6571
--
6672
-- In general, it's a good idea to set this early in your config, because otherwise

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

Lines changed: 39 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ local ts_util = require "nvim-lsp-ts-utils"
2323
-- require("vim.lsp.log").set_level "trace"
2424

2525
local status = require "tj.lsp.status"
26-
print("STATUS", status)
2726
if status then
2827
status.activate()
2928
end
@@ -33,32 +32,49 @@ local custom_init = function(client)
3332
client.config.flags.allow_incremental_sync = true
3433
end
3534

35+
local augroup_format = vim.api.nvim_create_augroup("my_lsp_format", { clear = true })
36+
local autocmd_format = function(async, filter)
37+
vim.api.nvim_clear_autocmds { buffer = 0, group = augroup_format }
38+
vim.api.nvim_create_autocmd("BufWritePre", {
39+
buffer = 0,
40+
callback = function()
41+
vim.lsp.buf.format { async = async, filter = filter }
42+
end,
43+
})
44+
end
45+
3646
local filetype_attach = setmetatable({
37-
go = function(client)
38-
vim.cmd [[
39-
augroup lsp_buf_format
40-
au! BufWritePre <buffer>
41-
autocmd BufWritePre <buffer> :lua vim.lsp.buf.formatting_sync()
42-
augroup END
43-
]]
47+
go = function()
48+
autocmd_format(false)
49+
end,
50+
51+
scss = function()
52+
autocmd_format(false)
53+
end,
54+
55+
css = function()
56+
autocmd_format(false)
4457
end,
4558

4659
rust = function()
60+
-- vim.cmd [[
61+
-- autocmd BufEnter,BufWritePost <buffer> :lua require('lsp_extensions.inlay_hints').request {aligned = true, prefix = " » "}
62+
-- ]]
63+
4764
telescope_mapper("<space>wf", "lsp_workspace_symbols", {
4865
ignore_filename = true,
4966
query = "#",
5067
}, true)
5168

52-
-- vim.cmd [[
53-
-- autocmd BufEnter,BufWritePost <buffer> :lua require('lsp_extensions.inlay_hints').request {aligned = true, prefix = " » "}
54-
-- ]]
69+
autocmd_format(false)
70+
end,
5571

56-
vim.cmd [[
57-
augroup lsp_buf_format
58-
au! BufWritePre <buffer>
59-
autocmd BufWritePre <buffer> :lua vim.lsp.buf.formatting_sync()
60-
augroup END
61-
]]
72+
typescript = function()
73+
autocmd_format(false, function(clients)
74+
return vim.tbl_filter(function(client)
75+
return client.name ~= "tsserver"
76+
end, clients)
77+
end)
6278
end,
6379
}, {
6480
__index = function()
@@ -117,6 +133,8 @@ local custom_attach = function(client)
117133

118134
-- Set autocommands conditional on server_capabilities
119135
if client.server_capabilities.documentHighlightProvider then
136+
P(client.server_capabilities.documentHighlightProvider)
137+
120138
vim.cmd [[
121139
augroup lsp_document_highlight
122140
autocmd! * <buffer>
@@ -213,12 +231,9 @@ local servers = {
213231
rust_analyzer = {
214232
cmd = { "rustup", "run", "nightly", "rust-analyzer" },
215233
},
216-
-- settings = {
217-
-- ["rust-analyzer"] = {
218-
-- },
219-
-- },
220234

221235
elmls = true,
236+
cssls = true,
222237

223238
tsserver = {
224239
init_options = ts_util.init_options,
@@ -348,14 +363,15 @@ end
348363
-- }
349364

350365
-- Set up null-ls
351-
local use_null = false
366+
local use_null = true
352367
if use_null then
353368
require("null-ls").setup {
354369
sources = {
355370
-- require("null-ls").builtins.formatting.stylua,
356371
-- require("null-ls").builtins.diagnostics.eslint,
357372
-- require("null-ls").builtins.completion.spell,
358-
require("null-ls").builtins.diagnostics.selene,
373+
-- require("null-ls").builtins.diagnostics.selene,
374+
require("null-ls").builtins.formatting.prettierd,
359375
},
360376
}
361377
end

xdg_config/nvim/lua/tj/plugins.lua

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
_ = vim.cmd [[packadd packer.nvim]]
22
_ = vim.cmd [[packadd vimball]]
33

4+
-- vim.api.nvim_cmd({
5+
-- cmd = "packadd",
6+
-- args = { "packer.vim" },
7+
-- }, {})
8+
49
local has = function(x)
510
return vim.fn.has(x) == 1
611
end
@@ -51,8 +56,10 @@ return require("packer").startup {
5156
end
5257

5358
use "wbthomason/packer.nvim"
59+
60+
-- Alternative to impatient, uses sqlite. Faster ;)
61+
-- use https://github.com/tami5/impatient.nvim
5462
-- use "lewis6991/impatient.nvim"
55-
-- use "camspiers/snap"
5663

5764
-- My Plugins
5865
local_use("ThePrimeagen", "refactoring.nvim")
@@ -171,6 +178,15 @@ return require("packer").startup {
171178
use { "nvim-telescope/telescope-arecibo.nvim", rocks = { "openssl", "lua-http-parser" } }
172179
end
173180

181+
if executable "jq" then
182+
use {
183+
"NTBBloodbath/rest.nvim",
184+
config = function()
185+
require("rest-nvim").setup()
186+
end,
187+
}
188+
end
189+
174190
use {
175191
"antoinemadec/FixCursorHold.nvim",
176192
run = function()
Lines changed: 43 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
local ls = require "luasnip"
2+
local snippet_collection = require "luasnip.session.snippet_collection"
23

34
-- local snippet = ls.s
45
-- local snippet_from_nodes = ls.sn
56

7+
local s = ls.s
68
local i = ls.insert_node
79
local t = ls.text_node
810
-- local d = ls.dynamic_node
@@ -13,67 +15,74 @@ local fmt = require("luasnip.extras.fmt").fmt
1315
local shared = R "tj.snips"
1416
local same = shared.same
1517

16-
return {
17-
main = fmt(
18-
[[
18+
-- ls.cl
19+
snippet_collection.clear_snippets "rust"
20+
ls.add_snippets("rust", {
21+
s(
22+
"main",
23+
fmt(
24+
[[
1925
fn main() {{
2026
}}
2127
]],
22-
{}
28+
{}
29+
)
2330
),
24-
25-
modtest = fmt(
26-
[[
31+
s(
32+
"modtest",
33+
fmt(
34+
[[
2735
#[cfg(test)]
2836
mod test {{
2937
use super::*;
3038
3139
{}
3240
}}
3341
]],
34-
i(0)
42+
i(0)
43+
)
3544
),
36-
37-
test = fmt(
38-
[[
39-
#[test]
40-
fn {}(){}{{
41-
{}
42-
}}
43-
]],
44-
{
45-
i(1, "testname"),
46-
c(2, {
47-
t "",
48-
t " -> Result<()> ",
49-
-- fmt(" -> {}<()> ", { i(nil, "Result") }),
50-
}),
51-
i(0),
52-
}
45+
s(
46+
{ trig = "test" },
47+
fmt(
48+
[[
49+
#[test]
50+
fn {}(){}{{
51+
{}
52+
}}
53+
]],
54+
{
55+
i(1, "testname"),
56+
c(2, {
57+
t "",
58+
t " -> Result<()> ",
59+
-- fmt(" -> {}<()> ", { i(nil, "Result") }),
60+
}),
61+
i(0),
62+
}
63+
)
5364
),
54-
55-
eq = fmt("assert_eq!({}, {});{}", { i(1), i(2), i(0) }),
56-
57-
enum = {
65+
s("eq", fmt("assert_eq!({}, {});{}", { i(1), i(2), i(0) })),
66+
s("enum", {
5867
t { "#[derive(Debug, PartialEq)]", "enum " },
5968
i(1, "Name"),
6069
t { " {", " " },
6170
i(0),
6271
t { "", "}" },
63-
},
72+
}),
6473

65-
struct = {
74+
s("struct", {
6675
t { "#[derive(Debug, PartialEq)]", "struct " },
6776
i(1, "Name"),
6877
t { " {", " " },
6978
i(0),
7079
t { "", "}" },
71-
},
80+
}),
7281

73-
pd = fmt([[println!("{}: {{:?}}", {});]], { same(1), i(1) }),
82+
s("pd", fmt([[println!("{}: {{:?}}", {});]], { same(1), i(1) })),
7483
-- _pd = {
7584
-- t [[println!("{:?}", ]],
7685
-- i(1),
7786
-- t [[);]],
7887
-- },
79-
}
88+
})

xdg_config/nvim/lua/tj/telescope/mappings.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ vim.api.nvim_set_keymap("c", "<c-r><c-r>", "<Plug>(TelescopeFuzzyCommandSearch)"
3131
-- Dotfiles
3232
map_tele("<leader>en", "edit_neovim")
3333
map_tele("<leader>ez", "edit_zsh")
34+
map_tele("<space><space>d", "diagnostics")
3435

3536
-- Search
3637
-- TODO: I would like to completely remove _mock from my search results here when I'm in SG/SG

0 commit comments

Comments
 (0)