diff --git a/nvim/init.lua b/nvim/init.lua index 99e4c6a..bdcffe0 100644 --- a/nvim/init.lua +++ b/nvim/init.lua @@ -22,14 +22,30 @@ if fn.has('nvim') == 0 then return end +vim.g.mapleader = " " -- Make sure to set `mapleader` before lazy so your mappings are correct +vim.g.maplocalleader = "\\" -- Same for `maplocalleader` --- Ensure packer installed -local install_path = fn.stdpath('data') .. '/site/pack/packer/start/packer.nvim' -if fn.empty(fn.glob(install_path)) > 0 then - fn.system({ 'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', install_path }) - cmd('packadd packer.nvim') +local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" +if not (vim.uv or vim.loop).fs_stat(lazypath) then + vim.fn.system({ + "git", + "clone", + "--filter=blob:none", + "https://github.com/folke/lazy.nvim.git", + "--branch=stable", -- latest stable release + lazypath, + }) end +vim.opt.rtp:prepend(lazypath) +require("lazy").setup("plugins") +-- -- Ensure packer installed +-- local install_path = fn.stdpath('data') .. '/site/pack/packer/start/packer.nvim' +-- if fn.empty(fn.glob(install_path)) > 0 then +-- fn.system({ 'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', install_path }) +-- cmd('packadd packer.nvim') +-- end +-- -- reopen last position -- cmd([[ autocmd BufReadPost * normal! g`" ]]) @@ -133,7 +149,7 @@ set('synmaxcol', 120) -- Key mappings -- map Leader key to -g.mapleader = [[ ]] +-- g.mapleader = [[ ]] -- v 模式下复制内容到系统剪切板 map('v', 'cp', '"+yy') @@ -167,7 +183,7 @@ vim.g.copilot_no_maps = 1 vim.g.copilot_assume_mapped = 1 -require('plugins') +-- require('plugins') require('funcs') -- Neoformat diff --git a/nvim/lazy-lock.json b/nvim/lazy-lock.json new file mode 100644 index 0000000..3e09094 --- /dev/null +++ b/nvim/lazy-lock.json @@ -0,0 +1,49 @@ +{ + "autoclose.nvim": { "branch": "main", "commit": "dc42806540dcf448ecb2bad6b67204410cfbe629" }, + "chowcho.nvim": { "branch": "main", "commit": "51ff2608748e9fa4ea79c1c1ae18b60c2cd24276" }, + "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, + "cmp-cmdline": { "branch": "main", "commit": "d250c63aa13ead745e3a40f61fdd3470efde3923" }, + "cmp-nvim-lsp": { "branch": "main", "commit": "39e2eda76828d88b773cc27a3f61d2ad782c922d" }, + "cmp-vsnip": { "branch": "main", "commit": "989a8a73c44e926199bfd05fa7a516d51f2d2752" }, + "comment.nvim": { "branch": "master", "commit": "0236521ea582747b58869cb72f70ccfa967d2e89" }, + "copilot.lua": { "branch": "master", "commit": "f7612f5af4a7d7615babf43ab1e67a2d790c13a6" }, + "fidget.nvim": { "branch": "legacy", "commit": "2f7c08f45639a64a5c0abcf67321d52c3f499ae6" }, + "gitsigns.nvim": { "branch": "main", "commit": "75dc649106827183547d3bedd4602442340d2f7f" }, + "hlargs.nvim": { "branch": "main", "commit": "30fe1b3de2b7614f061be4fc9c71984a2b87e50a" }, + "hlsearch.nvim": { "branch": "main", "commit": "fdeb60b890d15d9194e8600042e5232ef8c29b0e" }, + "hop.nvim": { "branch": "master", "commit": "1a1eceafe54b5081eae4cb91c723abd1d450f34b" }, + "image_preview.nvim": { "branch": "main", "commit": "8de950078bdecf1916e8dbddfbee451e095b023c" }, + "incolla.nvim": { "branch": "master", "commit": "a3e5f170e37c8da61906f31fd8d61a475b32bfd5" }, + "indent-blankline.nvim": { "branch": "master", "commit": "d98f537c3492e87b6dc6c2e3f66ac517528f406f" }, + "lazy.nvim": { "branch": "main", "commit": "24fa2a97085ca8a7220b5b078916f81e316036fd" }, + "lsp_signature.nvim": { "branch": "master", "commit": "529e8861d0410389f0163a5e5c2199d4a4ef5bf6" }, + "lspkind-nvim": { "branch": "master", "commit": "1735dd5a5054c1fb7feaf8e8658dbab925f4f0cf" }, + "lualine.nvim": { "branch": "master", "commit": "0a5a66803c7407767b799067986b4dc3036e1983" }, + "neoconf.nvim": { "branch": "main", "commit": "f1fd38d61d11f3b1b3e7dc75dc667f79cf2fa58b" }, + "neodev.nvim": { "branch": "main", "commit": "ce9a2e8eaba5649b553529c5498acb43a6c317cd" }, + "nvim-autopairs": { "branch": "master", "commit": "c15de7e7981f1111642e7e53799e1211d4606cb9" }, + "nvim-cmp": { "branch": "main", "commit": "5260e5e8ecadaf13e6b82cf867a909f54e15fd07" }, + "nvim-lspconfig": { "branch": "master", "commit": "b124ef3bd4435a6db7ff03ea2f5a23e1e0487552" }, + "nvim-scrollbar": { "branch": "main", "commit": "35f99d559041c7c0eff3a41f9093581ceea534e8" }, + "nvim-tree.lua": { "branch": "master", "commit": "5a87ffe35c4739ffb6b62052572583ad277a20ae" }, + "nvim-treesitter": { "branch": "master", "commit": "b7d50e59b1b2990b3ce8761d4cf595f4b71c87e2" }, + "nvim-treesitter-context": { "branch": "master", "commit": "f62bfe19e0fbc13ae95649dfb3cf22f4ff85b683" }, + "nvim-treesitter-endwise": { "branch": "master", "commit": "8b34305ffc28bd75a22f5a0a9928ee726a85c9a6" }, + "nvim-treesitter-refactor": { "branch": "master", "commit": "65ad2eca822dfaec2a3603119ec3cc8826a7859e" }, + "nvim-treesitter-textobjects": { "branch": "master", "commit": "3557e41418b4a6c5b85d5d64abe94c9c50fa9b14" }, + "nvim-web-devicons": { "branch": "master", "commit": "b77921fdc44833c994fdb389d658ccbce5490c16" }, + "nvim-yati": { "branch": "main", "commit": "c4307e6855f17ff89f0132787e2daba27495d254" }, + "playground": { "branch": "master", "commit": "ba48c6a62a280eefb7c85725b0915e021a1a0749" }, + "plenary.nvim": { "branch": "master", "commit": "a3e3bc82a3f95c5ed0d7201546d5d2c19b20d683" }, + "sentiment.nvim": { "branch": "main", "commit": "ecde8d877881bb78fdb90060c0991e76770dbdbc" }, + "statuscol.nvim": { "branch": "main", "commit": "483b9a596dfd63d541db1aa51ee6ee9a1441c4cc" }, + "telescope.nvim": { "branch": "master", "commit": "dfa230be84a044e7f546a6c2b0a403c739732b86" }, + "todo-comments.nvim": { "branch": "main", "commit": "e1549807066947818113a7d7ed48f637e49620d3" }, + "toggleterm.nvim": { "branch": "main", "commit": "fee58a0473fd92b28c34f8f724e4918b15ba30a3" }, + "tokyonight.nvim": { "branch": "main", "commit": "0fae425aaab04a5f97666bd431b96f2f19c36935" }, + "vim-fugitive": { "branch": "master", "commit": "4f59455d2388e113bd510e85b310d15b9228ca0d" }, + "vim-vsnip": { "branch": "master", "commit": "02a8e79295c9733434aab4e0e2b8c4b7cea9f3a9" }, + "vim-vsnip-integ": { "branch": "master", "commit": "1914e72cf3de70df7f5dde476cd299aba2440aef" }, + "vim-wakatime": { "branch": "master", "commit": "3cb40867cb5a3120f9bef76eff88edc7f1dc1a23" }, + "which-key.nvim": { "branch": "main", "commit": "4433e5ec9a507e5097571ed55c02ea9658fb268a" } +} \ No newline at end of file diff --git a/nvim/lua/config/indent-blankline.lua b/nvim/lua/config/indent-blankline.lua deleted file mode 100644 index 5f493d9..0000000 --- a/nvim/lua/config/indent-blankline.lua +++ /dev/null @@ -1,7 +0,0 @@ -require('indent_blankline').setup({ - char = '|', - buftype_exclude = { 'terminal' }, - show_trailing_blankline_indent = false, - -- show_current_context = true, - use_treesitter = true, -}) diff --git a/nvim/lua/config/gitsigns.lua b/nvim/lua/legacy/gitsigns.lua similarity index 76% rename from nvim/lua/config/gitsigns.lua rename to nvim/lua/legacy/gitsigns.lua index ee71c99..e80c17b 100644 --- a/nvim/lua/config/gitsigns.lua +++ b/nvim/lua/legacy/gitsigns.lua @@ -6,13 +6,12 @@ require('gitsigns').setup({ topdelete = { hl = 'GitSignsDelete', text = '⇊', numhl = 'GitSignsDeleteNr', linehl = 'GitSignsDeleteLn' }, changedelete = { hl = 'GitSignsChange', text = '~', numhl = 'GitSignsChangeNr', linehl = 'GitSignsChangeLn' }, }, - keymaps = { - -- Default keymap options - noremap = true, - - ['n ]c'] = { expr = true, "&diff ? ']c' : 'lua require\"gitsigns.actions\".next_hunk()'" }, - ['n [c'] = { expr = true, "&diff ? '[c' : 'lua require\"gitsigns.actions\".prev_hunk()'" }, - }, + -- keymaps = { + -- -- Default keymap options + -- noremap = true, + -- ['n ]c'] = { expr = true, "&diff ? ']c' : 'lua require\"gitsigns.actions\".next_hunk()'" }, + -- ['n [c'] = { expr = true, "&diff ? '[c' : 'lua require\"gitsigns.actions\".prev_hunk()'" }, + -- }, word_diff = false, current_line_blame = true, linehl = true, diff --git a/nvim/lua/legacy/indent-blankline.lua b/nvim/lua/legacy/indent-blankline.lua new file mode 100644 index 0000000..3a65a78 --- /dev/null +++ b/nvim/lua/legacy/indent-blankline.lua @@ -0,0 +1,7 @@ +require('ibl').setup() +-- setup({ +-- char = '|', +-- buftype_exclude = { 'terminal' }, +-- show_trailing_blankline_indent = false, +-- show_current_context = true, +-- }) diff --git a/nvim/lua/config/lsp-setup.lua b/nvim/lua/legacy/lsp-setup.lua similarity index 100% rename from nvim/lua/config/lsp-setup.lua rename to nvim/lua/legacy/lsp-setup.lua diff --git a/nvim/lua/config/lsp_lines.lua b/nvim/lua/legacy/lsp_lines.lua similarity index 100% rename from nvim/lua/config/lsp_lines.lua rename to nvim/lua/legacy/lsp_lines.lua diff --git a/nvim/lua/config/lualine.lua b/nvim/lua/legacy/lualine.lua similarity index 100% rename from nvim/lua/config/lualine.lua rename to nvim/lua/legacy/lualine.lua diff --git a/nvim/lua/config/nvim-lsputils.lua b/nvim/lua/legacy/nvim-lsputils.lua similarity index 100% rename from nvim/lua/config/nvim-lsputils.lua rename to nvim/lua/legacy/nvim-lsputils.lua diff --git a/nvim/lua/config/nvim-tree.lua b/nvim/lua/legacy/nvim-tree.lua similarity index 97% rename from nvim/lua/config/nvim-tree.lua rename to nvim/lua/legacy/nvim-tree.lua index 2e37b76..327c76c 100644 --- a/nvim/lua/config/nvim-tree.lua +++ b/nvim/lua/legacy/nvim-tree.lua @@ -68,9 +68,9 @@ require('nvim-tree').setup({ width = 35, side = 'left', }, - renderer = { - highlight_opened_files = '1', - }, + -- renderer = { + -- highlight_opened_files = '1', + -- }, diagnostics = { enable = true, icons = { diff --git a/nvim/lua/config/nvim_bookmarks.lua b/nvim/lua/legacy/nvim_bookmarks.lua similarity index 100% rename from nvim/lua/config/nvim_bookmarks.lua rename to nvim/lua/legacy/nvim_bookmarks.lua diff --git a/nvim/lua/config/nvim_cmp.lua b/nvim/lua/legacy/nvim_cmp.lua similarity index 100% rename from nvim/lua/config/nvim_cmp.lua rename to nvim/lua/legacy/nvim_cmp.lua diff --git a/nvim/lua/config/nvim_floaterm.lua b/nvim/lua/legacy/nvim_floaterm.lua similarity index 100% rename from nvim/lua/config/nvim_floaterm.lua rename to nvim/lua/legacy/nvim_floaterm.lua diff --git a/nvim/lua/config/nvim_hop.lua b/nvim/lua/legacy/nvim_hop.lua similarity index 100% rename from nvim/lua/config/nvim_hop.lua rename to nvim/lua/legacy/nvim_hop.lua diff --git a/nvim/lua/config/nvim_telescope.lua b/nvim/lua/legacy/nvim_telescope.lua similarity index 100% rename from nvim/lua/config/nvim_telescope.lua rename to nvim/lua/legacy/nvim_telescope.lua diff --git a/nvim/lua/config/nvim_treesitter.lua b/nvim/lua/legacy/nvim_treesitter.lua similarity index 100% rename from nvim/lua/config/nvim_treesitter.lua rename to nvim/lua/legacy/nvim_treesitter.lua diff --git a/nvim/lua/config/nvim_vimgo.lua b/nvim/lua/legacy/nvim_vimgo.lua similarity index 100% rename from nvim/lua/config/nvim_vimgo.lua rename to nvim/lua/legacy/nvim_vimgo.lua diff --git a/nvim/lua/plugins.lua b/nvim/lua/legacy/plugin.lua similarity index 99% rename from nvim/lua/plugins.lua rename to nvim/lua/legacy/plugin.lua index 44c5a72..2f70186 100644 --- a/nvim/lua/plugins.lua +++ b/nvim/lua/legacy/plugin.lua @@ -70,7 +70,6 @@ return require('packer').startup(function(use) end, }) use('wakatime/vim-wakatime') - --use('psf/black') use({ 'numToStr/Comment.nvim', config = function() diff --git a/nvim/lua/config/tagbar.lua b/nvim/lua/legacy/tagbar.lua similarity index 100% rename from nvim/lua/config/tagbar.lua rename to nvim/lua/legacy/tagbar.lua diff --git a/nvim/lua/config/toggleterm.lua b/nvim/lua/legacy/toggleterm.lua similarity index 100% rename from nvim/lua/config/toggleterm.lua rename to nvim/lua/legacy/toggleterm.lua diff --git a/nvim/lua/config/trouble.lua b/nvim/lua/legacy/trouble.lua similarity index 100% rename from nvim/lua/config/trouble.lua rename to nvim/lua/legacy/trouble.lua diff --git a/nvim/lua/config/vim-oscyank.lua b/nvim/lua/legacy/vim-oscyank.lua similarity index 100% rename from nvim/lua/config/vim-oscyank.lua rename to nvim/lua/legacy/vim-oscyank.lua diff --git a/nvim/lua/config/vista.lua b/nvim/lua/legacy/vista.lua similarity index 100% rename from nvim/lua/config/vista.lua rename to nvim/lua/legacy/vista.lua diff --git a/nvim/lua/plugins/autoclose.lua b/nvim/lua/plugins/autoclose.lua new file mode 100644 index 0000000..f20f26d --- /dev/null +++ b/nvim/lua/plugins/autoclose.lua @@ -0,0 +1,5 @@ +return { + 'm4xshen/autoclose.nvim', + event = 'VeryLazy', + config = true, +} diff --git a/nvim/lua/plugins/autopairs.lua b/nvim/lua/plugins/autopairs.lua new file mode 100644 index 0000000..c51bf19 --- /dev/null +++ b/nvim/lua/plugins/autopairs.lua @@ -0,0 +1,5 @@ +return { + 'windwp/nvim-autopairs', + event = 'InsertEnter', + config = true, +} diff --git a/nvim/lua/plugins/bufferline.lua b/nvim/lua/plugins/bufferline.lua new file mode 100644 index 0000000..a2f8d79 --- /dev/null +++ b/nvim/lua/plugins/bufferline.lua @@ -0,0 +1,20 @@ +return { + 'akinsho/bufferline.nvim', + event = 'VeryLazy', + enabled = false, + opts = { + options = { + show_buffer_icons = true, + diagnostics = 'nvim_lsp', + indicator = { + icon = '▎', + style = 'icon', + }, + -- show_buffer_close_icons = false, + modified_icon = '✥', + offsets = { + { filetype = 'NvimTree', text = 'File Explorer', text_align = 'center', highlight = 'Directory' }, + }, + }, + } +} diff --git a/nvim/lua/plugins/chowcho.lua b/nvim/lua/plugins/chowcho.lua new file mode 100644 index 0000000..4c378b3 --- /dev/null +++ b/nvim/lua/plugins/chowcho.lua @@ -0,0 +1,13 @@ +return { + 'tkmpypy/chowcho.nvim', + event = 'VeryLazy', + keys = { + { + '-', + mode = { 'n' }, + function() + require('chowcho').run() + end, + } + } +} diff --git a/nvim/lua/plugins/cmp.lua b/nvim/lua/plugins/cmp.lua new file mode 100644 index 0000000..88c01c7 --- /dev/null +++ b/nvim/lua/plugins/cmp.lua @@ -0,0 +1,79 @@ +return { + 'hrsh7th/nvim-cmp', + event = 'InsertEnter', + dependencies = { + 'hrsh7th/cmp-vsnip', + 'hrsh7th/cmp-nvim-lsp', + 'hrsh7th/vim-vsnip', + 'hrsh7th/vim-vsnip-integ', + 'hrsh7th/cmp-buffer', + 'onsails/lspkind-nvim', + 'windwp/nvim-autopairs', + 'hrsh7th/cmp-cmdline', + }, + config = function() + local cmp = require('cmp') + local types = require('cmp.types') + local cmp_autopairs = require('nvim-autopairs.completion.cmp') + local opts = { + formatting = { + format = function(entry, vim_item) + vim_item.kind = require('lspkind').presets.default[vim_item.kind] .. ' ' .. vim_item.kind + + -- set a name for each source + vim_item.menu = ({ + buffer = '[Buf]', + nvim_lsp = '[LSP]', + luasnip = '[Snip]', + nvim_lua = '[Lua]', + latex_symbols = '[Latex]', + })[entry.source.name] + return vim_item + end, + }, + window = { + completion = cmp.config.window.bordered(), + documentation = cmp.config.window.bordered(), + }, + snippet = { + expand = function(args) + vim.fn['vsnip#anonymous'](args.body) + end, + }, + mapping = cmp.mapping.preset.insert({ + [''] = cmp.mapping.select_next_item({ behavior = types.cmp.SelectBehavior.Select }), + [''] = function(fallback) + local function input(keys, mode) + vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes(keys, true, true, true), mode or 'i', true) + end + + if vim.fn.pumvisible() == 1 then + input('', 'n') + elseif vim.fn['vsnip#jumpable']() == -1 then + input('(vsnip-jump-prev)') + else + fallback() + end + end, + [''] = cmp.mapping.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = true }), + [''] = function(fallback) + fallback() + end, + [''] = function(fallback) + fallback() + end, + }), + completion = { + completeopt = 'menu,menuone,noselect', + }, + preselect = types.cmp.PreselectMode.None, + sources = { + { name = 'nvim_lsp' }, + { name = 'buffer' }, + { name = 'vsnip' }, + }, + } + cmp.setup(opts) + cmp.event:on('confirm_done', cmp_autopairs.on_confirm_done({ map_char = { tex = '' } })) + end, +} diff --git a/nvim/lua/plugins/comment.lua b/nvim/lua/plugins/comment.lua new file mode 100644 index 0000000..96d8b11 --- /dev/null +++ b/nvim/lua/plugins/comment.lua @@ -0,0 +1,5 @@ +return { + 'numToStr/comment.nvim', + keys = { 'gcc', { 'gc', mode = 'v' } }, + config = true, +} diff --git a/nvim/lua/plugins/copilot.lua b/nvim/lua/plugins/copilot.lua new file mode 100644 index 0000000..575bfd4 --- /dev/null +++ b/nvim/lua/plugins/copilot.lua @@ -0,0 +1,21 @@ +return { + 'zbirenbaum/copilot.lua', + cmd = 'Copilot', + event = 'InsertEnter', + opts = { + -- panel = { + -- auto_refresh = true, + -- }, + filetypes = { + ['*'] = true, + }, + suggestion = { + auto_trigger = true, + keymap = { + accept = '', + next = '', + prev = '', + } + } + } +} diff --git a/nvim/lua/plugins/devicons.lua b/nvim/lua/plugins/devicons.lua new file mode 100644 index 0000000..d748c99 --- /dev/null +++ b/nvim/lua/plugins/devicons.lua @@ -0,0 +1,14 @@ +return { + 'nvim-tree/nvim-web-devicons', + event = 'VeryLazy', + opts = { + override = { + zsh = { + icon = '', + color = '#428850', + name = 'Zsh', + }, + }, + default = true, + } +} diff --git a/nvim/lua/plugins/fidget.lua b/nvim/lua/plugins/fidget.lua new file mode 100644 index 0000000..271c7a5 --- /dev/null +++ b/nvim/lua/plugins/fidget.lua @@ -0,0 +1,13 @@ +return { + 'j-hui/fidget.nvim', -- nvim-lsp progress + branch = 'legacy', + event = 'VeryLazy', + opts = { + text = { + done = '[✓]', + }, + fmt = { + stack_upwards = false, + }, + }, +} diff --git a/nvim/lua/plugins/fugitive.lua b/nvim/lua/plugins/fugitive.lua new file mode 100644 index 0000000..ce2ee35 --- /dev/null +++ b/nvim/lua/plugins/fugitive.lua @@ -0,0 +1,4 @@ +return { + 'tpope/vim-fugitive', + event = 'VeryLazy', +} diff --git a/nvim/lua/plugins/gitsigns.lua b/nvim/lua/plugins/gitsigns.lua new file mode 100644 index 0000000..7b051be --- /dev/null +++ b/nvim/lua/plugins/gitsigns.lua @@ -0,0 +1,49 @@ +return { + 'lewis6991/gitsigns.nvim', + event = 'VeryLazy', + dependencies = { 'nvim-lua/plenary.nvim' }, + opts = { + signs = { + add = { text = '▌' }, + change = { text = '▌' }, + delete = { text = '▌' }, + topdelete = { text = '▌' }, + changedelete = { text = '▌' }, + }, + word_diff = false, + current_line_blame = true, + linehl = true, + numhl = true, + sign_priority = 6, + preview_config = { + border = 'rounded', + }, + on_attach = function(bufnr) + local function map(mode, l, r, opts) + opts = opts or {} + opts.buffer = bufnr + vim.keymap.set(mode, l, r, opts) + end + + local gs = package.loaded.gitsigns + map('n', 'hs', gs.stage_hunk) + map('n', 'hr', gs.reset_hunk) + map('v', 'hs', function() gs.stage_hunk { vim.fn.line('.'), vim.fn.line('v') } end) + map('v', 'hr', function() gs.reset_hunk { vim.fn.line('.'), vim.fn.line('v') } end) + map('n', 'hp', gs.preview_hunk) + map('n', 'hd', gs.diffthis) + + map('n', ']c', function() + if vim.wo.diff then return ']c' end + vim.schedule(function() gs.next_hunk() end) + return '' + end, { expr = true }) + + map('n', '[c', function() + if vim.wo.diff then return '[c' end + vim.schedule(function() gs.prev_hunk() end) + return '' + end, { expr = true }) + end + } +} diff --git a/nvim/lua/plugins/hlargs.lua b/nvim/lua/plugins/hlargs.lua new file mode 100644 index 0000000..ff63aa4 --- /dev/null +++ b/nvim/lua/plugins/hlargs.lua @@ -0,0 +1,5 @@ +return { + 'm-demare/hlargs.nvim', + event = 'VeryLazy', + config = true, +} diff --git a/nvim/lua/plugins/hlsearch.lua b/nvim/lua/plugins/hlsearch.lua new file mode 100644 index 0000000..b4eb32d --- /dev/null +++ b/nvim/lua/plugins/hlsearch.lua @@ -0,0 +1,5 @@ +return { + 'glepnir/hlsearch.nvim', + event = 'VeryLazy', + config = true, +} diff --git a/nvim/lua/plugins/hop.lua b/nvim/lua/plugins/hop.lua new file mode 100644 index 0000000..205c163 --- /dev/null +++ b/nvim/lua/plugins/hop.lua @@ -0,0 +1,25 @@ +return { + 'phaazon/hop.nvim', + event = 'VeryLazy', + config = true, + keys = { + { + 's', + 'HopChar2', + }, + { + 'w', + 'HopWordAC', + }, + { + 'k', + mode = { 'n', 'v' }, + 'HopLineStart', + }, + { + 'j', + mode = { 'n', 'v' }, + 'HopLineStart', + }, + }, +} diff --git a/nvim/lua/plugins/image-preview.lua b/nvim/lua/plugins/image-preview.lua new file mode 100644 index 0000000..58e9e24 --- /dev/null +++ b/nvim/lua/plugins/image-preview.lua @@ -0,0 +1,5 @@ +return { + 'adelarsq/image_preview.nvim', + event = 'VeryLazy', + config = true, +} diff --git a/nvim/lua/plugins/incolla.lua b/nvim/lua/plugins/incolla.lua new file mode 100644 index 0000000..55cad89 --- /dev/null +++ b/nvim/lua/plugins/incolla.lua @@ -0,0 +1,5 @@ +return { + 'mattdibi/incolla.nvim', + cmd = { 'Incolla' }, + config = true, +} diff --git a/nvim/lua/plugins/indentline.lua b/nvim/lua/plugins/indentline.lua new file mode 100644 index 0000000..c2f80ef --- /dev/null +++ b/nvim/lua/plugins/indentline.lua @@ -0,0 +1,41 @@ +local highlight = { + "RainbowRed", + "RainbowYellow", + "RainbowBlue", + "RainbowOrange", + "RainbowGreen", + "RainbowViolet", + "RainbowCyan", +} + +local hooks = require "ibl.hooks" +-- create the highlight groups in the highlight setup hook, so they are reset +-- every time the colorscheme changes +hooks.register(hooks.type.HIGHLIGHT_SETUP, function() + vim.api.nvim_set_hl(0, "RainbowRed", { fg = "#E06C75" }) + vim.api.nvim_set_hl(0, "RainbowYellow", { fg = "#E5C07B" }) + vim.api.nvim_set_hl(0, "RainbowBlue", { fg = "#61AFEF" }) + vim.api.nvim_set_hl(0, "RainbowOrange", { fg = "#D19A66" }) + vim.api.nvim_set_hl(0, "RainbowGreen", { fg = "#98C379" }) + vim.api.nvim_set_hl(0, "RainbowViolet", { fg = "#C678DD" }) + vim.api.nvim_set_hl(0, "RainbowCyan", { fg = "#56B6C2" }) +end) + +return { + 'lukas-reineke/indent-blankline.nvim', + event = 'BufRead', + main = 'ibl', + opts = { + indent = { + char = '|', + highlight = highlight, + }, + exclude = { + buftypes = { + 'terminal', + 'NvimTree', + 'nofile' + } + }, + } +} diff --git a/nvim/lua/plugins/lualine.lua b/nvim/lua/plugins/lualine.lua new file mode 100644 index 0000000..26357e1 --- /dev/null +++ b/nvim/lua/plugins/lualine.lua @@ -0,0 +1,14 @@ +return { + 'hoob3rt/lualine.nvim', + event = 'VeryLazy', + dependencies = { 'nvim-tree/nvim-web-devicons', opt = true }, + opts = { + options = { + disabled_filetypes = { 'NvimTree' }, + theme = 'auto', + section_separators = '', + component_separators = '', + -- globalstatus = true, + }, + }, +} diff --git a/nvim/lua/plugins/neoconf.lua b/nvim/lua/plugins/neoconf.lua new file mode 100644 index 0000000..faa5768 --- /dev/null +++ b/nvim/lua/plugins/neoconf.lua @@ -0,0 +1 @@ +return { "folke/neoconf.nvim", cmd = "Neoconf" } diff --git a/nvim/lua/plugins/neodev.lua b/nvim/lua/plugins/neodev.lua new file mode 100644 index 0000000..fded66c --- /dev/null +++ b/nvim/lua/plugins/neodev.lua @@ -0,0 +1,9 @@ +return { + 'folke/neodev.nvim', + event = 'VeryLazy', + dependencies = { + 'neovim/nvim-lspconfig', + }, + ft = { 'lua' }, + config = true, +} diff --git a/nvim/lua/plugins/scrollbar.lua b/nvim/lua/plugins/scrollbar.lua new file mode 100644 index 0000000..536ed30 --- /dev/null +++ b/nvim/lua/plugins/scrollbar.lua @@ -0,0 +1,22 @@ +return { + 'petertriho/nvim-scrollbar', + event = 'VeryLazy', + opts = function() + local colors = require('tokyonight.colors').setup() + return { + handle = { + cursor = false, + color = colors.bg_highlight, + }, + marks = { + Search = { color = colors.orange }, + Error = { color = colors.error }, + Warn = { color = colors.warning }, + Info = { color = colors.info }, + Hint = { color = colors.hint }, + Misc = { color = colors.purple }, + }, + excluded_filetypes = { 'NvimTree', 'TelescopePrompt', 'chatgpt' } + } + end +} diff --git a/nvim/lua/plugins/sentiment.lua b/nvim/lua/plugins/sentiment.lua new file mode 100644 index 0000000..fc62c3e --- /dev/null +++ b/nvim/lua/plugins/sentiment.lua @@ -0,0 +1,5 @@ +return { + 'utilyre/sentiment.nvim', + event = 'VeryLazy', + config = true, +} diff --git a/nvim/lua/plugins/signature.lua b/nvim/lua/plugins/signature.lua new file mode 100644 index 0000000..6d65736 --- /dev/null +++ b/nvim/lua/plugins/signature.lua @@ -0,0 +1,5 @@ +return { + 'ray-x/lsp_signature.nvim', + event = 'VeryLazy', + config = true, +} diff --git a/nvim/lua/plugins/sillicon.lua b/nvim/lua/plugins/sillicon.lua new file mode 100644 index 0000000..1ed926d --- /dev/null +++ b/nvim/lua/plugins/sillicon.lua @@ -0,0 +1,16 @@ +return { + 'krivahtoo/silicon.nvim', + event = 'VeryLazy', + enabled = false, + opts = { + font = 'Hack=20', + theme = 'Dracula', + background = '#fff', + pad_horiz = 50, + pad_vert = 50, + line_number = true, + line_pad = 2, + line_offset = 1, + tab_width = 4, + } +} diff --git a/nvim/lua/plugins/statuscol.lua b/nvim/lua/plugins/statuscol.lua new file mode 100644 index 0000000..b5eed0e --- /dev/null +++ b/nvim/lua/plugins/statuscol.lua @@ -0,0 +1,27 @@ +return { + 'luukvbaal/statuscol.nvim', + event = 'VeryLazy', + opts = function() + local builtin = require('statuscol.builtin') + return { + relculright = true, + segments = { + { + sign = { name = { '.*' }, maxwidth = 1, auto = true }, + click = 'v:lua#.ScSa' + }, + { text = { builtin.lnumfunc }, click = 'v:lua.ScLa', }, + { text = { builtin.foldfunc }, click = 'v:lua.ScFa' }, + { + text = { ' ' }, + condition = { builtin.not_empty, true, builtin.not_empty }, + click = 'v:lua.ScFa' + }, + { + sign = { name = { 'GitSigns' }, maxwidth = 1, colwidth = 1, auto = true }, + click = 'v:lua.ScSa' + }, + } + } + end +} diff --git a/nvim/lua/plugins/telescope.lua b/nvim/lua/plugins/telescope.lua new file mode 100644 index 0000000..cf9ab22 --- /dev/null +++ b/nvim/lua/plugins/telescope.lua @@ -0,0 +1,46 @@ +return { + 'nvim-telescope/telescope.nvim', + event = 'VeryLazy', + dependencies = { + 'nvim-lua/plenary.nvim', + }, + opts = { + defaults = { + layout_config = { + horizontal = { + width = 0.75, + height = 0.5, + }, + }, + mappings = { + i = { + [''] = 'close', + [''] = 'move_selection_previous', + [''] = 'move_selection_next', + [''] = { '', type = 'command' }, + [''] = { '', type = 'command' }, + [''] = 'preview_scrolling_down', + [''] = 'preview_scrolling_up', + }, + }, + }, + }, + keys = { + { + 'ff', + 'Telescope find_files', + }, + { + 'fg', + 'Telescope live_grep', + }, + { + 'b', + 'Telescope buffers', + }, + { + ';', + 'Telescope commands', + } + }, +} diff --git a/nvim/lua/plugins/todo-comments.lua b/nvim/lua/plugins/todo-comments.lua new file mode 100644 index 0000000..7ac922f --- /dev/null +++ b/nvim/lua/plugins/todo-comments.lua @@ -0,0 +1,14 @@ +return { + 'folke/todo-comments.nvim', + event = 'VeryLazy', + dependencies = { + 'nvim-lua/plenary.nvim', + }, + opts = { + highlight = { + -- bg conflects with linehl of gitsigns + keyword = 'fg', + after = '', + }, + } +} diff --git a/nvim/lua/plugins/toggleterm.lua b/nvim/lua/plugins/toggleterm.lua new file mode 100644 index 0000000..fda9548 --- /dev/null +++ b/nvim/lua/plugins/toggleterm.lua @@ -0,0 +1,17 @@ +return { + 'akinsho/toggleterm.nvim', + event = 'VeryLazy', + keys = { + { mode = { 'n' }, '', ':ToggleTerm' }, + }, + opts = { + open_mapping = [[]], + size = function(term) + if term.direction == 'horizontal' then + return 15 + else + return vim.o.columns * 0.3 + end + end, + }, +} diff --git a/nvim/lua/plugins/tokyonight.lua b/nvim/lua/plugins/tokyonight.lua new file mode 100644 index 0000000..637fd3f --- /dev/null +++ b/nvim/lua/plugins/tokyonight.lua @@ -0,0 +1,11 @@ +return { + 'folke/tokyonight.nvim', + lazy = false, + priority = 1000, + init = function() + require('tokyonight').load() + end, + opts = { + style = 'night', + }, +} diff --git a/nvim/lua/plugins/tree.lua b/nvim/lua/plugins/tree.lua new file mode 100644 index 0000000..18323c7 --- /dev/null +++ b/nvim/lua/plugins/tree.lua @@ -0,0 +1,99 @@ +return { + 'nvim-tree/nvim-tree.lua', + event = 'VeryLazy', + dependencies = 'nvim-tree/nvim-web-devicons', + init = function() + local function open_nvim_tree() + require('nvim-tree.api').tree.find_file({ open = true }) + end + + local function close_nvim_tree() + local layout = vim.api.nvim_call_function('winlayout', {}) + if layout[1] == 'leaf' + and vim.api.nvim_buf_get_option(vim.api.nvim_win_get_buf(layout[2]), 'filetype') == 'NvimTree' + and layout[3] == nil then + vim.cmd('confirm quit') + end + end + + vim.api.nvim_create_autocmd('VimEnter', { callback = open_nvim_tree }) + vim.api.nvim_create_autocmd('BufEnter', { callback = close_nvim_tree }) + end, + opts = { + on_attach = function(bufnr) + local function map(mode, l, r, opts) + opts = opts or {} + opts.buffer = bufnr + vim.keymap.set(mode, l, r, opts) + end + + local api = require('nvim-tree.api') + api.config.mappings.default_on_attach(bufnr) + map('n', '', api.node.open.vertical) + map('n', '', api.node.open.horizontal) + map('n', 'v', api.node.open.vertical) + map('n', 's', api.node.open.horizontal) + map('n', '[d', api.node.navigate.diagnostics.prev) + map('n', ']d', api.node.navigate.diagnostics.next) + -- map('n', 'r', api.fs.rename_sub, { buffer = bufnr }) + + map('n', '', function() require('toggleterm').toggle() end) + map('n', '-', function() require('chowcho').run() end) + end, + renderer = { + indent_markers = { + enable = true, + icons = { + item = '|', + edge = '|', + corner = '┗', + } + }, + highlight_git = true, + icons = { + git_placement = 'after', + glyphs = { + symlink = '', + git = { + deleted = '', + ignored = '◌', + renamed = '➜', + staged = '+', + unmerged = '', + untracked = '?', + -- unstaged = 'ϟ', + }, + folder = { + arrow_open = '', + arrow_closed = '', + default = '', + open = '', + empty = '', + empty_open = '', + symlink = '', + symlink_open = '', + }, + } + } + }, + view = { + width = 35, + side = 'left', + }, + diagnostics = { + enable = true, + icons = { + error = '', + warning = '', + info = '', + hint = '', + }, + }, + update_focused_file = { + enable = true, + }, + hijack_netrw = true, + update_cwd = true, + reload_on_bufenter = true, + } +} diff --git a/nvim/lua/plugins/treesitter.lua b/nvim/lua/plugins/treesitter.lua new file mode 100644 index 0000000..1947353 --- /dev/null +++ b/nvim/lua/plugins/treesitter.lua @@ -0,0 +1,71 @@ +return { + 'nvim-treesitter/nvim-treesitter', + build = ':TSUpdate', + event = 'VeryLazy', + dependencies = { + 'nvim-treesitter/playground', + 'nvim-treesitter/nvim-treesitter-refactor', + 'nvim-treesitter/nvim-treesitter-textobjects', + 'nvim-treesitter/nvim-treesitter-context', + 'RRethy/nvim-treesitter-endwise', + -- 'andymass/vim-matchup', -- extend % key + 'yioneko/nvim-yati', + }, + init = function() + local ncmd = vim.api.nvim_command + ncmd('set foldmethod=expr') + ncmd('set foldexpr=nvim_treesitter#foldexpr()') + end, + opts = { + ensure_installed = { + 'c', 'lua', 'rust', 'go', 'python', + 'zig', 'markdown', 'solidity', 'jsonnet', 'vim', 'graphql' + }, + highlight = { + enable = true, + }, + playground = { + enable = true, + }, + query_linter = { + enable = true, + use_virtual_text = true, + lint_events = { 'BufWrite', 'CursorHold' }, + }, + -- nvim-treesitter/nvim-treesitter-refactor + refactor = { + highlight_definitions = { enable = true }, + smart_rename = { + enable = true, + keymaps = { + smart_rename = 'gnr', + }, + }, + }, + indent = { enable = false }, + autopairs = { enable = true }, + rainbow = { enable = true }, + autotag = { enable = true }, + context_commentstring = { enable = true }, + -- RRethy/nvim-treesitter-endwise + endwise = { + enable = true, + }, + -- andymass/vim-matchup + -- matchup = { + -- enable = true, + -- }, + -- nvim-treesitter/nvim-treesitter-textobjects + textobjects = { + select = { + enable = true, + lookahead = true, + }, + }, + -- yioneko/nvim-yati + yati = { enable = true }, + }, + config = function(_, opts) + require('nvim-treesitter.configs').setup(opts) + end, +} diff --git a/nvim/lua/plugins/wakatime.lua b/nvim/lua/plugins/wakatime.lua new file mode 100644 index 0000000..ef1307e --- /dev/null +++ b/nvim/lua/plugins/wakatime.lua @@ -0,0 +1,4 @@ +return { + 'wakatime/vim-wakatime', + event = 'InsertEnter', +} diff --git a/nvim/lua/plugins/whichkey.lua b/nvim/lua/plugins/whichkey.lua new file mode 100644 index 0000000..6f73877 --- /dev/null +++ b/nvim/lua/plugins/whichkey.lua @@ -0,0 +1 @@ +return {"folke/which-key.nvim"}