Skip to content

Commit 52c1d6d

Browse files
committed
update dotfiles
1 parent 8ea88be commit 52c1d6d

File tree

7 files changed

+97
-5
lines changed

7 files changed

+97
-5
lines changed

nvim/.config/nvim/init.lua

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ require('custom.tabs')
66
require('custom.telescope')
77
require('custom.treesitter')
88
require('custom.discord')
9+
require('custom.null_ls')
910

1011
vim.opt.termguicolors = true
1112

nvim/.config/nvim/lua/custom/lsp.lua

+24
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,18 @@ cmp.setup({
8282
"i",
8383
"s",
8484
}),
85+
["<Down>"] = cmp.mapping(function(fallback)
86+
if cmp.visible() then
87+
cmp.select_next_item()
88+
elseif require("luasnip").expand_or_jumpable() then
89+
vim.fn.feedkeys(vim.api.nvim_replace_termcodes("<Plug>luasnip-expand-or-jump", true, true, true), "")
90+
else
91+
fallback()
92+
end
93+
end, {
94+
"i",
95+
"s",
96+
}),
8597
["<S-Tab>"] = cmp.mapping(function(fallback)
8698
if cmp.visible() then
8799
cmp.select_prev_item()
@@ -94,6 +106,18 @@ cmp.setup({
94106
"i",
95107
"s",
96108
}),
109+
["<Up>"] = cmp.mapping(function(fallback)
110+
if cmp.visible() then
111+
cmp.select_prev_item()
112+
elseif require("luasnip").jumpable(-1) then
113+
vim.fn.feedkeys(vim.api.nvim_replace_termcodes("<Plug>luasnip-jump-prev", true, true, true), "")
114+
else
115+
fallback()
116+
end
117+
end, {
118+
"i",
119+
"s",
120+
}),
97121
},
98122
sources = {
99123
{ name = "nvim_lsp" },
+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
local null_ls = require("null-ls")
2+
3+
local group = vim.api.nvim_create_augroup("lsp_format_on_save", { clear = false })
4+
local event = "BufWritePre" -- or "BufWritePost"
5+
local async = event == "BufWritePost"
6+
7+
null_ls.setup({
8+
on_attach = function(client, bufnr)
9+
if client.supports_method("textDocument/formatting") then
10+
vim.keymap.set("n", "<Leader>f", function()
11+
vim.lsp.buf.format({ bufnr = vim.api.nvim_get_current_buf() })
12+
end, { buffer = bufnr, desc = "[lsp] format" })
13+
14+
-- format on save
15+
vim.api.nvim_clear_autocmds({ buffer = bufnr, group = group })
16+
vim.api.nvim_create_autocmd(event, {
17+
buffer = bufnr,
18+
group = group,
19+
callback = function()
20+
vim.lsp.buf.format({ bufnr = bufnr, async = async })
21+
end,
22+
desc = "[lsp] format on save",
23+
})
24+
end
25+
26+
if client.supports_method("textDocument/rangeFormatting") then
27+
vim.keymap.set("x", "<Leader>f", function()
28+
vim.lsp.buf.format({ bufnr = vim.api.nvim_get_current_buf() })
29+
end, { buffer = bufnr, desc = "[lsp] format" })
30+
end
31+
end,
32+
})
33+
34+
local prettier = require("prettier")
35+
36+
prettier.setup({
37+
bin = 'prettier',
38+
filetypes = {
39+
"css",
40+
"graphql",
41+
"html",
42+
"javascript",
43+
"javascriptreact",
44+
"json",
45+
"less",
46+
"markdown",
47+
"scss",
48+
"typescript",
49+
"typescriptreact",
50+
"yaml",
51+
},
52+
})

nvim/.config/nvim/lua/custom/tabs.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ bufferline.setup({
88
diagnostics = "nvim_lsp",
99
always_show_bufferline = true,
1010
modified_icon = "",
11-
tab_size = 22,
11+
-- tab_size = 22,
1212
},
1313
})
1414

nvim/.config/nvim/lua/plugins.lua

