diff --git a/init.lua b/init.lua index 5f77458..350aec8 100644 --- a/init.lua +++ b/init.lua @@ -1,6 +1,11 @@ vim.g.base46_cache = vim.fn.stdpath "data" .. "/base46/" vim.g.mapleader = " " vim.cmd("source ~/.config/nvim/test.vim") +require("configs.set") + +vim.filetype.add({ + pattern = { [".*/hypr/.*%.conf"] = "hyprlang" }, +}) -- bootstrap lazy and all plugins local lazypath = vim.fn.stdpath "data" .. "/lazy/lazy.nvim" @@ -14,21 +19,30 @@ end vim.opt.rtp:prepend(lazypath) -local lazy_config = require "configs.lazy" +-- local lazy_config = require "configs.lazy" -- load plugins require("lazy").setup({ - { import = "plugins" }, -}, lazy_config) + import = "plugins", + defaults = { lazy = false }, + install = { colorscheme = { "nvchad" } }, + + ui = { + icons = { + ft = "", + lazy = "󰂠 ", + loaded = "", + not_loaded = "", + }, + }, +}) -- load theme dofile(vim.g.base46_cache .. "defaults") dofile(vim.g.base46_cache .. "statusline") -require "options" require "nvchad.autocmds" -require("configs.set") vim.schedule(function() require "mappings" diff --git a/lazy-lock.json b/lazy-lock.json index 1024404..6beb6df 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -17,8 +17,8 @@ "fidget.nvim": { "branch": "main", "commit": "d9ba6b7bfe29b3119a610892af67602641da778e" }, "focus.nvim": { "branch": "master", "commit": "d76338e58e49f844e8f6a7aff16a74a2a55a80ef" }, "friendly-snippets": { "branch": "main", "commit": "efff286dd74c22f731cdec26a70b46e5b203c619" }, - "fzf-lua": { "branch": "main", "commit": "1176d512b1390f992c775f08dcb155d4e0ba01cf" }, - "gitsigns.nvim": { "branch": "main", "commit": "c23bbd3ed2c7a3fdc3399e97e24f9e158f57612f" }, + "fzf-lua": { "branch": "main", "commit": "b3e9303f6bccca52523cbe50901c2574a9528338" }, + "gitsigns.nvim": { "branch": "main", "commit": "4baa13519c2168cc9a7890a3580c50226ed018fb" }, "indent-blankline.nvim": { "branch": "master", "commit": "e10626f7fcd51ccd56d7ffc00883ba7e0aa28f78" }, "lazy.nvim": { "branch": "main", "commit": "f15a93907ddad3d9139aea465ae18336d87f5ce6" }, "mason-lspconfig.nvim": { "branch": "main", "commit": "f75e877f5266e87523eb5a18fcde2081820d087b" }, @@ -31,10 +31,10 @@ "nvim-bufdel": { "branch": "main", "commit": "523d58e94e7212fff3e05c247b962dc8f93bcfde" }, "nvim-cmp": { "branch": "main", "commit": "12509903a5723a876abd65953109f926f4634c30" }, "nvim-dap": { "branch": "master", "commit": "52302f02fea3a490e55475de52fa4deb8af2eb11" }, - "nvim-lspconfig": { "branch": "master", "commit": "75edb91a3d2deabe76a9911cde2c13d411b3b097" }, + "nvim-lspconfig": { "branch": "master", "commit": "5dca9e1480ebe39f3f96f98a8196f8ee18fad207" }, "nvim-notify": { "branch": "master", "commit": "22f29093eae7785773ee9d543f8750348b1a195c" }, "nvim-tree.lua": { "branch": "master", "commit": "70825f23db61ecd900c4cfea169bffe931926a9d" }, - "nvim-treesitter": { "branch": "master", "commit": "62911c78a868bac24c8a86f2c1c412d0b799f885" }, + "nvim-treesitter": { "branch": "master", "commit": "3973f53d7a8c4b87151dc3fd0e3d654aaa036c31" }, "nvim-web-devicons": { "branch": "master", "commit": "402377242b04be3f4f0f3720bd952df86e946c30" }, "plenary.nvim": { "branch": "master", "commit": "3707cdb1e43f5cea73afb6037e6494e7ce847a66" }, "presence.nvim": { "branch": "main", "commit": "87c857a56b7703f976d3a5ef15967d80508df6e6" }, diff --git a/lua/configs/auto-session.lua b/lua/configs/auto-session.lua deleted file mode 100644 index 6a23612..0000000 --- a/lua/configs/auto-session.lua +++ /dev/null @@ -1,45 +0,0 @@ -require("auto-session").setup { - enabled = true, - root_dir = vim.fn.stdpath "data" .. "/sessions/", - auto_save = true, - auto_restore = true, - auto_create = true, - suppressed_dirs = nil, - allowed_dirs = nil, - auto_restore_last_session = false, - use_git_branch = false, - lazy_support = true, - bypass_save_filetypes = nil, - close_unsupported_windows = true, - args_allow_single_directory = true, - args_allow_files_auto_save = false, - continue_restore_on_error = true, - show_auto_restore_notif = false, - cwd_change_handling = false, - lsp_stop_on_restore = false, - log_level = "error", - - session_lens = { - load_on_setup = true, - theme_conf = { - -- test - }, - previewer = false, - - mappings = { - delete_session = { "i", "" }, - alternate_session = { "i", "" }, - copy_session = { "i", "" }, - }, - - session_control = { - control_dir = vim.fn.stdpath "data" .. "/auto_session/", - control_filename = "session_control.json", - }, - }, - vim.api.nvim_create_autocmd({ "VimLeavePre" }, { - callback = function() - vim.cmd( "SessionSave" ) - end, - }), -} diff --git a/lua/configs/set.lua b/lua/configs/set.lua index cf8ad5f..ac9d0d4 100644 --- a/lua/configs/set.lua +++ b/lua/configs/set.lua @@ -19,6 +19,7 @@ vim.opt.incsearch = true vim.opt.termguicolors = true + vim.opt.scrolloff = 8 vim.opt.signcolumn = "yes:1" vim.opt.isfname:append("@-@") @@ -27,7 +28,7 @@ vim.opt.updatetime = 50 vim.opt.colorcolumn = "80" -vim.opt.textwidth = 0 +vim.opt.textwidth = 80 vim.opt.formatoptions = "tcrqnj" vim.o.sessionoptions = "blank,buffers,curdir,folds,help,tabpages,winsize,winpos,terminal,localoptions" diff --git a/lua/configs/treesitter.lua b/lua/configs/treesitter.lua index b330243..598df70 100644 --- a/lua/configs/treesitter.lua +++ b/lua/configs/treesitter.lua @@ -3,7 +3,8 @@ pcall(function() dofile(vim.g.base46_cache .. "treesitter") end) -return { +require('nvim-treesitter.configs').setup { + build = ":TSUpdate", ensure_installed = "all", sync_install = false, auto_install = true, diff --git a/lua/init.lua b/lua/init.lua index 69fd804..4d41187 100644 --- a/lua/init.lua +++ b/lua/init.lua @@ -15,6 +15,3 @@ autocmd('LspAttach', { end }) -vim.filetype.add({ - pattern = { [".*/hypr/.*%.conf$"] = "hyprlang" }, -}) diff --git a/lua/nvchad/autocmds.lua b/lua/nvchad/autocmds.lua index 47437aa..7fdbb27 100644 --- a/lua/nvchad/autocmds.lua +++ b/lua/nvchad/autocmds.lua @@ -1,27 +1,27 @@ local autocmd = vim.api.nvim_create_autocmd -- user event that loads after UIEnter + only if file buf is there -autocmd({ "UIEnter", "BufReadPost", "BufNewFile" }, { - group = vim.api.nvim_create_augroup("NvFilePost", { clear = true }), - callback = function(args) - local file = vim.api.nvim_buf_get_name(args.buf) - local buftype = vim.api.nvim_get_option_value("buftype", { buf = args.buf }) - - if not vim.g.ui_entered and args.event == "UIEnter" then - vim.g.ui_entered = true - end - - if file ~= "" and buftype ~= "nofile" and vim.g.ui_entered then - vim.api.nvim_exec_autocmds("User", { pattern = "FilePost", modeline = false }) - vim.api.nvim_del_augroup_by_name "NvFilePost" - - vim.schedule(function() - vim.api.nvim_exec_autocmds("FileType", {}) - - if vim.g.editorconfig then - require("editorconfig").config(args.buf) - end - end) - end - end, -}) +-- autocmd({ "UIEnter", "BufReadPost", "BufNewFile" }, { +-- group = vim.api.nvim_create_augroup("NvFilePost", { clear = true }), +-- callback = function(args) +-- local file = vim.api.nvim_buf_get_name(args.buf) +-- local buftype = vim.api.nvim_get_option_value("buftype", { buf = args.buf }) +-- +-- if not vim.g.ui_entered and args.event == "UIEnter" then +-- vim.g.ui_entered = true +-- end +-- +-- if file ~= "" and buftype ~= "nofile" and vim.g.ui_entered then +-- vim.api.nvim_exec_autocmds("User", { pattern = "FilePost", modeline = false }) +-- vim.api.nvim_del_augroup_by_name "NvFilePost" +-- +-- vim.schedule(function() +-- vim.api.nvim_exec_autocmds("FileType", {}) +-- +-- if vim.g.editorconfig then +-- require("editorconfig").config(args.buf) +-- end +-- end) +-- end +-- end, +-- }) diff --git a/lua/nvchad/configs/lspconfig.lua b/lua/nvchad/configs/lspconfig.lua index 25e7eed..6e4ee02 100644 --- a/lua/nvchad/configs/lspconfig.lua +++ b/lua/nvchad/configs/lspconfig.lua @@ -19,7 +19,6 @@ M.on_attach = function(_, bufnr) end, opts "List workspace folders") map("n", "D", vim.lsp.buf.type_definition, opts "Go to type definition") - map("n", "ra", require "nvchad.lsp.renamer", opts "NvRenamer") map({ "n", "v" }, "ca", vim.lsp.buf.code_action, opts "Code action") map("n", "gr", vim.lsp.buf.references, opts "Show references") @@ -67,13 +66,13 @@ M.defaults = function() globals = { "vim" }, }, workspace = { - library = { - vim.fn.expand "$VIMRUNTIME/lua", - vim.fn.expand "$VIMRUNTIME/lua/vim/lsp", - vim.fn.stdpath "data" .. "/lazy/ui/nvchad_types", - vim.fn.stdpath "data" .. "/lazy/lazy.nvim/lua/lazy", - "${3rd}/luv/library", - }, + -- library = { + -- vim.fn.expand "$VIMRUNTIME/lua", + -- vim.fn.expand "$VIMRUNTIME/lua/vim/lsp", + -- vim.fn.stdpath "data" .. "/lazy/ui/nvchad_types", + -- vim.fn.stdpath "data" .. "/lazy/lazy.nvim/lua/lazy", + -- "${3rd}/luv/library", + -- }, maxPreload = 100000, preloadFileSize = 10000, }, diff --git a/lua/nvchad/plugins/init.lua b/lua/nvchad/plugins/init.lua deleted file mode 100644 index d93a4c2..0000000 --- a/lua/nvchad/plugins/init.lua +++ /dev/null @@ -1,169 +0,0 @@ -return { - "nvim-lua/plenary.nvim", - - { - "nvchad/base46", - build = function() - require("base46").load_all_highlights() - end, - }, - - { - "nvchad/ui", - lazy = false, - config = function() - require "nvchad" - end, - }, - - "nvzone/volt", - "nvzone/menu", - { "nvzone/minty", cmd = { "Huefy", "Shades" } }, - - { - "nvim-tree/nvim-web-devicons", - opts = function() - dofile(vim.g.base46_cache .. "devicons") - return { override = require "nvchad.icons.devicons" } - end, - }, - - { - "lukas-reineke/indent-blankline.nvim", - event = "User FilePost", - opts = { - indent = { char = "│", highlight = "IblChar" }, - scope = { char = "│", highlight = "IblScopeChar" }, - }, - config = function(_, opts) - dofile(vim.g.base46_cache .. "blankline") - - local hooks = require "ibl.hooks" - hooks.register(hooks.type.WHITESPACE, hooks.builtin.hide_first_space_indent_level) - require("ibl").setup(opts) - - dofile(vim.g.base46_cache .. "blankline") - end, - }, - - -- file managing , picker etc - { - "nvim-tree/nvim-tree.lua", - cmd = { "NvimTreeToggle", "NvimTreeFocus" }, - opts = function() - return require "nvchad.configs.nvimtree" - end, - }, - - { - "folke/which-key.nvim", - keys = { "", "", '"', "'", "`", "c", "v", "g" }, - cmd = "WhichKey", - opts = function() - dofile(vim.g.base46_cache .. "whichkey") - return {} - end, - }, - - -- formatting! - { - "stevearc/conform.nvim", - opts = { - formatters_by_ft = { lua = { "stylua" } }, - }, - }, - - -- git stuff - { - "lewis6991/gitsigns.nvim", - event = "User FilePost", - opts = function() - return require "nvchad.configs.gitsigns" - end, - }, - - -- lsp stuff - { - "williamboman/mason.nvim", - cmd = { "Mason", "MasonInstall", "MasonUpdate" }, - opts = function() - return require "nvchad.configs.mason" - end, - }, - - { - "neovim/nvim-lspconfig", - event = "User FilePost", - config = function() - require("nvchad.configs.lspconfig").defaults() - end, - }, - - -- load luasnips + cmp related in insert mode only - { - "hrsh7th/nvim-cmp", - event = "InsertEnter", - dependencies = { - { - -- snippet plugin - "L3MON4D3/LuaSnip", - dependencies = "rafamadriz/friendly-snippets", - opts = { history = true, updateevents = "TextChanged,TextChangedI" }, - config = function(_, opts) - require("luasnip").config.set_config(opts) - require "nvchad.configs.luasnip" - end, - }, - - -- autopairing of (){}[] etc - { - "windwp/nvim-autopairs", - opts = { - fast_wrap = {}, - disable_filetype = { "TelescopePrompt", "vim" }, - }, - config = function(_, opts) - require("nvim-autopairs").setup(opts) - - -- setup cmp for autopairs - local cmp_autopairs = require "nvim-autopairs.completion.cmp" - require("cmp").event:on("confirm_done", cmp_autopairs.on_confirm_done()) - end, - }, - - -- cmp sources plugins - { - "saadparwaiz1/cmp_luasnip", - "hrsh7th/cmp-nvim-lua", - "hrsh7th/cmp-nvim-lsp", - "hrsh7th/cmp-buffer", - "hrsh7th/cmp-path", - }, - }, - opts = function() - return require "nvchad.configs.cmp" - end, - }, - - { - "nvim-telescope/telescope.nvim", - dependencies = { "nvim-treesitter/nvim-treesitter" }, - cmd = "Telescope", - opts = function() - return require "nvchad.configs.telescope" - end, - }, - - -- { - -- "nvim-treesitter/nvim-treesitter", - -- event = { "BufReadPost", "BufNewFile" }, - -- cmd = { "TSInstall", "TSBufEnable", "TSBufDisable", "TSModuleInfo" }, - -- build = ":TSUpdate", - -- opts = function() - -- return require "nvchad.configs.treesitter" - -- end, - -- config = function(_, opts) - -- require("nvim-treesitter.configs").setup(opts) - -- end, - -- }, -} diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua index 54f83e5..0a3c1d7 100644 --- a/lua/plugins/init.lua +++ b/lua/plugins/init.lua @@ -1,4 +1,48 @@ return { + { + "cameronr/auto-session", + opts = { + enabled = true, + -- log_level = 'debug', + root_dir = vim.fn.stdpath "data" .. "/sessions/", + auto_save = true, + auto_restore = true, + auto_create = true, + suppressed_dirs = nil, + allowed_dirs = nil, + auto_restore_last_session = false, + use_git_branch = false, + lazy_support = true, + bypass_save_filetypes = nil, + close_unsupported_windows = true, + args_allow_single_directory = true, + args_allow_files_auto_save = true, + continue_restore_on_error = false, + show_auto_restore_notif = true, + cwd_change_handling = false, + lsp_stop_on_restore = false, + + session_lens = { + load_on_setup = true, + theme_conf = { + -- test + }, + previewer = false, + + mappings = { + delete_session = { "i", "" }, + alternate_session = { "i", "" }, + copy_session = { "i", "" }, + }, + + session_control = { + control_dir = vim.fn.stdpath "data" .. "/auto_session/", + control_filename = "session_control.json", + }, + }, + }, + }, + { "stevearc/conform.nvim", -- event = 'BufWritePre', -- uncomment for format on save @@ -126,13 +170,6 @@ return { end, }, - { - "rmagatti/auto-session", - config = function() - require "configs.auto-session" - end, - }, - { "smolck/command-completion.nvim", opts = { @@ -230,14 +267,6 @@ return { end, }, - { - "neovim/nvim-lspconfig", - event = "User FilePost", - config = function() - require("nvchad.configs.lspconfig").defaults() - end, - }, - -- load luasnips + cmp related in insert mode only { "hrsh7th/nvim-cmp", diff --git a/test b/test deleted file mode 100644 index e69de29..0000000