diff options
| author | Hsieh Chin Fan <pham@topo.tw> | 2024-07-22 18:31:21 +0800 |
|---|---|---|
| committer | Hsieh Chin Fan <pham@topo.tw> | 2024-07-22 18:31:21 +0800 |
| commit | 0e010ae8e8686e3a374a27885391f99d3ea315cc (patch) | |
| tree | 3a540cc88adb94a99754a6f662634cacb68607de /vim | |
| parent | 3fa3c62ab3439bffacea380631e5e2e4c5a67fcb (diff) | |
Update
Diffstat (limited to 'vim')
| -rw-r--r-- | vim/init.vim | 5 | ||||
| -rw-r--r-- | vim/init/keymaps.vim | 2 | ||||
| -rw-r--r-- | vim/mini.lua | 642 |
3 files changed, 411 insertions, 238 deletions
diff --git a/vim/init.vim b/vim/init.vim index fd65816..ef303c3 100644 --- a/vim/init.vim +++ b/vim/init.vim | |||
| @@ -12,9 +12,10 @@ let s:home = '~/helper/vim' | |||
| 12 | " Add current dir into runtimepath | 12 | " Add current dir into runtimepath |
| 13 | execute 'set runtimepath+='.s:home | 13 | execute 'set runtimepath+='.s:home |
| 14 | 14 | ||
| 15 | " Load script in home | 15 | " Load scripts in home |
| 16 | command! -nargs=1 LoadScript exec 'source '.s:home.'/'.'<args>' | 16 | command! -nargs=1 LoadScript exec 'source '.s:home.'/'.'<args>' |
| 17 | 17 | ||
| 18 | |||
| 18 | " Gerneral scripts | 19 | " Gerneral scripts |
| 19 | LoadScript init/basic.vim " Basic configuration | 20 | LoadScript init/basic.vim " Basic configuration |
| 20 | LoadScript init/keymaps.vim " Key mappings | 21 | LoadScript init/keymaps.vim " Key mappings |
| @@ -22,7 +23,7 @@ LoadScript init/config.vim " Extra config for different contexts | |||
| 22 | 23 | ||
| 23 | " Different scripts for nvim and vim | 24 | " Different scripts for nvim and vim |
| 24 | if has('nvim') | 25 | if has('nvim') |
| 25 | LoadScript lazy.lua | 26 | LoadScript mini.lua |
| 26 | else | 27 | else |
| 27 | LoadScript init/plugins.vim | 28 | LoadScript init/plugins.vim |
| 28 | LoadScript init/style.vim | 29 | LoadScript init/style.vim |
diff --git a/vim/init/keymaps.vim b/vim/init/keymaps.vim index 81ce508..f13756b 100644 --- a/vim/init/keymaps.vim +++ b/vim/init/keymaps.vim | |||
| @@ -211,7 +211,7 @@ nnoremap <leader>ee :edit $MYVIMRC<CR> | |||
| 211 | " MANAGE_BUFFERS ----------------{{{ | 211 | " MANAGE_BUFFERS ----------------{{{ |
| 212 | 212 | ||
| 213 | " Set options | 213 | " Set options |
| 214 | noremap <leader>st :set<space> | 214 | noremap st :set<space> |
| 215 | noremap <leader><leader>ft :<C-\>e'set filetype='..&filetype<CR> | 215 | noremap <leader><leader>ft :<C-\>e'set filetype='..&filetype<CR> |
| 216 | noremap <leader><leader>li :set list!<CR> | 216 | noremap <leader><leader>li :set list!<CR> |
| 217 | noremap <leader><leader>sw :<C-\>e'set shiftwidth='..&shiftwidth<CR> | 217 | noremap <leader><leader>sw :<C-\>e'set shiftwidth='..&shiftwidth<CR> |
diff --git a/vim/mini.lua b/vim/mini.lua index f550440..e693db2 100644 --- a/vim/mini.lua +++ b/vim/mini.lua | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | -- vim: sw=2 foldmethod=marker foldmarker={{{,}}} | 1 | -- vim: sw=2 ts=2 et foldmethod=marker foldmarker={{{,}}} foldlevel=0 |
| 2 | 2 | ||
| 3 | -- Ref: https://github.com/echasnovski/mini.nvim | 3 | -- Ref: https://github.com/echasnovski/mini.nvim |
| 4 | -- https://lazy.folke.io/spec | 4 | -- https://lazy.folke.io/spec |
| @@ -8,32 +8,19 @@ | |||
| 8 | local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" | 8 | local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" |
| 9 | if not (vim.uv or vim.loop).fs_stat(lazypath) then | 9 | if not (vim.uv or vim.loop).fs_stat(lazypath) then |
| 10 | local lazyrepo = "https://github.com/folke/lazy.nvim.git" | 10 | local lazyrepo = "https://github.com/folke/lazy.nvim.git" |
| 11 | local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath }) | 11 | vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath }) |
| 12 | end | 12 | end |
| 13 | vim.opt.rtp:prepend(lazypath) | 13 | vim.opt.rtp:prepend(lazypath) |
| 14 | -- }}} | 14 | -- }}} |
| 15 | vim.g.base46_cache = vim.fn.stdpath "data" .. "/nvchad/base46/" | 15 | require("lazy").setup({ |
| 16 | require("lazy").setup ({ | 16 | |
| 17 | "tpope/vim-sleuth", | 17 | "tpope/vim-sleuth", |
| 18 | -- conform {{{ | ||
| 19 | { | ||
| 20 | "stevearc/conform.nvim", | ||
| 21 | opts = { | ||
| 22 | formatters_by_ft = { | ||
| 23 | lua = { "stylua" }, | ||
| 24 | }, | ||
| 25 | }, | ||
| 26 | config = function(_, opts) | ||
| 27 | require("conform").setup(opts) | ||
| 28 | end, | ||
| 29 | }, | ||
| 30 | -- }}} | ||
| 31 | -- Telescope {{{ | 18 | -- Telescope {{{ |
| 32 | { | 19 | { |
| 33 | "nvim-telescope/telescope.nvim", | 20 | "nvim-telescope/telescope.nvim", |
| 34 | lazy = false, | 21 | lazy = false, |
| 35 | dependencies = { | 22 | dependencies = { |
| 36 | 'nvim-lua/plenary.nvim', | 23 | "nvim-lua/plenary.nvim", |
| 37 | { | 24 | { |
| 38 | "nvim-telescope/telescope-fzf-native.nvim", | 25 | "nvim-telescope/telescope-fzf-native.nvim", |
| 39 | build = "make", | 26 | build = "make", |
| @@ -45,7 +32,7 @@ require("lazy").setup ({ | |||
| 45 | -- require("telescope").load_extension("aerial") | 32 | -- require("telescope").load_extension("aerial") |
| 46 | -- }}} | 33 | -- }}} |
| 47 | -- config {{{ | 34 | -- config {{{ |
| 48 | require('telescope').setup({ | 35 | require("telescope").setup({ |
| 49 | defaults = { | 36 | defaults = { |
| 50 | mappings = { | 37 | mappings = { |
| 51 | i = { | 38 | i = { |
| @@ -68,7 +55,7 @@ require("lazy").setup ({ | |||
| 68 | preview_cutoff = 0, | 55 | preview_cutoff = 0, |
| 69 | }, | 56 | }, |
| 70 | file_ignore_patterns = { | 57 | file_ignore_patterns = { |
| 71 | "node_modules" | 58 | "node_modules", |
| 72 | }, | 59 | }, |
| 73 | }, | 60 | }, |
| 74 | pickers = { | 61 | pickers = { |
| @@ -83,23 +70,23 @@ require("lazy").setup ({ | |||
| 83 | }, | 70 | }, |
| 84 | n = { | 71 | n = { |
| 85 | ["<c-d>"] = "delete_buffer", | 72 | ["<c-d>"] = "delete_buffer", |
| 86 | } | 73 | }, |
| 87 | }, | 74 | }, |
| 88 | }, | 75 | }, |
| 89 | }, | 76 | }, |
| 90 | extensions = { | 77 | extensions = { |
| 91 | fzf = { | 78 | fzf = { |
| 92 | fuzzy = true, -- false will only do exact matching | 79 | fuzzy = true, -- false will only do exact matching |
| 93 | override_generic_sorter = true, -- override the generic sorter | 80 | override_generic_sorter = true, -- override the generic sorter |
| 94 | override_file_sorter = true, -- override the file sorter | 81 | override_file_sorter = true, -- override the file sorter |
| 95 | case_mode = "smart_case", -- or "ignore_case" or "respect_case" | 82 | case_mode = "smart_case", -- or "ignore_case" or "respect_case" |
| 96 | -- the default case_mode is "smart_case" | 83 | -- the default case_mode is "smart_case" |
| 97 | }, | 84 | }, |
| 98 | aerial = { | 85 | aerial = { |
| 99 | -- Display symbols as <root>.<parent>.<symbol> | 86 | -- Display symbols as <root>.<parent>.<symbol> |
| 100 | show_nesting = { | 87 | show_nesting = { |
| 101 | ["_"] = false, -- This key will be the default | 88 | ["_"] = false, -- This key will be the default |
| 102 | json = true, -- You can set the option for specific filetypes | 89 | json = true, -- You can set the option for specific filetypes |
| 103 | yaml = true, | 90 | yaml = true, |
| 104 | }, | 91 | }, |
| 105 | }, | 92 | }, |
| @@ -109,13 +96,18 @@ require("lazy").setup ({ | |||
| 109 | -- Keymaps {{{ | 96 | -- Keymaps {{{ |
| 110 | vim.keymap.set("n", "<leader>f", "<cmd>Telescope oldfiles<CR>", { desc = "telescope find oldfiles" }) | 97 | vim.keymap.set("n", "<leader>f", "<cmd>Telescope oldfiles<CR>", { desc = "telescope find oldfiles" }) |
| 111 | vim.keymap.set("n", "<leader>b", "<cmd>Telescope buffers<CR>", { desc = "telescope find buffers" }) | 98 | vim.keymap.set("n", "<leader>b", "<cmd>Telescope buffers<CR>", { desc = "telescope find buffers" }) |
| 112 | vim.keymap.set("n", "<leader>/", "<cmd>Telescope current_buffer_fuzzy_find<CR>", { desc = "telescope find in current buffer" }) | 99 | vim.keymap.set( |
| 100 | "n", | ||
| 101 | "<leader>/", | ||
| 102 | "<cmd>Telescope current_buffer_fuzzy_find<CR>", | ||
| 103 | { desc = "telescope find in current buffer" } | ||
| 104 | ) | ||
| 113 | vim.keymap.set("n", "<leader>sf", "<cmd>Telescope find_files<cr>", { desc = "telescope find files" }) | 105 | vim.keymap.set("n", "<leader>sf", "<cmd>Telescope find_files<cr>", { desc = "telescope find files" }) |
| 114 | vim.keymap.set( | 106 | vim.keymap.set( |
| 115 | "n", | 107 | "n", |
| 116 | "<leader>sF", | 108 | "<leader>sF", |
| 117 | "<cmd>Telescope find_files follow=true no_ignore=true hidden=true<CR>", | 109 | "<cmd>Telescope find_files follow=true no_ignore=true hidden=true<CR>", |
| 118 | { desc = "telescope find all files" } | 110 | { desc = "telescope find all files" } |
| 119 | ) | 111 | ) |
| 120 | vim.keymap.set("n", "<leader>sg", "<cmd>Telescope live_grep<CR>", { desc = "telescope live grep" }) | 112 | vim.keymap.set("n", "<leader>sg", "<cmd>Telescope live_grep<CR>", { desc = "telescope live grep" }) |
| 121 | vim.keymap.set("n", "<leader>gf", "<cmd>Telescope git_files<CR>", { desc = "telescope git files" }) | 113 | vim.keymap.set("n", "<leader>gf", "<cmd>Telescope git_files<CR>", { desc = "telescope git files" }) |
| @@ -125,7 +117,7 @@ require("lazy").setup ({ | |||
| 125 | vim.keymap.set("n", "<leader>tt", "<cmd>Telescope<CR>", { desc = "telescope help page" }) | 117 | vim.keymap.set("n", "<leader>tt", "<cmd>Telescope<CR>", { desc = "telescope help page" }) |
| 126 | vim.keymap.set("n", "<leader>sk", "<cmd>Telescope keymaps<CR>", { desc = "telescope keymaps" }) | 118 | vim.keymap.set("n", "<leader>sk", "<cmd>Telescope keymaps<CR>", { desc = "telescope keymaps" }) |
| 127 | vim.keymap.set("n", "<leader>pt", "<cmd>Telescope terms<CR>", { desc = "telescope pick hidden term" }) | 119 | vim.keymap.set("n", "<leader>pt", "<cmd>Telescope terms<CR>", { desc = "telescope pick hidden term" }) |
| 128 | 120 | -- | |
| 129 | vim.keymap.set("n", "<leader>ss", function() | 121 | vim.keymap.set("n", "<leader>ss", function() |
| 130 | local current_filetype = vim.bo.filetype | 122 | local current_filetype = vim.bo.filetype |
| 131 | local cwd = os.getenv("HOME") .. "/snippets" | 123 | local cwd = os.getenv("HOME") .. "/snippets" |
| @@ -139,11 +131,12 @@ require("lazy").setup ({ | |||
| 139 | if file_list then | 131 | if file_list then |
| 140 | return file_list[1] | 132 | return file_list[1] |
| 141 | else | 133 | else |
| 142 | local current_picker = require("telescope.actions.state").get_current_picker(prompt_bufnr) | 134 | local current_picker = |
| 135 | require("telescope.actions.state").get_current_picker(prompt_bufnr) | ||
| 143 | return current_picker:_get_prompt() | 136 | return current_picker:_get_prompt() |
| 144 | end | 137 | end |
| 145 | end | 138 | end |
| 146 | 139 | -- | |
| 147 | local edit_snippet = function() | 140 | local edit_snippet = function() |
| 148 | local file = get_prompt_or_entry() | 141 | local file = get_prompt_or_entry() |
| 149 | require("telescope.actions").close(prompt_bufnr) | 142 | require("telescope.actions").close(prompt_bufnr) |
| @@ -154,7 +147,7 @@ require("lazy").setup ({ | |||
| 154 | vim.bo.bufhidden = "wipe" | 147 | vim.bo.bufhidden = "wipe" |
| 155 | vim.cmd("set filetype?") | 148 | vim.cmd("set filetype?") |
| 156 | end | 149 | end |
| 157 | 150 | -- | |
| 158 | local insert_selected_snippet = function() | 151 | local insert_selected_snippet = function() |
| 159 | local file = get_prompt_or_entry() | 152 | local file = get_prompt_or_entry() |
| 160 | local path = cwd .. "/" .. file | 153 | local path = cwd .. "/" .. file |
| @@ -167,16 +160,16 @@ require("lazy").setup ({ | |||
| 167 | edit_snippet() | 160 | edit_snippet() |
| 168 | end | 161 | end |
| 169 | end | 162 | end |
| 170 | 163 | -- | |
| 171 | map("i", "<CR>", insert_selected_snippet) | 164 | map("i", "<CR>", insert_selected_snippet) |
| 172 | map("i", "<C-T>", edit_snippet) | 165 | map("i", "<C-T>", edit_snippet) |
| 173 | map("n", "<CR>", insert_selected_snippet) | 166 | map("n", "<CR>", insert_selected_snippet) |
| 174 | 167 | -- | |
| 175 | return true | 168 | return true |
| 176 | end, | 169 | end, |
| 177 | }) | 170 | }) |
| 178 | end, { desc = "[S]earch [S]nippets" }) | 171 | end, { desc = "[S]earch [S]nippets" }) |
| 179 | 172 | -- | |
| 180 | vim.keymap.set("n", "<leader>sd", function() | 173 | vim.keymap.set("n", "<leader>sd", function() |
| 181 | require("telescope.builtin").oldfiles({ | 174 | require("telescope.builtin").oldfiles({ |
| 182 | prompt_title = "CD to", | 175 | prompt_title = "CD to", |
| @@ -187,14 +180,15 @@ require("lazy").setup ({ | |||
| 187 | require("telescope.actions").close(prompt_bufnr) | 180 | require("telescope.actions").close(prompt_bufnr) |
| 188 | vim.api.nvim_feedkeys(":cd " .. path, "n", true) | 181 | vim.api.nvim_feedkeys(":cd " .. path, "n", true) |
| 189 | end | 182 | end |
| 190 | 183 | -- | |
| 191 | map("i", "<CR>", cd_prompt) | 184 | map("i", "<CR>", cd_prompt) |
| 192 | map("n", "<CR>", cd_prompt) | 185 | map("n", "<CR>", cd_prompt) |
| 193 | 186 | -- | |
| 194 | return true | 187 | return true |
| 195 | end, | 188 | end, |
| 196 | }) | 189 | }) |
| 197 | end, { desc = "Search Directory" })-- }}} | 190 | end, { desc = "Search Directory" }) |
| 191 | -- }}} | ||
| 198 | end, | 192 | end, |
| 199 | }, | 193 | }, |
| 200 | -- }}} | 194 | -- }}} |
| @@ -203,7 +197,7 @@ require("lazy").setup ({ | |||
| 203 | "nvim-tree/nvim-tree.lua", | 197 | "nvim-tree/nvim-tree.lua", |
| 204 | config = function() | 198 | config = function() |
| 205 | -- config {{{ | 199 | -- config {{{ |
| 206 | require("nvim-tree").setup { | 200 | require("nvim-tree").setup({ |
| 207 | filters = { | 201 | filters = { |
| 208 | dotfiles = false, | 202 | dotfiles = false, |
| 209 | }, | 203 | }, |
| @@ -219,7 +213,7 @@ require("lazy").setup ({ | |||
| 219 | view = { | 213 | view = { |
| 220 | adaptive_size = false, | 214 | adaptive_size = false, |
| 221 | side = "left", | 215 | side = "left", |
| 222 | width = 30, | 216 | width = 26, |
| 223 | preserve_window_proportions = true, | 217 | preserve_window_proportions = true, |
| 224 | }, | 218 | }, |
| 225 | git = { | 219 | git = { |
| @@ -238,11 +232,11 @@ require("lazy").setup ({ | |||
| 238 | root_folder_label = false, | 232 | root_folder_label = false, |
| 239 | highlight_git = true, | 233 | highlight_git = true, |
| 240 | highlight_opened_files = "none", | 234 | highlight_opened_files = "none", |
| 241 | 235 | -- | |
| 242 | indent_markers = { | 236 | indent_markers = { |
| 243 | enable = true, | 237 | enable = true, |
| 244 | }, | 238 | }, |
| 245 | 239 | -- | |
| 246 | icons = { | 240 | icons = { |
| 247 | show = { | 241 | show = { |
| 248 | file = true, | 242 | file = true, |
| @@ -250,7 +244,7 @@ require("lazy").setup ({ | |||
| 250 | folder_arrow = true, | 244 | folder_arrow = true, |
| 251 | git = true, | 245 | git = true, |
| 252 | }, | 246 | }, |
| 253 | 247 | -- | |
| 254 | glyphs = { | 248 | glyphs = { |
| 255 | default = "", | 249 | default = "", |
| 256 | symlink = "", | 250 | symlink = "", |
| @@ -276,21 +270,11 @@ require("lazy").setup ({ | |||
| 276 | }, | 270 | }, |
| 277 | }, | 271 | }, |
| 278 | }, | 272 | }, |
| 279 | } | 273 | }) |
| 280 | -- }}} | 274 | -- }}} |
| 281 | -- keymaps {{{ | 275 | -- keymaps {{{ |
| 282 | vim.keymap.set( | 276 | vim.keymap.set("n", "<C-n>", "<cmd>NvimTreeToggle<CR>", { desc = "nvimtree toggle window" }) |
| 283 | "n", | 277 | vim.keymap.set("n", "<leader>e", "<cmd>NvimTreeFocus<CR>", { desc = "nvimtree focus window" }) |
| 284 | "<C-n>", | ||
| 285 | "<cmd>NvimTreeToggle<CR>", | ||
| 286 | { desc = "nvimtree toggle window" } | ||
| 287 | ) | ||
| 288 | vim.keymap.set( | ||
| 289 | "n", | ||
| 290 | "<leader>e", | ||
| 291 | "<cmd>NvimTreeFocus<CR>", | ||
| 292 | { desc = "nvimtree focus window" } | ||
| 293 | ) | ||
| 294 | -- }}} | 278 | -- }}} |
| 295 | end, | 279 | end, |
| 296 | }, | 280 | }, |
| @@ -300,7 +284,7 @@ require("lazy").setup ({ | |||
| 300 | "folke/which-key.nvim", | 284 | "folke/which-key.nvim", |
| 301 | lazy = false, | 285 | lazy = false, |
| 302 | config = function() | 286 | config = function() |
| 303 | require('which-key').setup { | 287 | require("which-key").setup({ |
| 304 | defaults = { | 288 | defaults = { |
| 305 | win = { | 289 | win = { |
| 306 | -- don't allow the popup to overlap with the cursor | 290 | -- don't allow the popup to overlap with the cursor |
| @@ -320,8 +304,8 @@ require("lazy").setup ({ | |||
| 320 | -- winblend = 10, -- value between 0-100 0 for fully opaque and 100 for fully transparent | 304 | -- winblend = 10, -- value between 0-100 0 for fully opaque and 100 for fully transparent |
| 321 | }, | 305 | }, |
| 322 | }, | 306 | }, |
| 323 | } | 307 | }, |
| 324 | } | 308 | }) |
| 325 | end, | 309 | end, |
| 326 | }, | 310 | }, |
| 327 | -- }}} | 311 | -- }}} |
| @@ -330,7 +314,7 @@ require("lazy").setup ({ | |||
| 330 | "iberianpig/tig-explorer.vim", | 314 | "iberianpig/tig-explorer.vim", |
| 331 | dependencies = { "rbgrouleff/bclose.vim" }, | 315 | dependencies = { "rbgrouleff/bclose.vim" }, |
| 332 | config = function() | 316 | config = function() |
| 333 | vim.cmd('nunmap <leader>bd') | 317 | vim.cmd("nunmap <leader>bd") |
| 334 | end, | 318 | end, |
| 335 | }, | 319 | }, |
| 336 | --}}} | 320 | --}}} |
| @@ -338,103 +322,289 @@ require("lazy").setup ({ | |||
| 338 | { | 322 | { |
| 339 | "akinsho/toggleterm.nvim", | 323 | "akinsho/toggleterm.nvim", |
| 340 | config = function() | 324 | config = function() |
| 341 | require("toggleterm").setup { | 325 | require("toggleterm").setup({ |
| 342 | persist_size = false, | 326 | persist_size = false, |
| 343 | direction = 'float', | 327 | direction = "float", |
| 344 | } | 328 | }) |
| 345 | 329 | -- | |
| 346 | vim.keymap.set({ "n", "t" }, "<A-i>", function() vim.cmd("ToggleTerm direction=float") end, { desc = "terminal toggle floating term" }) | 330 | vim.keymap.set({ "n", "t" }, "<A-i>", function() |
| 347 | vim.keymap.set({ "n", "t" }, "<A-v>", function() vim.cmd("ToggleTerm direction=horizontal") end, { desc = "terminal toggle floating term" }) | 331 | vim.cmd("ToggleTerm direction=float") |
| 332 | end, { desc = "terminal toggle floating term" }) | ||
| 333 | vim.keymap.set({ "n", "t" }, "<A-v>", function() | ||
| 334 | vim.cmd("ToggleTerm direction=horizontal") | ||
| 335 | end, { desc = "terminal toggle floating term" }) | ||
| 348 | end, | 336 | end, |
| 349 | }, | 337 | }, |
| 350 | --}}} | 338 | --}}} |
| 351 | -- Nvchad {{{ | ||
| 352 | { | ||
| 353 | "NvChad/NvChad", | ||
| 354 | lazy = false, | ||
| 355 | branch = "v2.5", | ||
| 356 | dependencies = { | ||
| 357 | "Nvchad/base46", | ||
| 358 | "Nvchad/ui", | ||
| 359 | } | ||
| 360 | }, | ||
| 361 | -- }}} | ||
| 362 | -- nvim-cmp {{{ | ||
| 363 | { | ||
| 364 | "hrsh7th/nvim-cmp", | ||
| 365 | event = "InsertEnter", | ||
| 366 | dependencies = { | ||
| 367 | { | ||
| 368 | -- snippet plugin | ||
| 369 | "L3MON4D3/LuaSnip", | ||
| 370 | dependencies = "rafamadriz/friendly-snippets", | ||
| 371 | opts = { history = true, updateevents = "TextChanged,TextChangedI" }, | ||
| 372 | config = function(_, opts) | ||
| 373 | require("luasnip").config.set_config(opts) | ||
| 374 | require "nvchad.configs.luasnip" | ||
| 375 | end, | ||
| 376 | }, | ||
| 377 | 339 | ||
| 378 | -- cmp sources plugins | 340 | -- -- lspconfig {{{ |
| 379 | { | 341 | -- -- Use :help lspconfig-all to check servers |
| 380 | "saadparwaiz1/cmp_luasnip", | 342 | -- { |
| 381 | "hrsh7th/cmp-nvim-lua", | 343 | -- "neovim/nvim-lspconfig", |
| 382 | "hrsh7th/cmp-nvim-lsp", | 344 | -- lazy = false, |
| 383 | "hrsh7th/cmp-buffer", | 345 | -- config = function() |
| 384 | "hrsh7th/cmp-path", | 346 | -- local lspconfig = require "lspconfig" |
| 385 | }, | 347 | -- -- |
| 386 | }, | 348 | -- -- typescript |
| 387 | opts = function() | 349 | -- lspconfig.lua_ls.setup {} |
| 388 | return require "nvchad.configs.cmp" | 350 | -- lspconfig.tsserver.setup {} |
| 389 | end, | 351 | -- lspconfig.vimls.setup {} |
| 390 | config = function(_, opts) | 352 | -- lspconfig.html.setup {} |
| 391 | require("cmp").setup(opts) | 353 | -- -- |
| 392 | end, | 354 | -- vim.keymap.set("n", "<leader>F", function() |
| 393 | }, | 355 | -- vim.lsp.buf.format() |
| 394 | -- }}} | 356 | -- end, { desc = "format files" }) |
| 357 | -- end, | ||
| 358 | -- }, | ||
| 359 | -- -- }}} | ||
| 360 | -- -- Mason {{{ | ||
| 361 | -- { | ||
| 362 | -- "williamboman/mason.nvim", | ||
| 363 | -- config = function() | ||
| 364 | -- require('mason').setup { | ||
| 365 | -- automatically_installation = true, | ||
| 366 | -- ensure_installed = { | ||
| 367 | -- "vim-language-server", | ||
| 368 | -- "lua-language-server", | ||
| 369 | -- "css-lsp", | ||
| 370 | -- "html-lsp", | ||
| 371 | -- "prettier", | ||
| 372 | -- "stylua", | ||
| 373 | -- }, | ||
| 374 | -- } | ||
| 375 | -- end | ||
| 376 | -- }, | ||
| 377 | -- -- }}} | ||
| 378 | -- -- treesitter {{{ | ||
| 379 | -- { | ||
| 380 | -- "nvim-treesitter/nvim-treesitter", | ||
| 381 | -- event = { "BufReadPost", "BufNewFile" }, | ||
| 382 | -- cmd = { "TSInstall", "TSBufEnable", "TSBufDisable", "TSModuleInfo" }, | ||
| 383 | -- build = ":TSUpdate", | ||
| 384 | -- config = function() | ||
| 385 | -- require("nvim-treesitter.configs").setup({ | ||
| 386 | -- ensure_installed = { "lua", "luadoc", "printf", "vim", "vimdoc" }, | ||
| 387 | -- -- | ||
| 388 | -- highlight = { | ||
| 389 | -- enable = true, | ||
| 390 | -- use_languagetree = true, | ||
| 391 | -- }, | ||
| 392 | -- -- | ||
| 393 | -- indent = { enable = true }, | ||
| 394 | -- }) | ||
| 395 | -- end, | ||
| 396 | -- }, | ||
| 397 | -- -- }}} | ||
| 398 | -- -- nvim-cmp {{{ | ||
| 399 | -- { | ||
| 400 | -- "hrsh7th/nvim-cmp", | ||
| 401 | -- event = { | ||
| 402 | -- "InsertEnter", | ||
| 403 | -- "CmdlineEnter" | ||
| 404 | -- }, | ||
| 405 | -- dependencies = { -- {{{ | ||
| 406 | -- { | ||
| 407 | -- -- snippet plugin | ||
| 408 | -- "L3MON4D3/LuaSnip", | ||
| 409 | -- build = "make install_jsregexp", | ||
| 410 | -- dependencies = { | ||
| 411 | -- "rafamadriz/friendly-snippets", | ||
| 412 | -- "saadparwaiz1/cmp_luasnip", | ||
| 413 | -- "onsails/lspkind-nvim", | ||
| 414 | -- }, | ||
| 415 | -- opts = { | ||
| 416 | -- history = true, | ||
| 417 | -- updateevents = "TextChanged,TextChangedI" | ||
| 418 | -- }, | ||
| 419 | -- config = function(_, opts) | ||
| 420 | -- require("luasnip").config.set_config(opts) | ||
| 421 | -- require("luasnip.loaders.from_vscode").lazy_load() | ||
| 422 | -- require("luasnip.loaders.from_lua").load() | ||
| 423 | -- require("luasnip.loaders.from_lua").lazy_load { paths = vim.g.lua_snippets_path or "" } | ||
| 424 | -- -- | ||
| 425 | -- vim.api.nvim_create_autocmd("InsertLeave", { | ||
| 426 | -- callback = function() | ||
| 427 | -- if | ||
| 428 | -- require("luasnip").session.current_nodes[vim.api.nvim_get_current_buf()] | ||
| 429 | -- and not require("luasnip").session.jump_active | ||
| 430 | -- then | ||
| 431 | -- require("luasnip").unlink_current() | ||
| 432 | -- end | ||
| 433 | -- end, | ||
| 434 | -- }) | ||
| 435 | -- end, | ||
| 436 | -- }, | ||
| 437 | -- -- | ||
| 438 | -- -- cmp sources plugins | ||
| 439 | -- { | ||
| 440 | -- "hrsh7th/cmp-nvim-lua", | ||
| 441 | -- "hrsh7th/cmp-nvim-lsp", | ||
| 442 | -- "hrsh7th/cmp-buffer", | ||
| 443 | -- "hrsh7th/cmp-path", | ||
| 444 | -- "hrsh7th/cmp-cmdline", | ||
| 445 | -- }, | ||
| 446 | -- }, -- }}} | ||
| 447 | -- config = function() | ||
| 448 | -- local cmp = require "cmp" | ||
| 449 | -- local default_mapping = { | ||
| 450 | -- ["<S-TAB>"] = cmp.mapping.select_prev_item(), | ||
| 451 | -- ["<TAB>"] = cmp.mapping.select_next_item(), | ||
| 452 | -- ["<C-p>"] = cmp.mapping.select_prev_item(), | ||
| 453 | -- ["<C-n>"] = cmp.mapping.select_next_item(), | ||
| 454 | -- ["<C-d>"] = cmp.mapping.scroll_docs(-4), | ||
| 455 | -- ["<C-f>"] = cmp.mapping.scroll_docs(4), | ||
| 456 | -- ["<C-Space>"] = cmp.mapping.complete(), | ||
| 457 | -- ["<C-e>"] = cmp.mapping.close(), | ||
| 458 | -- ['<CR>'] = cmp.mapping.confirm(), | ||
| 459 | -- ['<C-c>'] = cmp.mapping.abort(), | ||
| 460 | -- } | ||
| 461 | -- | ||
| 462 | -- require("cmp").setup({ | ||
| 463 | -- completion = { | ||
| 464 | -- completeopt = "menu,menuone,noselect", | ||
| 465 | -- }, | ||
| 466 | -- window = { | ||
| 467 | -- documentation = cmp.config.window.bordered(), | ||
| 468 | -- completion = cmp.config.window.bordered({ | ||
| 469 | -- winhighlight = 'Normal:CmpPmenu,CursorLine:PmenuSel,Search:None' | ||
| 470 | -- }), | ||
| 471 | -- }, | ||
| 472 | -- snippet = { | ||
| 473 | -- expand = function(args) | ||
| 474 | -- require("luasnip").lsp_expand(args.body) | ||
| 475 | -- end, | ||
| 476 | -- }, | ||
| 477 | -- formatting = { | ||
| 478 | -- format = require('lspkind').cmp_format({ | ||
| 479 | -- with_text = true, -- do not show text alongside icons | ||
| 480 | -- maxwidth = 50, -- prevent the popup from showing more than provided characters (e.g 50 will not show more than 50 characters) | ||
| 481 | -- before = function(entry, vim_item) | ||
| 482 | -- -- Source 显示提示来源 | ||
| 483 | -- vim_item.menu = '<' .. entry.source.name .. '>' | ||
| 484 | -- return vim_item | ||
| 485 | -- end | ||
| 486 | -- }) | ||
| 487 | -- }, | ||
| 488 | -- mapping = default_mapping, | ||
| 489 | -- sources = cmp.config.sources { | ||
| 490 | -- { name = "nvim_lsp" }, | ||
| 491 | -- { name = "luasnip" }, | ||
| 492 | -- { name = "buffer" }, | ||
| 493 | -- { name = "nvim_lua" }, | ||
| 494 | -- { name = "path" }, | ||
| 495 | -- }, | ||
| 496 | -- experimental = { | ||
| 497 | -- ghost_text = true, | ||
| 498 | -- } | ||
| 499 | -- }) | ||
| 500 | -- cmp.setup.cmdline(':', { | ||
| 501 | -- mapping = cmp.mapping.preset.cmdline { | ||
| 502 | -- ['<C-n>'] = cmp.config.disable, | ||
| 503 | -- ['<C-p>'] = cmp.config.disable, | ||
| 504 | -- ['<C-c>'] = cmp.mapping.abort(), | ||
| 505 | -- }, | ||
| 506 | -- sources = cmp.config.sources( | ||
| 507 | -- { { name = 'path' } }, | ||
| 508 | -- { { name = 'cmdline' } } | ||
| 509 | -- ) | ||
| 510 | -- }) | ||
| 511 | -- cmp.setup.cmdline({ '/', '?' }, { | ||
| 512 | -- mapping = cmp.mapping.preset.cmdline { | ||
| 513 | -- ['<C-n>'] = cmp.config.disable, | ||
| 514 | -- ['<C-p>'] = cmp.config.disable, | ||
| 515 | -- ['<C-c>'] = cmp.mapping.abort(), | ||
| 516 | -- }, | ||
| 517 | -- sources = { { name = 'buffer' } } | ||
| 518 | -- }) | ||
| 519 | -- | ||
| 520 | -- vim.opt.complete = "" | ||
| 521 | -- end, | ||
| 522 | -- }, | ||
| 523 | -- | ||
| 524 | -- -- }}} | ||
| 525 | -- -- lspsaga {{{ | ||
| 526 | -- { | ||
| 527 | -- 'nvimdev/lspsaga.nvim', | ||
| 528 | -- dependencies = { | ||
| 529 | -- 'nvim-treesitter/nvim-treesitter', -- optional | ||
| 530 | -- 'nvim-tree/nvim-web-devicons', -- optional | ||
| 531 | -- }, | ||
| 532 | -- config = function() | ||
| 533 | -- require('lspsaga').setup({}) | ||
| 534 | -- end, | ||
| 535 | -- }, | ||
| 536 | -- -- }}} | ||
| 537 | -- -- conform {{{ | ||
| 538 | -- { | ||
| 539 | -- "stevearc/conform.nvim", | ||
| 540 | -- config = function(_, opts) | ||
| 541 | -- require("conform").setup({ | ||
| 542 | -- formatters_by_ft = { | ||
| 543 | -- lua = { "stylua" }, | ||
| 544 | -- sh = { "shfmt" }, | ||
| 545 | -- bash = { "shfmt" }, | ||
| 546 | -- zsh = { "shfmt" }, | ||
| 547 | -- markdown = { "prettier" }, | ||
| 548 | -- css = { "prettier" }, | ||
| 549 | -- html = { "prettier" }, | ||
| 550 | -- }, | ||
| 551 | -- }) | ||
| 552 | -- vim.keymap.set("n", "<leader>F", function() | ||
| 553 | -- require("conform").format({ lsp_fallback = true }) | ||
| 554 | -- end, { desc = "format files" }) | ||
| 555 | -- end, | ||
| 556 | -- }, | ||
| 557 | -- -- }}} | ||
| 558 | |||
| 395 | }) | 559 | }) |
| 396 | 560 | ||
| 397 | -- Install mini.nvim {{{ | 561 | -- Install mini.nvim {{{ |
| 398 | -- Put this at the top of 'init.lua' | 562 | -- Put this at the top of 'init.lua' |
| 399 | local path_package = vim.fn.stdpath('data') .. '/site' | 563 | local path_package = vim.fn.stdpath("data") .. "/site" |
| 400 | vim.o.packpath = path_package | 564 | vim.o.packpath = path_package |
| 401 | local mini_path = path_package .. '/pack/deps/start/mini.nvim' | 565 | local mini_path = path_package .. "/pack/deps/start/mini.nvim" |
| 402 | 566 | -- | |
| 403 | if not vim.loop.fs_stat(mini_path) then | 567 | if not vim.loop.fs_stat(mini_path) then |
| 404 | vim.cmd('echo "Installing `mini.nvim`" | redraw') | 568 | vim.cmd('echo "Installing `mini.nvim`" | redraw') |
| 405 | local clone_cmd = { | 569 | local clone_cmd = { |
| 406 | 'git', 'clone', '--filter=blob:none', | 570 | "git", |
| 571 | "clone", | ||
| 572 | "--filter=blob:none", | ||
| 407 | -- Uncomment next line to use 'stable' branch | 573 | -- Uncomment next line to use 'stable' branch |
| 408 | -- '--branch', 'stable', | 574 | -- '--branch', 'stable', |
| 409 | 'https://github.com/echasnovski/mini.nvim', mini_path | 575 | "https://github.com/echasnovski/mini.nvim", |
| 576 | mini_path, | ||
| 410 | } | 577 | } |
| 411 | vim.fn.system(clone_cmd) | 578 | vim.fn.system(clone_cmd) |
| 412 | vim.cmd('packadd mini.nvim | helptags ALL') | 579 | vim.cmd("packadd mini.nvim | helptags ALL") |
| 413 | end | 580 | end |
| 414 | 581 | -- | |
| 415 | -- }}} | 582 | -- }}} |
| 416 | -- mini.deps {{{ | 583 | -- mini.deps {{{ |
| 417 | require('mini.deps').setup({ | 584 | require("mini.deps").setup({ |
| 418 | path = { package = path_package } | 585 | path = { package = path_package }, |
| 419 | }) | 586 | }) |
| 420 | add, now, later = MiniDeps.add, MiniDeps.now, MiniDeps.later | 587 | Add, Now, Later = MiniDeps.add, MiniDeps.now, MiniDeps.later |
| 421 | -- }}} | 588 | -- }}} |
| 422 | -- mini.basics {{{ | 589 | -- mini.basics {{{ |
| 423 | require('mini.basics').setup() | 590 | require("mini.basics").setup() |
| 424 | -- }}} | 591 | -- }}} |
| 425 | -- mini.misc {{{ | 592 | -- mini.misc {{{ |
| 426 | require('mini.misc').setup({ | 593 | require("mini.misc").setup({ |
| 427 | make_global = { 'put', 'put_text', 'zoom'} | 594 | make_global = { "put", "put_text", "zoom" }, |
| 428 | }) --}}} | 595 | }) |
| 596 | --}}} | ||
| 429 | -- mini.extra {{{ | 597 | -- mini.extra {{{ |
| 430 | require('mini.extra').setup() | 598 | require("mini.extra").setup() |
| 431 | -- }}} | 599 | -- }}} |
| 432 | -- mini.colors {{{ | 600 | -- mini.colors {{{ |
| 433 | require('mini.colors').setup() | 601 | require("mini.colors").setup() |
| 434 | vim.keymap.set( 'n', '<leader><leader>co', function() require('mini.colors').interactive() end) | 602 | vim.keymap.set("n", "<leader><leader>co", function() |
| 603 | require("mini.colors").interactive() | ||
| 604 | end) | ||
| 435 | -- }}} | 605 | -- }}} |
| 436 | -- mini.base16 {{{ | 606 | -- mini.base16 {{{ |
| 437 | require('mini.base16').setup({ | 607 | require("mini.base16").setup({ |
| 438 | palette = { | 608 | palette = { |
| 439 | -- Default Background | 609 | -- Default Background |
| 440 | base00 = "#2d2a2e", | 610 | base00 = "#2d2a2e", |
| @@ -471,160 +641,162 @@ require('mini.base16').setup({ | |||
| 471 | }, | 641 | }, |
| 472 | use_cterm = false, | 642 | use_cterm = false, |
| 473 | }) | 643 | }) |
| 474 | 644 | -- | |
| 475 | -- Override settings for search | 645 | -- Override settings for search |
| 476 | vim.cmd('hi Search guibg=#e5c07b') | 646 | vim.cmd("hi Search guibg=#e5c07b") |
| 477 | 647 | -- | |
| 478 | -- Resume terminal color | 648 | -- Resume terminal color |
| 479 | for i = 1, 15, 1 do | 649 | for i = 1, 15, 1 do |
| 480 | vim.cmd("let terminal_color_"..i.." = ''") | 650 | vim.cmd("let terminal_color_" .. i .. " = ''") |
| 481 | end | 651 | end |
| 482 | 652 | -- | |
| 483 | -- Override settings for bufferline | 653 | -- Override settings for bufferline |
| 484 | vim.cmd('hi BufferLineTabSelected guibg=#f85e84') | 654 | vim.cmd("hi BufferLineTabSelected guibg=#f85e84") |
| 485 | vim.cmd('hi BufferLineTab guibg=Gray') | 655 | vim.cmd("hi BufferLineTab guibg=Gray") |
| 486 | 656 | -- | |
| 487 | --}}} | 657 | --}}} |
| 488 | -- mini.icons {{{ | 658 | -- mini.icons {{{ |
| 489 | require('mini.icons').setup({ | 659 | require("mini.icons").setup({}) |
| 490 | }) --}}} | 660 | --}}} |
| 491 | -- mini.statusline {{{ | 661 | -- mini.statusline {{{ |
| 492 | 662 | -- | |
| 493 | require('mini.statusline').setup({ | 663 | require("mini.statusline").setup({ |
| 494 | content = { | 664 | content = { |
| 495 | active = status_config | 665 | active = status_config, |
| 496 | }, | 666 | }, |
| 497 | }) | 667 | }) |
| 498 | function diagnostics_table(args) | 668 | local function diagnostics_table(args) |
| 499 | local info = vim.b.coc_diagnostic_info | 669 | local info = vim.b.coc_diagnostic_info |
| 500 | if MiniStatusline.is_truncated(args.trunc_width) or info == nil then | 670 | if MiniStatusline.is_truncated(args.trunc_width) or info == nil then |
| 501 | return {} | 671 | return {} |
| 502 | end | 672 | end |
| 503 | local table = {} | 673 | local table = {} |
| 504 | table.e = (info['error'] or 0) > 0 and 'E'..info['error'] or '' | 674 | table.e = (info["error"] or 0) > 0 and "E" .. info["error"] or "" |
| 505 | table.w = (info['warning'] or 0) > 0 and 'W'..info['warning'] or '' | 675 | table.w = (info["warning"] or 0) > 0 and "W" .. info["warning"] or "" |
| 506 | table.h = (info['hint'] or 0) > 0 and 'H'..info['hint'] or '' | 676 | table.h = (info["hint"] or 0) > 0 and "H" .. info["hint"] or "" |
| 507 | table.i = (info['information'] or 0) > 0 and 'I'..info['information'] or '' | 677 | table.i = (info["information"] or 0) > 0 and "I" .. info["information"] or "" |
| 508 | table.s = vim.g.coc_status | 678 | table.s = vim.g.coc_status |
| 509 | return table | 679 | return table |
| 510 | end | 680 | end |
| 681 | -- | ||
| 511 | function status_config() | 682 | function status_config() |
| 512 | local mode, mode_hl = MiniStatusline.section_mode({ trunc_width = 120 }) | 683 | local mode, mode_hl = MiniStatusline.section_mode({ trunc_width = 120 }) |
| 513 | local git = MiniStatusline.section_git({ trunc_width = 75 }) | 684 | local git = MiniStatusline.section_git({ trunc_width = 75 }) |
| 514 | local diagnostics = diagnostics_table({ trunc_width = 75 }) | 685 | local diagnostics = diagnostics_table({ trunc_width = 75 }) |
| 515 | local filename = MiniStatusline.section_filename({ trunc_width = 140 }) | 686 | local filename = MiniStatusline.section_filename({ trunc_width = 140 }) |
| 516 | local fileinfo = MiniStatusline.section_fileinfo({ trunc_width = 120 }) | 687 | local fileinfo = MiniStatusline.section_fileinfo({ trunc_width = 120 }) |
| 517 | local location = MiniStatusline.section_location({ trunc_width = 75 }) | 688 | local location = MiniStatusline.section_location({ trunc_width = 75 }) |
| 518 | 689 | -- | |
| 519 | return MiniStatusline.combine_groups({ | 690 | return MiniStatusline.combine_groups({ |
| 520 | { hl = mode_hl, strings = { mode } }, | 691 | { hl = mode_hl, strings = { mode } }, |
| 521 | { hl = 'MiniStatuslineDevinfo', strings = { git, diagnostics['s'] } }, | 692 | { hl = "MiniStatuslineDevinfo", strings = { git, diagnostics["s"] } }, |
| 522 | { hl = 'MiniStatuslineError', strings = { diagnostics['e'] } }, | 693 | { hl = "MiniStatuslineError", strings = { diagnostics["e"] } }, |
| 523 | { hl = 'MiniStatuslineWarning', strings = { diagnostics['w'] } }, | 694 | { hl = "MiniStatuslineWarning", strings = { diagnostics["w"] } }, |
| 524 | { hl = 'MiniStatuslineInfo', strings = { diagnostics['i'] } }, | 695 | { hl = "MiniStatuslineInfo", strings = { diagnostics["i"] } }, |
| 525 | { hl = 'MiniStatuslineHint', strings = { diagnostics['h'] } }, | 696 | { hl = "MiniStatuslineHint", strings = { diagnostics["h"] } }, |
| 526 | '%<', -- Mark general truncate point | 697 | "%<", -- Mark general truncate point |
| 527 | { hl = 'MiniStatuslineFilename', strings = { filename } }, | 698 | { hl = "MiniStatuslineFilename", strings = { filename } }, |
| 528 | '%=', -- End left alignment | 699 | "%=", -- End left alignment |
| 529 | { hl = 'MiniStatuslineFileinfo', strings = { fileinfo } }, | 700 | { hl = "MiniStatuslineFileinfo", strings = { fileinfo } }, |
| 530 | { hl = mode_hl, strings = { location } }, | 701 | { hl = mode_hl, strings = { location } }, |
| 531 | }) | 702 | }) |
| 532 | end | 703 | end |
| 533 | 704 | ||
| 705 | -- | ||
| 534 | -- }}} | 706 | -- }}} |
| 535 | -- mini.comment {{{ | 707 | -- mini.comment {{{ |
| 536 | require('mini.comment').setup({ | 708 | require("mini.comment").setup({ |
| 537 | -- Module mappings. Use `''` (empty string) to disable one. | 709 | -- Module mappings. Use `''` (empty string) to disable one. |
| 538 | mappings = { | 710 | mappings = { |
| 539 | -- Toggle comment (like `gcip` - comment inner paragraph) for both | 711 | -- Toggle comment (like `gcip` - comment inner paragraph) for both |
| 540 | -- Normal and Visual modes | 712 | -- Normal and Visual modes |
| 541 | comment = 'gc', | 713 | comment = "gc", |
| 542 | 714 | -- | |
| 543 | -- Toggle comment on current line | 715 | -- Toggle comment on current line |
| 544 | comment_line = '<C-/>', | 716 | comment_line = "<C-/>", |
| 545 | 717 | -- | |
| 546 | -- Toggle comment on visual selection | 718 | -- Toggle comment on visual selection |
| 547 | comment_visual = '<C-/>', | 719 | comment_visual = "<C-/>", |
| 548 | 720 | -- | |
| 549 | -- Define 'comment' textobject (like `dgc` - delete whole comment block) | 721 | -- Define 'comment' textobject (like `dgc` - delete whole comment block) |
| 550 | -- Works also in Visual mode if mapping differs from `comment_visual` | 722 | -- Works also in Visual mode if mapping differs from `comment_visual` |
| 551 | textobject = 'gc', | 723 | textobject = "gc", |
| 552 | }, | 724 | }, |
| 553 | })-- }}} | 725 | }) -- }}} |
| 554 | -- mini.cursorword {{{ | 726 | -- mini.cursorword {{{ |
| 555 | require('mini.cursorword').setup() | 727 | require("mini.cursorword").setup() |
| 556 | -- }}} | 728 | -- }}} |
| 557 | -- mini.diff {{{ | 729 | -- mini.diff {{{ |
| 558 | require('mini.diff').setup({ | 730 | require("mini.diff").setup({ |
| 559 | -- Options for how hunks are visualized | 731 | -- Options for how hunks are visualized |
| 560 | view = { | 732 | view = { |
| 561 | -- Visualization style. Possible values are 'sign' and 'number'. | 733 | -- Visualization style. Possible values are 'sign' and 'number'. |
| 562 | -- Default: 'number' if line numbers are enabled, 'sign' otherwise. | 734 | -- Default: 'number' if line numbers are enabled, 'sign' otherwise. |
| 563 | style = 'sign', | 735 | style = "sign", |
| 564 | 736 | -- | |
| 565 | -- Signs used for hunks with 'sign' view | 737 | -- Signs used for hunks with 'sign' view |
| 566 | signs = { add = '+', change = '▒', delete = '-' }, | 738 | signs = { add = "+", change = "▒", delete = "-" }, |
| 567 | 739 | -- | |
| 568 | -- Priority of used visualization extmarks | 740 | -- Priority of used visualization extmarks |
| 569 | priority = 199, | 741 | priority = 199, |
| 570 | }, | 742 | }, |
| 571 | }) | 743 | }) |
| 572 | 744 | -- | |
| 573 | vim.keymap.set( 'n', '\\gh', function() | 745 | vim.keymap.set("n", "\\gh", function() |
| 574 | MiniDiff.toggle_overlay() | 746 | MiniDiff.toggle_overlay() |
| 575 | end, | 747 | end, { buffer = bufnr, desc = "Toggle diff" }) |
| 576 | { buffer = bufnr, desc = 'Toggle diff' } | 748 | -- |
| 577 | ) | ||
| 578 | |||
| 579 | -- }}} | 749 | -- }}} |
| 580 | -- mini.map {{{ | 750 | -- mini.map {{{ |
| 581 | require('mini.map').setup() | 751 | require("mini.map").setup() |
| 582 | vim.keymap.set( 'n', '\\m', function() require('mini.map').toggle() end, { desc = 'Minimap', buffer = bufnr, desc = '' }) | 752 | vim.keymap.set("n", "\\m", function() |
| 753 | require("mini.map").toggle() | ||
| 754 | end, { desc = "Minimap", buffer = bufnr }) | ||
| 583 | -- }}} | 755 | -- }}} |
| 584 | -- mini.visits {{{ | 756 | -- mini.visits {{{ |
| 585 | require('mini.visits').setup() | 757 | require("mini.visits").setup() |
| 586 | vim.keymap.set( 'n', '<leader><leader>li', function() | 758 | -- vim.keymap.set("n", "<leader><leader>li", function() |
| 587 | MiniVisits.list_paths() | 759 | -- MiniVisits.list_paths() |
| 588 | end, | 760 | -- end, { buffer = bufnr, desc = "" }) |
| 589 | { buffer = bufnr, desc = '' } | ||
| 590 | ) | ||
| 591 | -- }}} | 761 | -- }}} |
| 592 | -- mini.surround {{{ | 762 | -- mini.surround {{{ |
| 593 | require('mini.surround').setup { | 763 | require("mini.surround").setup({ |
| 594 | mappings = { | 764 | mappings = { |
| 595 | add = 's' | 765 | add = "s", |
| 596 | } | 766 | }, |
| 597 | } | 767 | }) |
| 598 | -- }}} | 768 | -- }}} |
| 599 | -- mini.indentscope {{{ | 769 | -- mini.indentscope {{{ |
| 600 | require('mini.indentscope').setup() | 770 | require("mini.indentscope").setup() |
| 601 | -- }}} | 771 | -- }}} |
| 602 | -- mini.splitjoin {{{ | 772 | -- mini.splitjoin {{{ |
| 603 | require('mini.splitjoin').setup() | 773 | require("mini.splitjoin").setup() |
| 604 | -- }}} | 774 | -- }}} |
| 605 | -- mini.move {{{ | 775 | -- mini.move {{{ |
| 606 | require('mini.move').setup() | 776 | require("mini.move").setup() |
| 607 | -- }}} | 777 | -- }}} |
| 608 | -- mini.hipatterns {{{ | 778 | -- mini.hipatterns {{{ |
| 609 | 779 | -- | |
| 610 | local hipatterns = require('mini.hipatterns') | 780 | local hipatterns = require("mini.hipatterns") |
| 611 | hipatterns.setup({ | 781 | hipatterns.setup({ |
| 612 | highlighters = { | 782 | highlighters = { |
| 613 | -- Highlight standalone 'FIXME', 'HACK', 'TODO', 'NOTE' | 783 | -- Highlight standalone 'FIXME', 'HACK', 'TODO', 'NOTE' |
| 614 | fixme = { pattern = '%f[%w]()FIXME()%f[%W]', group = 'MiniHipatternsFixme' }, | 784 | fixme = { pattern = "%f[%w]()FIXME()%f[%W]", group = "MiniHipatternsFixme" }, |
| 615 | hack = { pattern = '%f[%w]()HACK()%f[%W]', group = 'MiniHipatternsHack' }, | 785 | hack = { pattern = "%f[%w]()HACK()%f[%W]", group = "MiniHipatternsHack" }, |
| 616 | todo = { pattern = '%f[%w]()TODO()%f[%W]', group = 'MiniHipatternsTodo' }, | 786 | todo = { pattern = "%f[%w]()TODO()%f[%W]", group = "MiniHipatternsTodo" }, |
| 617 | note = { pattern = '%f[%w]()NOTE()%f[%W]', group = 'MiniHipatternsNote' }, | 787 | note = { pattern = "%f[%w]()NOTE()%f[%W]", group = "MiniHipatternsNote" }, |
| 618 | 788 | -- | |
| 619 | -- Highlight hex color strings (`#rrggbb`) using that color | 789 | -- Highlight hex color strings (`#rrggbb`) using that color |
| 620 | hex_color = hipatterns.gen_highlighter.hex_color(), | 790 | hex_color = hipatterns.gen_highlighter.hex_color(), |
| 621 | }, | 791 | }, |
| 622 | }) | 792 | }) |
| 623 | vim.keymap.set( 'n', '<leader><leader>hi', function()MiniHipatterns.toggle() end, { buffer = bufnr, desc = 'Toggle hex color highlight' }) | 793 | vim.keymap.set("n", "<leader><leader>hi", function() |
| 624 | 794 | MiniHipatterns.toggle() | |
| 795 | end, { buffer = bufnr, desc = "Toggle hex color highlight" }) | ||
| 796 | -- | ||
| 625 | -- }}} | 797 | -- }}} |
| 626 | -- mini.pairs {{{ | 798 | -- mini.pairs {{{ |
| 627 | require('mini.pairs').setup() | 799 | require("mini.pairs").setup() |
| 628 | -- }}} | 800 | -- }}} |
| 629 | -- -- mini.completion {{{ | 801 | -- -- mini.completion {{{ |
| 630 | -- require('mini.completion').setup() | 802 | -- require('mini.completion').setup() |
| @@ -700,46 +872,46 @@ require('mini.pairs').setup() | |||
| 700 | -- -- suda {{{ | 872 | -- -- suda {{{ |
| 701 | -- add { source = "lambdalisue/suda.vim" } | 873 | -- add { source = "lambdalisue/suda.vim" } |
| 702 | -- }}} | 874 | -- }}} |
| 703 | -- true-zen {{{ | 875 | -- -- true-zen {{{ |
| 704 | add { | 876 | -- add({ |
| 705 | source = "Pocco81/true-zen.nvim", | 877 | -- source = "Pocco81/true-zen.nvim", |
| 706 | } | 878 | -- }) |
| 707 | vim.keymap.set("n", "<leader>z", ":TZAtaraxis<CR>") | 879 | -- vim.keymap.set("n", "<leader>z", ":TZAtaraxis<CR>") |
| 708 | -- }}} | 880 | -- -- }}} |
| 709 | -- bufferline {{{ | 881 | -- bufferline {{{ |
| 710 | add { | 882 | Add({ |
| 711 | source = "akinsho/bufferline.nvim", | 883 | source = "akinsho/bufferline.nvim", |
| 712 | depends = { | 884 | depends = { |
| 713 | 'nvim-tree/nvim-web-devicons', -- OPTIONAL: for file icons | 885 | "nvim-tree/nvim-web-devicons", -- OPTIONAL: for file icons |
| 714 | "tiagovla/scope.nvim", | 886 | "tiagovla/scope.nvim", |
| 715 | }, | 887 | }, |
| 716 | } | 888 | }) |
| 717 | require("bufferline").setup{ | 889 | require("bufferline").setup({ |
| 718 | options = { | 890 | options = { |
| 719 | tab_size = 14, | 891 | tab_size = 14, |
| 720 | separator_style = { '', '' }, | 892 | separator_style = { "", "" }, |
| 721 | themable = true, | 893 | themable = true, |
| 722 | buffer_close_icon = '', | 894 | buffer_close_icon = "", |
| 723 | close_icon = '', | 895 | close_icon = "", |
| 724 | groups = { | 896 | groups = { |
| 725 | items = { | 897 | items = { |
| 726 | require('bufferline.groups').builtin.pinned:with({ icon = "" }) | 898 | require("bufferline.groups").builtin.pinned:with({ icon = "" }), |
| 727 | } | 899 | }, |
| 728 | } | 900 | }, |
| 729 | }, | 901 | }, |
| 730 | } | 902 | }) |
| 731 | require("scope").setup{} | 903 | require("scope").setup({}) |
| 732 | -- keymaps {{{ | 904 | -- keymaps {{{ |
| 733 | for i = 1, 9, 1 do | 905 | for i = 1, 9, 1 do |
| 734 | vim.keymap.set("n", string.format("<A-%s>", i), function() | 906 | vim.keymap.set("n", string.format("<A-%s>", i), function() |
| 735 | vim.cmd("BufferLineGoToBuffer "..i) | 907 | vim.cmd("BufferLineGoToBuffer " .. i) |
| 736 | end, {silent = true}) | 908 | end, { silent = true }) |
| 737 | end | 909 | end |
| 738 | local opts = { noremap = true, silent = true } | 910 | local opts = { noremap = true, silent = true } |
| 739 | vim.keymap.set('n', '<TAB>', '<Cmd>BufferLineCyclePrev<CR>', opts) | 911 | vim.keymap.set("n", "<TAB>", "<Cmd>BufferLineCyclePrev<CR>", opts) |
| 740 | vim.keymap.set('n', '<S-TAB>', '<Cmd>BufferLineCycleNext<CR>', opts) | 912 | vim.keymap.set("n", "<S-TAB>", "<Cmd>BufferLineCycleNext<CR>", opts) |
| 741 | vim.keymap.set('n', '<M-h>', '<Cmd>BufferLineMovePrev<CR>', opts) | 913 | vim.keymap.set("n", "<M-h>", "<Cmd>BufferLineMovePrev<CR>", opts) |
| 742 | vim.keymap.set('n', '<M-l>', '<Cmd>BufferLineMoveNext<CR>', opts) | 914 | vim.keymap.set("n", "<M-l>", "<Cmd>BufferLineMoveNext<CR>", opts) |
| 743 | vim.keymap.set('n', '<M-p>', '<Cmd>BufferLineTogglePin<CR>', opts) | 915 | vim.keymap.set("n", "<M-p>", "<Cmd>BufferLineTogglePin<CR>", opts) |
| 744 | -- }}} | 916 | -- }}} |
| 745 | -- }}} | 917 | -- }}} |