From b0112c069b0ec2b268236c035def6bd62aba0e0a Mon Sep 17 00:00:00 2001 From: Tevin79 Date: Sun, 20 Apr 2025 18:03:28 +0200 Subject: [PATCH] refact --- init.lua | 96 ++++---------------------------- lua/custom/plugins/copilot.lua | 3 + lua/custom/plugins/init.lua | 2 + lua/custom/plugins/rose-pine.lua | 61 ++++++++++++++++++++ lua/custom/plugins/undotree.lua | 3 + lua/custom/plugins/vimtex.lua | 8 +++ lua/custom/remap.lua | 14 +++++ 7 files changed, 102 insertions(+), 85 deletions(-) create mode 100644 lua/custom/plugins/copilot.lua create mode 100644 lua/custom/plugins/rose-pine.lua create mode 100644 lua/custom/plugins/undotree.lua create mode 100644 lua/custom/plugins/vimtex.lua create mode 100644 lua/custom/remap.lua diff --git a/init.lua b/init.lua index 40770174..3366834b 100644 --- a/init.lua +++ b/init.lua @@ -4,26 +4,11 @@ vim.g.mapleader = ' ' vim.g.maplocalleader = ' ' --- ( Custom remaps --- vim.keymap.set('n', '!', '_') -- For macos only - --- Center the view when moving -vim.keymap.set('n', '', 'zz') -vim.keymap.set('n', '', 'zz') - --- Access to file viewer easily -vim.keymap.set('n', 'pv', vim.cmd.Ex, { desc = '[P]roject files [V]iewer' }) - -vim.api.nvim_set_hl(0, 'Normal', { bg = 'none' }) -vim.api.nvim_set_hl(0, 'NormalFloat', { bg = 'none' }) - --- Undotree -vim.keymap.set('n', '', vim.cmd.UndotreeToggle) - --- End of custom remaps ) +-- Custom remaps +require 'custom.remap' -- Set to true if you have a Nerd Font installed and selected in the terminal -vim.g.have_nerd_font = false +vim.g.have_nerd_font = true -- [[ Setting options ]] -- See `:help vim.opt` @@ -171,12 +156,7 @@ vim.opt.rtp:prepend(lazypath) -- NOTE: Here is where you install your plugins. require('lazy').setup { - { - 'rose-pine/neovim', - name = 'rose-pine', - }, - - 'mbbill/undotree', + { import = 'custom.plugins' }, 'tpope/vim-sleuth', @@ -655,13 +635,17 @@ require('lazy').setup { main = 'nvim-treesitter.configs', -- Sets main module to use for opts -- [[ Configure Treesitter ]] See `:help nvim-treesitter` opts = { - ensure_installed = { 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc' }, + ensure_installed = { 'bibtex', 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc' }, auto_install = true, highlight = { enable = true, - additional_vim_regex_highlighting = { 'ruby' }, + -- additional_vim_regex_highlighting = { 'ruby', 'latex' }, + disable = { 'latex' }, + }, + indent = { + enable = true, + disable = { 'ruby', 'latex' }, }, - indent = { enable = true, disable = { 'ruby' } }, }, }, ui = { @@ -682,61 +666,3 @@ require('lazy').setup { }, }, } - -require('rose-pine').setup { - variant = 'auto', -- auto, main, moon, or dawn - dark_variant = 'main', -- main, moon, or dawn - dim_inactive_windows = false, - extend_background_behind_borders = true, - - enable = { - terminal = true, - legacy_highlights = true, -- Improve compatibility for previous versions of Neovim - migrations = true, -- Handle deprecated options automatically - }, - - styles = { - bold = true, - italic = true, - transparency = true, - }, - - groups = { - border = 'muted', - link = 'iris', - panel = 'surface', - - error = 'love', - hint = 'iris', - info = 'foam', - note = 'pine', - todo = 'rose', - warn = 'gold', - - git_add = 'foam', - git_change = 'rose', - git_delete = 'love', - git_dirty = 'rose', - git_ignore = 'muted', - git_merge = 'iris', - git_rename = 'pine', - git_stage = 'iris', - git_text = 'rose', - git_untracked = 'subtle', - - h1 = 'iris', - h2 = 'foam', - h3 = 'rose', - h4 = 'gold', - h5 = 'pine', - h6 = 'foam', - }, - - palette = {}, - - highlight_groups = {}, - - before_highlight = function(group, highlight, palette) end, -} - -vim.cmd 'colorscheme rose-pine' diff --git a/lua/custom/plugins/copilot.lua b/lua/custom/plugins/copilot.lua new file mode 100644 index 00000000..1a804873 --- /dev/null +++ b/lua/custom/plugins/copilot.lua @@ -0,0 +1,3 @@ +return { + 'github/copilot.vim', +} diff --git a/lua/custom/plugins/init.lua b/lua/custom/plugins/init.lua index 8eb0cfd6..34bcd10a 100644 --- a/lua/custom/plugins/init.lua +++ b/lua/custom/plugins/init.lua @@ -2,3 +2,5 @@ -- I promise not to create any merge conflicts in this directory :) -- -- See the kickstart.nvim README for more information + +return {} diff --git a/lua/custom/plugins/rose-pine.lua b/lua/custom/plugins/rose-pine.lua new file mode 100644 index 00000000..f2e1cf9c --- /dev/null +++ b/lua/custom/plugins/rose-pine.lua @@ -0,0 +1,61 @@ +return { + 'rose-pine/neovim', + name = 'rose-pine', + config = function() + require('rose-pine').setup { + variant = 'auto', -- auto, main, moon, or dawn + dark_variant = 'main', -- main, moon, or dawn + dim_inactive_windows = false, + extend_background_behind_borders = true, + + enable = { + terminal = true, + legacy_highlights = true, -- Improve compatibility for previous versions of Neovim + migrations = true, -- Handle deprecated options automatically + }, + + styles = { + bold = true, + italic = true, + transparency = true, + }, + + groups = { + border = 'muted', + link = 'iris', + panel = 'surface', + + error = 'love', + hint = 'iris', + info = 'foam', + note = 'pine', + todo = 'rose', + warn = 'gold', + + git_add = 'foam', + git_change = 'rose', + git_delete = 'love', + git_dirty = 'rose', + git_ignore = 'muted', + git_merge = 'iris', + git_rename = 'pine', + git_stage = 'iris', + git_text = 'rose', + git_untracked = 'subtle', + + h1 = 'iris', + h2 = 'foam', + h3 = 'rose', + h4 = 'gold', + h5 = 'pine', + h6 = 'foam', + }, + + palette = {}, + + highlight_groups = {}, + } + + vim.cmd 'colorscheme rose-pine' + end, +} diff --git a/lua/custom/plugins/undotree.lua b/lua/custom/plugins/undotree.lua new file mode 100644 index 00000000..77581624 --- /dev/null +++ b/lua/custom/plugins/undotree.lua @@ -0,0 +1,3 @@ +return { + 'mbbill/undotree', +} diff --git a/lua/custom/plugins/vimtex.lua b/lua/custom/plugins/vimtex.lua new file mode 100644 index 00000000..eedd81e8 --- /dev/null +++ b/lua/custom/plugins/vimtex.lua @@ -0,0 +1,8 @@ +return { + 'lervag/vimtex', + lazy = false, -- we don't want to lazy load VimTeX + init = function() + -- VimTeX configuration goes here, e.g. + vim.g.vimtex_view_method = 'zathura' + end, +} diff --git a/lua/custom/remap.lua b/lua/custom/remap.lua new file mode 100644 index 00000000..70802dd1 --- /dev/null +++ b/lua/custom/remap.lua @@ -0,0 +1,14 @@ +-- vim.keymap.set('n', '!', '_') -- For macos only + +-- Center the view when moving +vim.keymap.set('n', '', 'zz') +vim.keymap.set('n', '', 'zz') + +-- Access to file viewer easily +vim.keymap.set('n', 'pv', vim.cmd.Ex, { desc = '[P]roject files [V]iewer' }) + +vim.api.nvim_set_hl(0, 'Normal', { bg = 'none' }) +vim.api.nvim_set_hl(0, 'NormalFloat', { bg = 'none' }) + +-- Undotree +vim.keymap.set('n', '', vim.cmd.UndotreeToggle)