|
103 | 103 | -- vim.opt.cmdheight = 0 -- command height |
104 | 104 | -- end |
105 | 105 |
|
| 106 | + |
| 107 | +-- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- |
| 108 | +-- ━━━━━━━━━━━━━━━━━━━❰ Automate ❱━━━━━━━━━━━━━━━━━━━━ -- |
| 109 | + |
| 110 | +local group = vim.api.nvim_create_augroup("AbstractAutoGroup", {clear=true}) |
| 111 | + |
| 112 | +vim.api.nvim_create_autocmd( |
| 113 | + "TextYankPost", |
| 114 | + { |
| 115 | + desc = "highlight text on yank", |
| 116 | + pattern = "*", |
| 117 | + group = group, |
| 118 | + callback = function() |
| 119 | + vim.highlight.on_yank { |
| 120 | + higroup="Search", timeout=400, on_visual=true |
| 121 | + } |
| 122 | + end, |
| 123 | + } |
| 124 | +) |
| 125 | + |
| 126 | +-- jump to the last position when reopening a file |
| 127 | +vim.cmd([[ |
| 128 | + if has("autocmd") |
| 129 | + au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$") | exe "normal! g`\"" | endif |
| 130 | + endif |
| 131 | +]]) |
| 132 | + |
| 133 | +vim.api.nvim_create_autocmd( |
| 134 | + "BufWritePre", |
| 135 | + { |
| 136 | + desc = "remove whitespaces on save", |
| 137 | + pattern = "*", |
| 138 | + group = group, |
| 139 | + command = "%s/\\s\\+$//e", |
| 140 | + } |
| 141 | +) |
| 142 | + |
| 143 | +vim.api.nvim_create_autocmd( |
| 144 | + "BufEnter", |
| 145 | + { |
| 146 | + desc = "don't auto comment new line", |
| 147 | + pattern = "*", |
| 148 | + group = group, |
| 149 | + command = "setlocal formatoptions-=c formatoptions-=r formatoptions-=o", |
| 150 | + } |
| 151 | +) |
| 152 | + |
| 153 | +vim.api.nvim_create_autocmd( |
| 154 | + "VimResized", |
| 155 | + { |
| 156 | + desc = "auto resize splited windows", |
| 157 | + pattern = "*", |
| 158 | + group = group, |
| 159 | + command = "tabdo wincmd =", |
| 160 | + } |
| 161 | +) |
| 162 | + |
| 163 | +-- ━━━━━━━━━━━━━━━━❰ end of Automate ❱━━━━━━━━━━━━━━━━ -- |
| 164 | +-- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- |
| 165 | + |
| 166 | + |
106 | 167 | -- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- |
107 | | --- ━━━━━━━━━━━━━━━❰ end of Plugin Configs ❱━━━━━━━━━━━━━━━━ -- |
| 168 | +-- ━━━━━━━━━❰ end of Plugin-Independent Configs ❱━━━━━━━━━━ -- |
108 | 169 | -- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- |
109 | 170 |
|
0 commit comments