From f62d9e41a552de90434111779e3cf36965229f13 Mon Sep 17 00:00:00 2001 From: desktop Date: Tue, 5 Dec 2023 21:47:36 +0300 Subject: [PATCH] nvim : use intend detection. --- .config/nvim/lua/plugin/indent.lua | 13 ++- .config/nvim/lua/plugin/init.lua | 140 ++++++++++++++--------------- 2 files changed, 82 insertions(+), 71 deletions(-) diff --git a/.config/nvim/lua/plugin/indent.lua b/.config/nvim/lua/plugin/indent.lua index be401dd..0f8f523 100644 --- a/.config/nvim/lua/plugin/indent.lua +++ b/.config/nvim/lua/plugin/indent.lua @@ -1 +1,12 @@ -require("ibl").setup() +require('indent-o-matic').setup { + -- The values indicated here are the defaults + + -- Number of lines without indentation before giving up (use -1 for infinite) + max_lines = 1024, + + -- Space indentations that should be detected + standard_widths = { 2, 4, 8 }, + + -- Skip multi-line comments and strings (more accurate detection but less performant) + skip_multiline = true, +} diff --git a/.config/nvim/lua/plugin/init.lua b/.config/nvim/lua/plugin/init.lua index ff07de6..bda1d27 100644 --- a/.config/nvim/lua/plugin/init.lua +++ b/.config/nvim/lua/plugin/init.lua @@ -1,85 +1,85 @@ local ensure_packer = function() - local fn = vim.fn - 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://git.voronind.com/mirror/packer.nvim.git", install_path}) - vim.cmd [[packadd packer.nvim]] - return true - end - return false + local fn = vim.fn + 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://git.voronind.com/mirror/packer.nvim.git", install_path}) + vim.cmd [[packadd packer.nvim]] + return true + end + return false end local packer_bootstrap = ensure_packer() local available = function(commands) - for _, command in ipairs(commands) do - if vim.fn.executable(command) ~= 1 then - return false - end - end - return true + for _, command in ipairs(commands) do + if vim.fn.executable(command) ~= 1 then + return false + end + end + return true end return require("packer").startup(function(use) - --[[ - host requirements - - gcc-c++ - ]]-- + --[[ + host requirements + - gcc-c++ + ]]-- - use "https://git.voronind.com/mirror/packer.nvim.git" - use "https://git.voronind.com/mirror/nvim-web-devicons.git" - use "https://git.voronind.com/mirror/nvim-tree.lua.git" - use "https://git.voronind.com/mirror/nvim-lspconfig.git" - use "https://git.voronind.com/mirror/which-key.nvim.git" - use "https://git.voronind.com/mirror/bufferline.nvim.git" - use "https://git.voronind.com/mirror/SingleComment.nvim.git" - use "https://git.voronind.com/mirror/lualine.nvim.git" - use "https://git.voronind.com/mirror/autoclose.nvim.git" - use "https://git.voronind.com/mirror/winshift.nvim.git" - use "https://git.voronind.com/mirror/mason.nvim.git" - use "https://git.voronind.com/mirror/mason-lspconfig.nvim.git" - use "https://git.voronind.com/mirror/gitsigns.nvim.git" - use "https://git.voronind.com/mirror/trouble.nvim.git" - use "https://git.voronind.com/mirror/tokyonight.nvim.git" - use "https://git.voronind.com/mirror/close-buffers.nvim.git" - use "https://git.voronind.com/mirror/plenary.nvim.git" - use "https://git.voronind.com/mirror/telescope.nvim.git" - use "https://git.voronind.com/mirror/nvim-treesitter.git" - use "https://git.voronind.com/mirror/todo-comments.nvim.git" - use "https://git.voronind.com/mirror/align.nvim.git" - use "https://git.voronind.com/mirror/gruvbox-material.git" - use "https://git.voronind.com/mirror/indent-blankline.nvim.git" + use "https://git.voronind.com/mirror/packer.nvim.git" + use "https://git.voronind.com/mirror/nvim-web-devicons.git" + use "https://git.voronind.com/mirror/nvim-tree.lua.git" + use "https://git.voronind.com/mirror/nvim-lspconfig.git" + use "https://git.voronind.com/mirror/which-key.nvim.git" + use "https://git.voronind.com/mirror/bufferline.nvim.git" + use "https://git.voronind.com/mirror/SingleComment.nvim.git" + use "https://git.voronind.com/mirror/lualine.nvim.git" + use "https://git.voronind.com/mirror/autoclose.nvim.git" + use "https://git.voronind.com/mirror/winshift.nvim.git" + use "https://git.voronind.com/mirror/mason.nvim.git" + use "https://git.voronind.com/mirror/mason-lspconfig.nvim.git" + use "https://git.voronind.com/mirror/gitsigns.nvim.git" + use "https://git.voronind.com/mirror/trouble.nvim.git" + use "https://git.voronind.com/mirror/tokyonight.nvim.git" + use "https://git.voronind.com/mirror/close-buffers.nvim.git" + use "https://git.voronind.com/mirror/plenary.nvim.git" + use "https://git.voronind.com/mirror/telescope.nvim.git" + use "https://git.voronind.com/mirror/nvim-treesitter.git" + use "https://git.voronind.com/mirror/todo-comments.nvim.git" + use "https://git.voronind.com/mirror/align.nvim.git" + use "https://git.voronind.com/mirror/gruvbox-material.git" + use "https://git.voronind.com/mirror/indent-o-matic.git" - -- Automatically set up your configuration after cloning packer.nvim - -- Put this at the end after all plugins - if packer_bootstrap then - require("packer").sync() - end + -- Automatically set up your configuration after cloning packer.nvim + -- Put this at the end after all plugins + if packer_bootstrap then + require("packer").sync() + end - -- plugin toggles. - local treesitter = true + -- plugin toggles. + local treesitter = true - -- plugin setup. - require("plugin/mason") - require("plugin/lsp/init") - require("plugin/filetree") - require("plugin/bufferline") - require("plugin/lualine") - require("plugin/autoclose") - require("plugin/winshift") - require("plugin/gitsigns") - require("plugin/trouble") - require("plugin/tokyonight") - require("plugin/gruvbox") - require("plugin/closebuffers") - require("plugin/telescope") - require("plugin/todo") - require("plugin/indent") + -- plugin setup. + require("plugin/mason") + require("plugin/lsp/init") + require("plugin/filetree") + require("plugin/bufferline") + require("plugin/lualine") + require("plugin/autoclose") + require("plugin/winshift") + require("plugin/gitsigns") + require("plugin/trouble") + require("plugin/tokyonight") + require("plugin/gruvbox") + require("plugin/closebuffers") + require("plugin/telescope") + require("plugin/todo") + require("plugin/indent") - if available({"g++"}) then - if treesitter then - require("plugin/treesitter") - require("plugin/fold") - end - end + if available({"g++"}) then + if treesitter then + require("plugin/treesitter") + require("plugin/fold") + end + end end)