From bfbd5df2741bbe211cbb127e11c11d0d62637106 Mon Sep 17 00:00:00 2001 From: iGor milhit Date: Thu, 1 Jun 2023 07:20:55 +0200 Subject: [PATCH] plugins: remove and install some - Removes vim-rhubarb (github related). - Sets autopairs and vim-surround. - Adds and configures true-zen and twilight Co-Authored-by: iGor milhit --- init.lua | 8 +++++++- lua/custom/plugins/autopairs.lua | 17 ++++++++++++++++ lua/custom/plugins/true-zen.lua | 35 ++++++++++++++++++++++++++++++++ lua/custom/plugins/zen-mode.lua | 35 ++++++++++++++++++++++++++++++++ 4 files changed, 94 insertions(+), 1 deletion(-) create mode 100644 lua/custom/plugins/autopairs.lua create mode 100644 lua/custom/plugins/true-zen.lua create mode 100644 lua/custom/plugins/zen-mode.lua diff --git a/init.lua b/init.lua index c157436..378d37c 100644 --- a/init.lua +++ b/init.lua @@ -35,6 +35,7 @@ I hope you enjoy your Neovim journey, P.S. You can delete this when you're done too. It's your config now :) --]] + -- Set as the leader key -- See `:help mapleader` -- NOTE: Must happen before plugins are required (otherwise wrong leader will be used) @@ -67,11 +68,13 @@ require('lazy').setup({ -- Git related plugins 'tpope/vim-fugitive', - 'tpope/vim-rhubarb', -- Detect tabstop and shiftwidth automatically 'tpope/vim-sleuth', + -- Improve surroundings management + 'tpope/vim-surround', + -- NOTE: This is where your plugins related to LSP can be installed. -- The configuration is done below. Search for lspconfig to find it below. { @@ -227,8 +230,11 @@ vim.wo.number = true -- Set the maximum width of a line vim.opt.textwidth = 79 +-- Display the cusor column at 79+1 column +vim.opt.colorcolumn:append('+1') -- Set text formatting options +-- 'a' is for autoformat -- vim.opt.formatoptions:append('a') -- Enable mouse mode diff --git a/lua/custom/plugins/autopairs.lua b/lua/custom/plugins/autopairs.lua new file mode 100644 index 0000000..3f3d978 --- /dev/null +++ b/lua/custom/plugins/autopairs.lua @@ -0,0 +1,17 @@ +-- File: lua/custom/plugins/autopairs.lua + +return { + "windwp/nvim-autopairs", + -- Optional dependency + dependencies = { 'hrsh7th/nvim-cmp' }, + config = function() + require("nvim-autopairs").setup {} + -- If you want to automatically add `(` after selecting a function or method + local cmp_autopairs = require('nvim-autopairs.completion.cmp') + local cmp = require('cmp') + cmp.event:on( + 'confirm_done', + cmp_autopairs.on_confirm_done() + ) + end, +} diff --git a/lua/custom/plugins/true-zen.lua b/lua/custom/plugins/true-zen.lua new file mode 100644 index 0000000..ce6a343 --- /dev/null +++ b/lua/custom/plugins/true-zen.lua @@ -0,0 +1,35 @@ +local api = vim.api + +api.nvim_set_keymap("n", "zn", ":TZNarrow", {}) +api.nvim_set_keymap("v", "zn", ":'<,'>TZNarrow", {}) +api.nvim_set_keymap("n", "zf", ":TZFocus", {}) +api.nvim_set_keymap("n", "zm", ":TZMinimalist", {}) +api.nvim_set_keymap("n", "za", ":TZAtaraxis", {}) + +return { + "Pocco81/true-zen.nvim", + -- Twilight allows to dim text outside of the cursor line. + dependencies = { + "folke/twilight.nvim", + opts = { + -- Set the context to null in order to avoid highlighting to much + -- paragraphs in markdown. + context = 0, + }, + }, + config = function () + require('true-zen').setup({ + modes = { + ataraxis = { + minimum_writing_area = { + width = 100 + } + } + }, + integrations = { + twilight = true, + lualine = true + } + }) + end +} diff --git a/lua/custom/plugins/zen-mode.lua b/lua/custom/plugins/zen-mode.lua new file mode 100644 index 0000000..6ca6d4c --- /dev/null +++ b/lua/custom/plugins/zen-mode.lua @@ -0,0 +1,35 @@ +-- Zen mode with twilight. +-- Improves the edition experience with distraction free feature. + +return { + "folke/zen-mode.nvim", + -- Twilight allows to dim text outside of the cursor line. + dependencies = { + "folke/twilight.nvim", + opts = { + -- Set the context to null in order to avoid highlighting to much + -- paragraphs in markdown. + context = 0, + }, + }, + opts = { + window = { + -- Set the window width (85 columns) and height (80%). + width = 85, + height = .8, + options = { + -- Disable line numbering. + number = false, + signcolumn = "no", + }, + }, + plugins = { + options = { + enabled = true, + ruler = false, + showcmd = false, + }, + gitsigns = { enabled = false }, + }, + }, +}