From 74f880a76914e9c35a37b2d0683b4ae35a9981eb Mon Sep 17 00:00:00 2001 From: coast Date: Mon, 14 Jul 2025 01:38:23 +0330 Subject: [PATCH] suicide --- .emacs.d/init.el | 95 +++++--- config/nvim/Makefile | 4 - config/nvim/fnl/config.fnl | 98 -------- config/nvim/init.lua | 231 ------------------ config/nvim/init.vim | 62 +++++ config/nvim/lua/project_nvim/project.lua | 286 ----------------------- 6 files changed, 121 insertions(+), 655 deletions(-) delete mode 100644 config/nvim/Makefile delete mode 100644 config/nvim/fnl/config.fnl delete mode 100644 config/nvim/init.lua create mode 100644 config/nvim/init.vim delete mode 100644 config/nvim/lua/project_nvim/project.lua diff --git a/.emacs.d/init.el b/.emacs.d/init.el index 095bbbb..e7eedfa 100644 --- a/.emacs.d/init.el +++ b/.emacs.d/init.el @@ -1,4 +1,3 @@ -;; package setup (require 'package) (setq package-archives '(("gnu" . "https://elpa.gnu.org/packages/") @@ -8,12 +7,9 @@ (package-refresh-contents)) (require 'use-package) -;; UI & Appearance (menu-bar-mode -1) (tool-bar-mode -1) (scroll-bar-mode -1) -(set-frame-parameter (selected-frame) 'alpha '(90 . 90)) -(add-to-list 'default-frame-alist '(alpha . (90 . 90))) (global-display-line-numbers-mode 1) (global-hl-line-mode 1) @@ -21,31 +17,70 @@ (use-package all-the-icons :ensure t :if (display-graphic-p)) (use-package elcord :ensure t :config (elcord-mode 1)) -(load-theme 'doom-badger t) -;; get rid of stupid buffer saves +(load-theme 'doom-gruvbox t) + +(set-frame-parameter (selected-frame) 'alpha '(90 . 90)) +(add-to-list 'default-frame-alist '(alpha . (90 . 90))) + +(set-face-attribute 'default nil :family "Fira Code" :height 130) + +(custom-set-faces + '(mode-line ((t (:inherit mode-line :background "#3c3836" :foreground "#ebdbb2")))) + '(mode-line-inactive ((t (:inherit mode-line-inactive :background "#282828" :foreground "#a89984"))))) + (setq backup-directory-alist `((".*" . "~/.local/tmp/emacsbackup/"))) (setq make-backup-files t) (setq backup-by-copying t) -;; Sidebar +(use-package evil + :ensure t + :init + (setq evil-want-keybinding nil) + (setq evil-want-C-u-scroll t) + :config + (evil-mode 1)) + +(use-package evil-collection + :after evil + :ensure t + :config + (evil-collection-init)) + (use-package neotree :ensure t :bind ("" . neotree-toggle)) -;; Completion/UI stuff -(use-package vertico :ensure t :config (vertico-mode 1)) +(use-package vertico + :ensure t + :init + (evil-collection-vertico-setup) + :config + (vertico-mode 1)) + (use-package marginalia :ensure t :hook (vertico-mode . marginalia-mode)) -(use-package consult :ensure t - :bind (("C-s" . consult-line) ("C-x b" . consult-buffer))) + +(use-package consult + :ensure t + :bind (("C-s" . consult-line) ("C-x b" . consult-buffer)) + :init + (evil-collection-consult-setup)) + (use-package which-key :ensure t :config (which-key-mode 1)) -(use-package swiper :ensure t :bind ("C-s" . swiper)) -;; Completion etc. +(use-package evil-surround + :ensure t + :config + (global-evil-surround-mode 1)) + +(use-package evil-commentary + :ensure t + :config + (evil-commentary-mode)) + (use-package company :ensure t :hook (prog-mode . company-mode)) (use-package yasnippet :ensure t :hook (prog-mode . yas-minor-mode)) (use-package flycheck :ensure t :hook (prog-mode . flycheck-mode)) -;; LSP (use-package lsp-mode :ensure t :commands lsp @@ -57,10 +92,8 @@ :ensure t :config (require 'lsp-java-boot)) -;; Terminal (global-set-key (kbd "C-c t") 'ansi-term) -;; HTML/CSS/JS (use-package web-mode :ensure t :mode "\\.html?\\'" @@ -75,12 +108,10 @@ :config (setq emmet-expand-jsx-className? t)) -;; auto-pairs (electric-pair-mode 1) (setq electric-pair-pairs '((?\" . ?\") (?\{ . ?\}) (?\( . ?\)) (?\[ . ?\]) (?\< . ?\>))) (setq electric-pair-text-pairs electric-pair-pairs) -;; LANGUAGESSSS (use-package nix-mode :ensure t :mode "\\.nix\\'") (use-package python :mode "\\.py\\'") (use-package sh-script :mode "\\.sh\\'") @@ -95,22 +126,14 @@ (use-package typescript-mode :ensure t :mode "\\.ts\\'") (use-package toml-mode :ensure t :mode "\\.toml\\'") (use-package yaml-mode :ensure t :mode "\\.ya?ml\\'") + (custom-set-variables - ;; custom-set-variables was added by Custom. - ;; If you edit it by hand, you could mess it up, so be careful. - ;; Your init file should contain only one such instance. - ;; If there is more than one, they won't work right. - '(package-selected-packages - '(all-the-icons company consult darcula-theme doom-modeline - doom-themes elcord emmet-mode fennel-mode flycheck - gemini-mode go-mode lsp-java lsp-ui lua-mode - macrostep marginalia neotree nix-mode rainbow-mode - rust-mode solarized-theme swiper toml-mode - typescript-mode vertico vterm web-mode yaml-mode - yasnippet zig-mode))) -(custom-set-faces - ;; custom-set-faces was added by Custom. - ;; If you edit it by hand, you could mess it up, so be careful. - ;; Your init file should contain only one such instance. - ;; If there is more than one, they won't work right. - ) + '(package-selected-packages + '(all-the-icons company consult doom-modeline + doom-themes elcord emmet-mode fennel-mode flycheck + go-mode lsp-java lsp-ui lua-mode + macrostep marginalia neotree nix-mode rainbow-mode + rust-mode swiper toml-mode + typescript-mode vertico web-mode yaml-mode + yasnippet zig-mode evil evil-collection evil-surround evil-commentary))) +(custom-set-faces) diff --git a/config/nvim/Makefile b/config/nvim/Makefile deleted file mode 100644 index 1370749..0000000 --- a/config/nvim/Makefile +++ /dev/null @@ -1,4 +0,0 @@ -all: lua/config.lua - -lua/%.lua: fnl/%.fnl - fennel --compile $< > $@ \ No newline at end of file diff --git a/config/nvim/fnl/config.fnl b/config/nvim/fnl/config.fnl deleted file mode 100644 index f836251..0000000 --- a/config/nvim/fnl/config.fnl +++ /dev/null @@ -1,98 +0,0 @@ -(fn setup-qol [] - (set vim.o.swapfile false) - (set vim.o.backup false) - (set vim.o.undofile true) - - (set vim.o.updatetime 200) - (set vim.o.timeoutlen 300) - - (set vim.wo.number true) - (set vim.wo.relativenumber true) - - (set vim.o.clipboard "unnamedplus") - - (set vim.o.splitright true) - (set vim.o.splitbelow true) - - (set vim.o.tabstop 4) - (set vim.o.shiftwidth 4) - (set vim.o.expandtab true) - (set vim.o.smartindent true) - - (set vim.o.autochdir true) - - (vim.api.nvim_create_autocmd - :BufReadPost - {:callback - #(let [line (vim.fn.line "'\"") - last (vim.fn.line "$")] - (when (and (> line 1) (< line last)) - (vim.api.nvim_win_set_cursor 0 [line 0])))}) - - (vim.api.nvim_create_autocmd - :TextYankPost - {:pattern "*" - :callback #(vim.highlight.on_yank {:higroup "IncSearch" :timeout 200})}) - - (vim.api.nvim_create_autocmd - :BufWritePre - {:pattern "*" - :callback #(vim.cmd "silent! %s/\\s\\+$//e")}) - - (vim.api.nvim_create_autocmd - :FileType - {:pattern ["qf" "help" "man" "lspinfo"] - :callback #(vim.keymap.set "n" "q" ":close" {:buffer true :silent true})}) - - (set vim.o.showmode false) - - (set vim.g.netrw_banner 0) - (set vim.g.netrw_liststyle 3) - (set vim.g.netrw_winsize 25) - - (vim.cmd "colorscheme gruvbox") -) - -(fn setup-lsp [] - (local lspconfig (require "lspconfig")) - (local mason (require "mason")) - (local mason_lspconfig (require "mason-lspconfig")) - (local cmp_nvim_lsp (require "cmp_nvim_lsp")) - - (mason.setup {}) - (mason_lspconfig.setup - {:ensure_installed ["pyright" "lua_ls" "bashls" "tsserver"] - :automatic_installation true}) - - (local on_attach (fn [client bufnr] - (local opts {:noremap true :silent true :buffer bufnr}) - - (vim.keymap.set "n" "gd" (fn [] (vim.lsp.buf.definition)) opts) - (vim.keymap.set "n" "K" (fn [] (vim.lsp.buf.hover)) opts) - (vim.keymap.set "n" "gi" (fn [] (vim.lsp.buf.implementation)) opts) - (vim.keymap.set "n" "rn" (fn [] (vim.lsp.buf.rename)) opts) - (vim.keymap.set "n" "ca" (fn [] (vim.lsp.buf.code_action)) opts) - (vim.keymap.set "n" "gr" (fn [] (vim.lsp.buf.references)) opts) - (vim.keymap.set "n" "f" (fn [] (vim.lsp.buf.format {:async true})) opts) - )) - - (local capabilities (cmp_nvim_lsp.default_capabilities) ()) - - (for _, server in ipairs ["pyright" "bashls" "tsserver"] - (lspconfig[server].setup - {:on_attach on_attach - :capabilities capabilities})) - - (lspconfig.lua_ls.setup - {:on_attach on_attach - :capabilities capabilities - :settings - {:Lua - {:diagnostics {:globals ["vim"]} - :workspace - {:library (vim.api.nvim_get_runtime_file "" true) - :checkThirdParty false} - :telemetry {:enable false}}}})) - -(setup-qol) -(setup-lsp) \ No newline at end of file diff --git a/config/nvim/init.lua b/config/nvim/init.lua deleted file mode 100644 index 02db013..0000000 --- a/config/nvim/init.lua +++ /dev/null @@ -1,231 +0,0 @@ -local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" -if not vim.loop.fs_stat(lazypath) then - vim.fn.system({ - "git", - "clone", - "--filter=blob:none", - "https://github.com/folke/lazy.nvim.git", - "--branch=stable", - lazypath, - }) -end -vim.opt.rtp:prepend(lazypath) - --- PREPEND YOUR LOCAL CONFIG PATH TO package.path for patched project_nvim.project -local config_path = vim.fn.stdpath("config") .. "/lua/?.lua;" .. vim.fn.stdpath("config") .. "/lua/?/init.lua;" -package.path = config_path .. package.path - -require("lazy").setup({ - - -- colorscheme plugin - { - "morhetz/gruvbox", - lazy = false, - }, - - -- startup screen - { - "goolord/alpha-nvim", - dependencies = { "nvim-tree/nvim-web-devicons" }, - }, - - -- icons - "nvim-tree/nvim-web-devicons", - - -- fuzzy finder - { - "nvim-telescope/telescope.nvim", - dependencies = { "nvim-lua/plenary.nvim" }, - config = function() - require("telescope").setup { - defaults = { - layout_strategy = "horizontal", - sorting_strategy = "ascending", - prompt_prefix = "🔍 ", - } - } - end, - }, - - -- treesitter - { - "nvim-treesitter/nvim-treesitter", - build = ":TSUpdate", - config = function() - require("nvim-treesitter.configs").setup { - ensure_installed = { "lua", "python", "bash", "javascript", "json" }, - highlight = { enable = true }, - indent = { enable = true }, - } - end, - }, - - -- statusline - { - "nvim-lualine/lualine.nvim", - dependencies = { "nvim-tree/nvim-web-devicons" }, - config = function() - require("lualine").setup { - options = { - theme = "gruvbox", - icons_enabled = false, - section_separators = "", - component_separators = "", - }, - sections = { - lualine_a = { "mode" }, - lualine_b = { "branch" }, - lualine_c = { "filename" }, - lualine_x = { "filetype" }, - lualine_y = { "progress" }, - lualine_z = { "location" }, - }, - inactive_sections = { - lualine_c = { "filename" }, - lualine_x = { "location" }, - }, - } - end, - }, - - -- git signs - { - "lewis6991/gitsigns.nvim", - dependencies = { "nvim-lua/plenary.nvim" }, - config = function() - require("gitsigns").setup() - end, - }, - - -- commenting helper - { - "numToStr/Comment.nvim", - config = function() - require("Comment").setup() - end, - }, - - -- autopairs - { - "windwp/nvim-autopairs", - config = function() - require("nvim-autopairs").setup{} - end, - }, - - -- project management (patched) - { - "ahmedkhalf/project.nvim", - config = function() - -- Force reload patched project module before setup - package.loaded["project_nvim.project"] = nil - package.loaded["project_nvim"] = nil - - require("project_nvim").setup {} - require("telescope").load_extension("projects") - end, - }, - - -- bufferline - { - "akinsho/bufferline.nvim", - dependencies = "nvim-tree/nvim-web-devicons", - config = function() - require("bufferline").setup { - options = { - separator_style = "slant", - show_close_icon = false, - show_buffer_close_icons = false, - diagnostics = "nvim_lsp", - } - } - end, - }, - - -- which-key - { - "folke/which-key.nvim", - config = function() - require("which-key").setup {} - end, - }, - - -- LSP and completion - { - "williamboman/mason.nvim", - config = true, - }, - { - "williamboman/mason-lspconfig.nvim", - dependencies = { "williamboman/mason.nvim", "neovim/nvim-lspconfig" }, - config = true, - }, - { - "neovim/nvim-lspconfig", - }, - { - "hrsh7th/nvim-cmp", - dependencies = { - "hrsh7th/cmp-nvim-lsp", - "hrsh7th/cmp-buffer", - "hrsh7th/cmp-path", - "hrsh7th/cmp-cmdline", - "L3MON4D3/LuaSnip", - "saadparwaiz1/cmp_luasnip", - }, - config = function() - local cmp = require("cmp") - local luasnip = require("luasnip") - - cmp.setup { - snippet = { - expand = function(args) - luasnip.lsp_expand(args.body) - end, - }, - mapping = cmp.mapping.preset.insert({ - [""] = cmp.mapping.scroll_docs(-4), - [""] = cmp.mapping.scroll_docs(4), - [""] = cmp.mapping.complete(), - [""] = cmp.mapping.abort(), - [""] = cmp.mapping.confirm({ select = true }), - }), - sources = cmp.config.sources({ - { name = "nvim_lsp" }, - { name = "luasnip" }, - }, { - { name = "buffer" }, - }), - } - end, - }, - -}) - --- Your existing vim options (you can keep or remove as you want) -vim.o.swapfile = false -vim.o.backup = false -vim.o.undofile = true -vim.o.updatetime = 200 -vim.o.timeoutlen = 300 - -vim.wo.number = true -vim.wo.relativenumber = true - -vim.o.clipboard = "unnamedplus" - -vim.o.splitright = true -vim.o.splitbelow = true - -vim.o.tabstop = 4 -vim.o.shiftwidth = 4 -vim.o.expandtab = true -vim.o.smartindent = true - -vim.o.autochdir = true -vim.o.showmode = false - --- Load your fennel config file safely -pcall(require, "config") - -vim.cmd("colorscheme gruvbox") \ No newline at end of file diff --git a/config/nvim/init.vim b/config/nvim/init.vim new file mode 100644 index 0000000..d85817c --- /dev/null +++ b/config/nvim/init.vim @@ -0,0 +1,62 @@ +set nocompatible +filetype plugin indent on +syntax enable +set encoding=utf-8 +set number relativenumber +set numberwidth=4 +set tabstop=4 shiftwidth=4 expandtab smartindent nowrap +set incsearch hlsearch ignorecase smartcase +set mouse=a +set scrolloff=5 +set cursorline +set noshowmode +set shortmess+=I + +hi Normal guibg=NONE ctermbg=NONE guifg=#d7c49a ctermfg=180 +hi NormalNC guibg=NONE ctermbg=NONE guifg=#b2996e ctermfg=137 +hi LineNr guibg=NONE ctermbg=NONE guifg=#a67c00 ctermfg=136 +hi CursorLine guibg=#4b3621 ctermbg=59 guifg=NONE ctermfg=NONE +hi VertSplit guibg=NONE ctermbg=NONE guifg=#5a3e1b ctermfg=94 +hi StatusLine guibg=#3e2f1c guifg=#f0d38c ctermbg=59 ctermfg=223 +hi StatusLineMode guibg=#d35400 guifg=#3e2f1c ctermbg=166 ctermfg=59 gui=bold +hi Visual guibg=#7f5f2a guifg=NONE ctermbg=136 ctermfg=NONE +hi VisualNOS guibg=#7f5f2a guifg=NONE ctermbg=136 ctermfg=NONE +hi VisualSB guibg=#7f5f2a guifg=NONE ctermbg=136 ctermfg=NONE +hi Search guibg=NONE ctermbg=NONE guifg=#d35400 ctermfg=166 +hi IncSearch guibg=NONE ctermbg=NONE guifg=#f39c12 ctermfg=214 +hi Pmenu guibg=NONE ctermbg=NONE guifg=#d7c49a ctermfg=180 +hi PmenuSel guibg=NONE ctermbg=NONE guifg=#3e2f1c ctermfg=59 +hi WildMenu guibg=NONE ctermbg=NONE guifg=#f39c12 ctermfg=214 +hi Folded guibg=NONE ctermbg=NONE guifg=#a67c00 ctermfg=136 +hi SignColumn guibg=NONE ctermbg=NONE guifg=#a35400 ctermfg=172 + +function! ModeName() +let modeval = mode() +return modeval ==# 'n' ? 'NML ' : +\ modeval ==# 'i' ? 'INT ' : +\ modeval ==# 'v' ? 'VSL ' : +\ modeval ==# 'V' ? 'VLI ' : +\ modeval ==# "\" ? 'VBL ' : +\ modeval ==# 'R' ? 'RPL ' : +\ modeval ==# 'c' ? 'CMD ' : +\ 'UNKNOWN' +endfunction + +set statusline= +set statusline+=%#StatusLineMode# +set statusline+=\ %{ModeName()} +set statusline+=%#StatusLine# +set statusline+=\ %f\ %m\ %r\ %y +set statusline+=%= +set statusline+=\ Ln:%l/%L\ Col:%c\ \[%p%%] + +let mapleader = "\" +nnoremap w \:w +nnoremap q \:q +nnoremap h \:nohlsearch +nnoremap n \:set relativenumber! +nnoremap h +nnoremap j +nnoremap k +nnoremap l + diff --git a/config/nvim/lua/project_nvim/project.lua b/config/nvim/lua/project_nvim/project.lua deleted file mode 100644 index 404b23c..0000000 --- a/config/nvim/lua/project_nvim/project.lua +++ /dev/null @@ -1,286 +0,0 @@ -local config = require("project_nvim.config") -local history = require("project_nvim.utils.history") -local glob = require("project_nvim.utils.globtopattern") -local path = require("project_nvim.utils.path") -local uv = vim.loop -local M = {} - --- Internal states -M.attached_lsp = false -M.last_project = nil - -function M.find_lsp_root() - -- Get lsp client for current buffer - -- Returns nil or string - local buf_ft = vim.api.nvim_buf_get_option(0, "filetype") - local clients = vim.lsp.get_clients({bufnr = 0}) - if next(clients) == nil then - return nil - end - - for _, client in pairs(clients) do - local filetypes = client.config.filetypes - if filetypes and vim.tbl_contains(filetypes, buf_ft) then - if not vim.tbl_contains(config.options.ignore_lsp, client.name) then - return client.config.root_dir, client.name - end - end - end - - return nil -end - -function M.find_pattern_root() - local search_dir = vim.fn.expand("%:p:h", true) - if vim.fn.has("win32") > 0 then - search_dir = search_dir:gsub("\\", "/") - end - - local last_dir_cache = "" - local curr_dir_cache = {} - - local function get_parent(path) - path = path:match("^(.*)/") - if path == "" then - path = "/" - end - return path - end - - local function get_files(file_dir) - last_dir_cache = file_dir - curr_dir_cache = {} - - local dir = uv.fs_scandir(file_dir) - if dir == nil then - return - end - - while true do - local file = uv.fs_scandir_next(dir) - if file == nil then - return - end - - table.insert(curr_dir_cache, file) - end - end - - local function is(dir, identifier) - dir = dir:match(".*/(.*)") - return dir == identifier - end - - local function sub(dir, identifier) - local path = get_parent(dir) - while true do - if is(path, identifier) then - return true - end - local current = path - path = get_parent(path) - if current == path then - return false - end - end - end - - local function child(dir, identifier) - local path = get_parent(dir) - return is(path, identifier) - end - - local function has(dir, identifier) - if last_dir_cache ~= dir then - get_files(dir) - end - local pattern = glob.globtopattern(identifier) - for _, file in ipairs(curr_dir_cache) do - if file:match(pattern) ~= nil then - return true - end - end - return false - end - - local function match(dir, pattern) - local first_char = pattern:sub(1, 1) - if first_char == "=" then - return is(dir, pattern:sub(2)) - elseif first_char == "^" then - return sub(dir, pattern:sub(2)) - elseif first_char == ">" then - return child(dir, pattern:sub(2)) - else - return has(dir, pattern) - end - end - - -- breadth-first search - while true do - for _, pattern in ipairs(config.options.patterns) do - local exclude = false - if pattern:sub(1, 1) == "!" then - exclude = true - pattern = pattern:sub(2) - end - if match(search_dir, pattern) then - if exclude then - break - else - return search_dir, "pattern " .. pattern - end - end - end - - local parent = get_parent(search_dir) - if parent == search_dir or parent == nil then - return nil - end - - search_dir = parent - end -end - ----@diagnostic disable-next-line: unused-local -local on_attach_lsp = function(client, bufnr) - M.on_buf_enter() -- Recalculate root dir after lsp attaches -end - -function M.attach_to_lsp() - if M.attached_lsp then - return - end - - local _start_client = vim.lsp.start_client - vim.lsp.start_client = function(lsp_config) - if lsp_config.on_attach == nil then - lsp_config.on_attach = on_attach_lsp - else - local _on_attach = lsp_config.on_attach - lsp_config.on_attach = function(client, bufnr) - on_attach_lsp(client, bufnr) - _on_attach(client, bufnr) - end - end - return _start_client(lsp_config) - end - - M.attached_lsp = true -end - -function M.set_pwd(dir, method) - if dir ~= nil then - M.last_project = dir - table.insert(history.session_projects, dir) - - if vim.fn.getcwd() ~= dir then - local scope_chdir = config.options.scope_chdir - if scope_chdir == 'global' then - vim.api.nvim_set_current_dir(dir) - elseif scope_chdir == 'tab' then - vim.cmd('tcd ' .. dir) - elseif scope_chdir == 'win' then - vim.cmd('lcd ' .. dir) - else - return - end - - if config.options.silent_chdir == false then - vim.notify("Set CWD to " .. dir .. " using " .. method) - end - end - return true - end - - return false -end - -function M.get_project_root() - -- returns project root, as well as method - for _, detection_method in ipairs(config.options.detection_methods) do - if detection_method == "lsp" then - local root, lsp_name = M.find_lsp_root() - if root ~= nil then - return root, '"' .. lsp_name .. '"' .. " lsp" - end - elseif detection_method == "pattern" then - local root, method = M.find_pattern_root() - if root ~= nil then - return root, method - end - end - end -end - -function M.is_file() - local buf_type = vim.api.nvim_buf_get_option(0, "buftype") - - local whitelisted_buf_type = { "", "acwrite" } - local is_in_whitelist = false - for _, wtype in ipairs(whitelisted_buf_type) do - if buf_type == wtype then - is_in_whitelist = true - break - end - end - if not is_in_whitelist then - return false - end - - return true -end - -function M.on_buf_enter() - if vim.v.vim_did_enter == 0 then - return - end - - if not M.is_file() then - return - end - - local current_dir = vim.fn.expand("%:p:h", true) - if not path.exists(current_dir) or path.is_excluded(current_dir) then - return - end - - local root, method = M.get_project_root() - M.set_pwd(root, method) -end - -function M.add_project_manually() - local current_dir = vim.fn.expand("%:p:h", true) - M.set_pwd(current_dir, 'manual') -end - -function M.init() - local autocmds = {} - if not config.options.manual_mode then - autocmds[#autocmds + 1] = 'autocmd VimEnter,BufEnter * ++nested lua require("project_nvim.project").on_buf_enter()' - - if vim.tbl_contains(config.options.detection_methods, "lsp") then - M.attach_to_lsp() - end - end - - vim.cmd([[ - command! ProjectRoot lua require("project_nvim.project").on_buf_enter() - command! AddProject lua require("project_nvim.project").add_project_manually() - ]]) - - autocmds[#autocmds + 1] = - 'autocmd VimLeavePre * lua require("project_nvim.utils.history").write_projects_to_history()' - - vim.cmd([[augroup project_nvim - au! - ]]) - for _, value in ipairs(autocmds) do - vim.cmd(value) - end - vim.cmd("augroup END") - - history.read_projects_from_history() -end - -return M