summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.config/hypr/conf/keybinds.conf4
-rw-r--r--.config/nvim/after/plugin/autocmds.lua145
-rw-r--r--.config/nvim/after/plugin/autocmds.vim17
-rw-r--r--.config/nvim/lua/plugins/lsp.lua13
-rw-r--r--.config/nvim/lua/plugins/typst.lua10
-rw-r--r--.config/user-dirs.dirs2
6 files changed, 171 insertions, 20 deletions
diff --git a/.config/hypr/conf/keybinds.conf b/.config/hypr/conf/keybinds.conf
index b192c5d..82b26ba 100644
--- a/.config/hypr/conf/keybinds.conf
+++ b/.config/hypr/conf/keybinds.conf
@@ -38,8 +38,8 @@ bindl = , XF86AudioPrev, exec, playerctl previous
38# Optionally, customize slurp's appearance 38# Optionally, customize slurp's appearance
39env = SLURP_ARGS, -d -B F050F022 -b 10101022 -c ff00ff 39env = SLURP_ARGS, -d -B F050F022 -b 10101022 -c ff00ff
40 40
41bind = ,Print, exec, ~/.local/bin/screenshot.sh 41bind = SHIFT, Print, exec, grimblast copysave area
42bind = SHIFT, Print, exec, grimblast copy area 42bind = ,Print, exec, grimblast copy area
43 43
44# Move focus 44# Move focus
45bind = $mainMod, code:43, movefocus, l 45bind = $mainMod, code:43, movefocus, l
diff --git a/.config/nvim/after/plugin/autocmds.lua b/.config/nvim/after/plugin/autocmds.lua
new file mode 100644
index 0000000..3356a49
--- /dev/null
+++ b/.config/nvim/after/plugin/autocmds.lua
@@ -0,0 +1,145 @@
1-- https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/autocmds.lua
2
3local function augroup(name)
4 return vim.api.nvim_create_augroup("lazyvim_" .. name, { clear = true })
5end
6
7-- Set typst filetype
8vim.api.nvim_create_autocmd(
9 {
10 "BufNewFile",
11 "BufRead",
12 },
13 {
14 pattern = "*.typ",
15 callback = function()
16 local buf = vim.api.nvim_get_current_buf()
17 vim.api.nvim_set_option_value("filetype", "typst", { buf = buf })
18 vim.api.nvim_set_option_value("shiftwidth", 2, { buf = buf })
19 end
20 }
21)
22
23-- Set PKGBUILD filetype
24vim.api.nvim_create_autocmd(
25 {
26 "BufNewFile",
27 "BufRead",
28 },
29 {
30 pattern = "PKGBUILD",
31 callback = function()
32 local buf = vim.api.nvim_get_current_buf()
33 vim.api.nvim_set_option_value("filetype", "PKGBUILD", { buf = buf })
34 end
35 }
36)
37
38-- Set buku-edit filetype
39vim.api.nvim_create_autocmd(
40 {
41 "BufNewFile",
42 "BufRead",
43 },
44 {
45 pattern = "buku-edit-*",
46 callback = function()
47 local buf = vim.api.nvim_get_current_buf()
48 vim.api.nvim_set_option_value("filetype", "buku", { buf = buf })
49 end
50 }
51)
52
53-- Set mail filetype
54vim.api.nvim_create_autocmd(
55 {
56 "BufNewFile",
57 "BufRead",
58 },
59 {
60 pattern = "/tmp/neomutt*",
61 callback = function()
62 local buf = vim.api.nvim_get_current_buf()
63 vim.api.nvim_set_option_value("autoindent", false, { buf = buf })
64 vim.api.nvim_set_option_value("filetype", "mail", { buf = buf })
65 vim.api.nvim_set_option_value("wrapmargin", 0, { buf = buf })
66 vim.api.nvim_set_option_value("textwidth", 80, { buf = buf })
67 end
68 }
69)
70
71-- Resize splits if window got resized
72vim.api.nvim_create_autocmd({ "VimResized" }, {
73 group = augroup("resize_splits"),
74 callback = function()
75 local current_tab = vim.fn.tabpagenr()
76 vim.cmd("tabdo wincmd =")
77 vim.cmd("tabnext " .. current_tab)
78 end,
79})
80
81-- go to last loc when opening a buffer
82vim.api.nvim_create_autocmd("BufReadPost", {
83 group = augroup("last_loc"),
84 callback = function(event)
85 local exclude = { "gitcommit" }
86 local buf = event.buf
87 if vim.tbl_contains(exclude, vim.bo[buf].filetype) or vim.b[buf].lazyvim_last_loc then
88 return
89 end
90 vim.b[buf].lazyvim_last_loc = true
91 local mark = vim.api.nvim_buf_get_mark(buf, '"')
92 local lcount = vim.api.nvim_buf_line_count(buf)
93 if mark[1] > 0 and mark[1] <= lcount then
94 pcall(vim.api.nvim_win_set_cursor, 0, mark)
95 end
96 end,
97})
98
99-- close some filetypes with <q>
100vim.api.nvim_create_autocmd("FileType", {
101 group = augroup("close_with_q"),
102 pattern = {
103 "PlenaryTestPopup",
104 "checkhealth",
105 "dbout",
106 "gitsigns-blame",
107 "grug-far",
108 "help",
109 "lspinfo",
110 "neotest-output",
111 "neotest-output-panel",
112 "neotest-summary",
113 "notify",
114 "qf",
115 "snacks_win",
116 "spectre_panel",
117 "startuptime",
118 "tsplayground",
119 },
120 callback = function(event)
121 vim.bo[event.buf].buflisted = false
122 vim.schedule(function()
123 vim.keymap.set("n", "q", function()
124 vim.cmd("close")
125 pcall(vim.api.nvim_buf_delete, event.buf, { force = true })
126 end, {
127 buffer = event.buf,
128 silent = true,
129 desc = "Quit buffer",
130 })
131 end)
132 end,
133})
134
135-- Auto create dir when saving a file, in case some intermediate directory does not exist
136vim.api.nvim_create_autocmd({ "BufWritePre" }, {
137 group = augroup("auto_create_dir"),
138 callback = function(event)
139 if event.match:match("^%w%w+:[\\/][\\/]") then
140 return
141 end
142 local file = vim.uv.fs_realpath(event.match) or event.match
143 vim.fn.mkdir(vim.fn.fnamemodify(file, ":p:h"), "p")
144 end,
145})
diff --git a/.config/nvim/after/plugin/autocmds.vim b/.config/nvim/after/plugin/autocmds.vim
index 0e7935b..21c7bc4 100644
--- a/.config/nvim/after/plugin/autocmds.vim
+++ b/.config/nvim/after/plugin/autocmds.vim
@@ -1,23 +1,6 @@
1" I don't know how to port this yet 1" I don't know how to port this yet
2autocmd BufRead,BufWrite * if ! &bin | silent! %s/\s\+$//ge | endif 2autocmd BufRead,BufWrite * if ! &bin | silent! %s/\s\+$//ge | endif
3 3
4autocmd BufNewFile,BufRead /tmp/neomutt* set noautoindent filetype=mail wm=0 tw=80
5
6augroup bukugroup
7 au! BufRead,BufNewFile,BufEnter buku-edit-* set filetype=buku
8augroup END
9
10" Restore last position
11autocmd BufReadPost *
12 \ if line("'\"") >= 1 && line("'\"") <= line("$") && &ft !~# 'commit'
13 \ | exe "normal! g`\""
14 \ | endif
15
16augroup pkgbuild
17 autocmd!
18 autocmd BufRead,BufNewFile PKGBUILD set filetype=PKGBUILD
19augroup END
20
21augroup vimwiki 4augroup vimwiki
22 autocmd! 5 autocmd!
23 autocmd BufRead,BufNewFile *.wiki set filetype=vimwiki 6 autocmd BufRead,BufNewFile *.wiki set filetype=vimwiki
diff --git a/.config/nvim/lua/plugins/lsp.lua b/.config/nvim/lua/plugins/lsp.lua
index 41616de..2fa92c2 100644
--- a/.config/nvim/lua/plugins/lsp.lua
+++ b/.config/nvim/lua/plugins/lsp.lua
@@ -80,6 +80,19 @@ return {
80 } 80 }
81 end 81 end
82 82
83 -- typst/tinymist
84 require("lspconfig")["tinymist"].setup({
85 on_attach = on_attach,
86 capabilities = capabilities,
87 single_file_support = true,
88 root_dir = function()
89 return vim.fn.getcwd()
90 end,
91 settings = {
92 formatterMode = "typstyle",
93 }
94 })
95
83 -- lua 96 -- lua
84 require("lspconfig")["lua_ls"].setup({ 97 require("lspconfig")["lua_ls"].setup({
85 on_attach = on_attach, 98 on_attach = on_attach,
diff --git a/.config/nvim/lua/plugins/typst.lua b/.config/nvim/lua/plugins/typst.lua
new file mode 100644
index 0000000..c04ea70
--- /dev/null
+++ b/.config/nvim/lua/plugins/typst.lua
@@ -0,0 +1,10 @@
1return {
2 {
3 'chomosuke/typst-preview.nvim',
4 ft = 'typst',
5 version = '1.*',
6 config = function()
7 require 'typst-preview'.setup {}
8 end,
9 }
10}
diff --git a/.config/user-dirs.dirs b/.config/user-dirs.dirs
index 7723b1b..e13a65c 100644
--- a/.config/user-dirs.dirs
+++ b/.config/user-dirs.dirs
@@ -13,4 +13,4 @@ XDG_PUBLICSHARE_DIR="$HOME/.local/share/publicshare"
13XDG_MUSIC_DIR="$HOME/music" 13XDG_MUSIC_DIR="$HOME/music"
14XDG_PICTURES_DIR="$HOME/desk/pics" 14XDG_PICTURES_DIR="$HOME/desk/pics"
15XDG_VIDEOS_DIR="$HOME/desk/vids" 15XDG_VIDEOS_DIR="$HOME/desk/vids"
16XDG_SCREENSHOTS_DIR="$HOME/pics/screenshots" 16XDG_SCREENSHOTS_DIR="$HOME/desk/pics/screenshots"