aboutsummaryrefslogtreecommitdiffhomepage
path: root/vim
diff options
context:
space:
mode:
authorHsieh Chin Fan <pham@topo.tw>2024-07-21 19:42:12 +0800
committerHsieh Chin Fan <pham@topo.tw>2024-07-21 19:42:12 +0800
commit3fa3c62ab3439bffacea380631e5e2e4c5a67fcb (patch)
tree372e7b1bb45c1cef6f0ca3a415fdb78610ecefae /vim
parent82ed7d4113c474f309ebeb5133873ccf0a2bcda2 (diff)
Update
Diffstat (limited to 'vim')
-rw-r--r--vim/lua/chadrc.lua66
-rw-r--r--vim/mini.lua143
2 files changed, 96 insertions, 113 deletions
diff --git a/vim/lua/chadrc.lua b/vim/lua/chadrc.lua
index 182ed96..11777ca 100644
--- a/vim/lua/chadrc.lua
+++ b/vim/lua/chadrc.lua
@@ -3,70 +3,4 @@
3 3
4---@type ChadrcConfig 4---@type ChadrcConfig
5local M = {} 5local M = {}
6
7M.ui = {
8 theme = "onedark",
9 hl_override = {
10 CursorLineNr = { fg = "#eeee00" },
11 },
12
13 -- hl_override = {
14 -- Comment = { italic = true },
15 -- ["@comment"] = { italic = true },
16 -- },
17 tabufline = {
18 enabled = true,
19 order = { "treeOffset", "buffers", "tabs" },
20 },
21
22 term = {
23 hl = "Normal:term,WinSeparator:WinSeparator",
24 sizes = { sp = 0.4, vsp = 0.4 },
25 float = {
26 relative = "editor",
27 row = 0.15,
28 col = 0.13,
29 width = 0.7,
30 height = 0.7,
31 border = "single",
32 },
33 },
34}
35
36-- For tabufline
37if M.ui.tabufline.enabled then
38 vim.api.nvim_exec(
39 [[
40 function! CloseBufferSafely()
41 lua require("nvchad.tabufline").close_buffer()
42 endfunction
43 ]],
44 false
45 )
46
47 for i = 1, 9, 1 do
48 vim.keymap.set("n", string.format("<A-%s>", i), function()
49 vim.api.nvim_set_current_buf(vim.t.bufs[i])
50 end)
51 end
52 vim.keymap.set("n", "<A-h>", function()
53 require("nvchad.tabufline").move_buf(-1)
54 end)
55 vim.keymap.set("n", "<A-l>", function()
56 require("nvchad.tabufline").move_buf(1)
57 end)
58 vim.keymap.set("n", "<A-H>", function()
59 vim.cmd("tabprevious")
60 end)
61 vim.keymap.set("n", "<A-L>", function()
62 vim.cmd("tabnext")
63 end)
64 vim.keymap.set("n", "<tab>", function()
65 require("nvchad.tabufline").next()
66 end, { desc = "buffer goto next" })
67 vim.keymap.set("n", "<S-tab>", function()
68 require("nvchad.tabufline").prev()
69 end, { desc = "buffer goto prev" })
70end
71
72return M 6return M
diff --git a/vim/mini.lua b/vim/mini.lua
index 7b44fc0..f550440 100644
--- a/vim/mini.lua
+++ b/vim/mini.lua
@@ -12,47 +12,9 @@ if not (vim.uv or vim.loop).fs_stat(lazypath) then
12end 12end
13vim.opt.rtp:prepend(lazypath) 13vim.opt.rtp:prepend(lazypath)
14-- }}} 14-- }}}
15vim.g.base46_cache = vim.fn.stdpath "data" .. "/nvchad/base46/"
15require("lazy").setup ({ 16require("lazy").setup ({
16 "tpope/vim-sleuth", 17 "tpope/vim-sleuth",
17 -- bufferline {{{
18 {
19 "akinsho/bufferline.nvim",
20 dependencies = {
21 'nvim-tree/nvim-web-devicons', -- OPTIONAL: for file icons
22 "tiagovla/scope.nvim",
23 },
24 config = function()
25 require("bufferline").setup{
26 options = {
27 tab_size = 14,
28 separator_style = { '', '' },
29 themable = true,
30 buffer_close_icon = '',
31 close_icon = '',
32 groups = {
33 items = {
34 require('bufferline.groups').builtin.pinned:with({ icon = "󰐃" })
35 }
36 }
37 },
38 }
39 require("scope").setup{}
40 -- keymaps {{{
41 for i = 1, 9, 1 do
42 vim.keymap.set("n", string.format("<A-%s>", i), function()
43 vim.cmd("BufferLineGoToBuffer "..i)
44 end, {silent = true})
45 end
46 local opts = { noremap = true, silent = true }
47 vim.keymap.set('n', '<TAB>', '<Cmd>BufferLineCyclePrev<CR>', opts)
48 vim.keymap.set('n', '<S-TAB>', '<Cmd>BufferLineCycleNext<CR>', opts)
49 vim.keymap.set('n', '<M-h>', '<Cmd>BufferLineMovePrev<CR>', opts)
50 vim.keymap.set('n', '<M-l>', '<Cmd>BufferLineMoveNext<CR>', opts)
51 vim.keymap.set('n', '<M-p>', '<Cmd>BufferLineTogglePin<CR>', opts)
52 end,
53 -- }}}
54 },
55 -- }}}
56 -- conform {{{ 18 -- conform {{{
57 { 19 {
58 "stevearc/conform.nvim", 20 "stevearc/conform.nvim",
@@ -68,15 +30,14 @@ require("lazy").setup ({
68 -- }}} 30 -- }}}
69 -- Telescope {{{ 31 -- Telescope {{{
70 { 32 {
71 "nvim-telescope/telescope-fzf-native.nvim",
72 build = "make",
73 },
74 {
75 "nvim-telescope/telescope.nvim", 33 "nvim-telescope/telescope.nvim",
76 lazy = false, 34 lazy = false,
77 dependencies = { 35 dependencies = {
78 'nvim-lua/plenary.nvim', 36 'nvim-lua/plenary.nvim',
79 "nvim-telescope/telescope-fzf-native.nvim", 37 {
38 "nvim-telescope/telescope-fzf-native.nvim",
39 build = "make",
40 },
80 }, 41 },
81 config = function() 42 config = function()
82 -- extensions {{{ 43 -- extensions {{{
@@ -387,6 +348,50 @@ require("lazy").setup ({
387 end, 348 end,
388 }, 349 },
389 --}}} 350 --}}}
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
378 -- cmp sources plugins
379 {
380 "saadparwaiz1/cmp_luasnip",
381 "hrsh7th/cmp-nvim-lua",
382 "hrsh7th/cmp-nvim-lsp",
383 "hrsh7th/cmp-buffer",
384 "hrsh7th/cmp-path",
385 },
386 },
387 opts = function()
388 return require "nvchad.configs.cmp"
389 end,
390 config = function(_, opts)
391 require("cmp").setup(opts)
392 end,
393 },
394-- }}}
390}) 395})
391 396
392-- Install mini.nvim {{{ 397-- Install mini.nvim {{{
@@ -564,6 +569,13 @@ require('mini.diff').setup({
564 priority = 199, 569 priority = 199,
565 }, 570 },
566}) 571})
572
573vim.keymap.set( 'n', '\\gh', function()
574 MiniDiff.toggle_overlay()
575 end,
576 { buffer = bufnr, desc = 'Toggle diff' }
577)
578
567-- }}} 579-- }}}
568-- mini.map {{{ 580-- mini.map {{{
569require('mini.map').setup() 581require('mini.map').setup()
@@ -577,9 +589,6 @@ end,
577{ buffer = bufnr, desc = '' } 589{ buffer = bufnr, desc = '' }
578) 590)
579-- }}} 591-- }}}
580-- mini.completion {{{
581require('mini.completion').setup()
582-- }}}
583-- mini.surround {{{ 592-- mini.surround {{{
584require('mini.surround').setup { 593require('mini.surround').setup {
585 mappings = { 594 mappings = {
@@ -617,6 +626,9 @@ vim.keymap.set( 'n', '<leader><leader>hi', function()MiniHipatterns.toggle() end
617-- mini.pairs {{{ 626-- mini.pairs {{{
618require('mini.pairs').setup() 627require('mini.pairs').setup()
619-- }}} 628-- }}}
629-- -- mini.completion {{{
630-- require('mini.completion').setup()
631-- -- }}}
620-- -- mini.tabline {{{ 632-- -- mini.tabline {{{
621-- 633--
622-- require('mini.tabline').setup { 634-- require('mini.tabline').setup {
@@ -694,3 +706,40 @@ add {
694} 706}
695vim.keymap.set("n", "<leader>z", ":TZAtaraxis<CR>") 707vim.keymap.set("n", "<leader>z", ":TZAtaraxis<CR>")
696-- }}} 708-- }}}
709-- bufferline {{{
710add {
711 source = "akinsho/bufferline.nvim",
712 depends = {
713 'nvim-tree/nvim-web-devicons', -- OPTIONAL: for file icons
714 "tiagovla/scope.nvim",
715 },
716}
717require("bufferline").setup{
718 options = {
719 tab_size = 14,
720 separator_style = { '', '' },
721 themable = true,
722 buffer_close_icon = '',
723 close_icon = '',
724 groups = {
725 items = {
726 require('bufferline.groups').builtin.pinned:with({ icon = "󰐃" })
727 }
728 }
729 },
730}
731require("scope").setup{}
732-- keymaps {{{
733for i = 1, 9, 1 do
734 vim.keymap.set("n", string.format("<A-%s>", i), function()
735 vim.cmd("BufferLineGoToBuffer "..i)
736 end, {silent = true})
737end
738local opts = { noremap = true, silent = true }
739vim.keymap.set('n', '<TAB>', '<Cmd>BufferLineCyclePrev<CR>', opts)
740vim.keymap.set('n', '<S-TAB>', '<Cmd>BufferLineCycleNext<CR>', opts)
741vim.keymap.set('n', '<M-h>', '<Cmd>BufferLineMovePrev<CR>', opts)
742vim.keymap.set('n', '<M-l>', '<Cmd>BufferLineMoveNext<CR>', opts)
743vim.keymap.set('n', '<M-p>', '<Cmd>BufferLineTogglePin<CR>', opts)
744-- }}}
745-- }}}