+2
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ return require('packer').startup(function(use)
5252
}
5353
}
5454
use 'saadparwaiz1/cmp_luasnip'
55+
use 'jose-elias-alvarez/null-ls.nvim'
56+
use 'MunifTanjim/prettier.nvim'
5557

5658
use 'folke/todo-comments.nvim'
5759

nvim/.config/nvim/plugin/packer_compiled.lua

+14-4
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,11 @@ _G.packer_plugins = {
141141
path = "/Users/tim/.local/share/nvim/site/pack/packer/start/mason.nvim",
142142
url = "https://github.com/williamboman/mason.nvim"
143143
},
144+
["null-ls.nvim"] = {
145+
loaded = true,
146+
path = "/Users/tim/.local/share/nvim/site/pack/packer/start/null-ls.nvim",
147+
url = "https://github.com/jose-elias-alvarez/null-ls.nvim"
148+
},
144149
["nvim-autopairs"] = {
145150
config = { "\27LJ\2\n@\0\0\3\0\3\0\a6\0\0\0'\2\1\0B\0\2\0029\0\2\0004\2\0\0B\0\2\1K\0\1\0\nsetup\19nvim-autopairs\frequire\0" },
146151
loaded = true,
@@ -198,6 +203,11 @@ _G.packer_plugins = {
198203
path = "/Users/tim/.local/share/nvim/site/pack/packer/start/presence.nvim",
199204
url = "https://github.com/andweeb/presence.nvim"
200205
},
206+
["prettier.nvim"] = {
207+
loaded = true,
208+
path = "/Users/tim/.local/share/nvim/site/pack/packer/start/prettier.nvim",
209+
url = "https://github.com/MunifTanjim/prettier.nvim"
210+
},
201211
["rust.vim"] = {
202212
loaded = true,
203213
path = "/Users/tim/.local/share/nvim/site/pack/packer/start/rust.vim",
@@ -231,14 +241,14 @@ _G.packer_plugins = {
231241
}
232242

233243
time([[Defining packer_plugins]], false)
234-
-- Config for: nvim-autopairs
235-
time([[Config for nvim-autopairs]], true)
236-
try_loadstring("\27LJ\2\n@\0\0\3\0\3\0\a6\0\0\0'\2\1\0B\0\2\0029\0\2\0004\2\0\0B\0\2\1K\0\1\0\nsetup\19nvim-autopairs\frequire\0", "config", "nvim-autopairs")
237-
time([[Config for nvim-autopairs]], false)
238244
-- Config for: nvim-cmp
239245
time([[Config for nvim-cmp]], true)
240246
require('custom.lsp')
241247
time([[Config for nvim-cmp]], false)
248+
-- Config for: nvim-autopairs
249+
time([[Config for nvim-autopairs]], true)
250+
try_loadstring("\27LJ\2\n@\0\0\3\0\3\0\a6\0\0\0'\2\1\0B\0\2\0029\0\2\0004\2\0\0B\0\2\1K\0\1\0\nsetup\19nvim-autopairs\frequire\0", "config", "nvim-autopairs")
251+
time([[Config for nvim-autopairs]], false)
242252
-- Config for: Comment.nvim
243253
time([[Config for Comment.nvim]], true)
244254
try_loadstring("\27LJ\2\n5\0\0\3\0\3\0\0066\0\0\0'\2\1\0B\0\2\0029\0\2\0B\0\1\1K\0\1\0\nsetup\fComment\frequire\0", "config", "Comment.nvim")

zsh/.zshrc

+3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
export ZSH=$HOME/.oh-my-zsh
2+
export HISTSIZE=100000
23

34
# ZSH_THEME="agnoster"
45
ZSH_THEME="igeek-modest"
@@ -10,6 +11,8 @@ plugins=(
1011
sudo
1112
)
1213

14+
export ZSH_DOTENV_PROMPT='false'
15+
1316
source $ZSH/oh-my-zsh.sh
1417

1518
export EDITOR='nvim'

0 commit comments

Comments
 (0)