From d1a430248ac9dabf40f9d258ff12eb63f7f9a5ec Mon Sep 17 00:00:00 2001 From: ch1bs Date: Sun, 19 May 2024 23:59:17 +0300 Subject: [PATCH 1/7] add addons, some prefs --- README.md | 2 +- init.lua | 32 ++++++++++++++++----------- lua/custom/plugins/fugitive.lua | 38 +++++++++++++++++++++++++++++++++ lua/custom/plugins/undotree.lua | 7 ++++++ lua/custom/plugins/zenmode.lua | 32 +++++++++++++++++++++++++++ 5 files changed, 98 insertions(+), 13 deletions(-) create mode 100644 lua/custom/plugins/fugitive.lua create mode 100644 lua/custom/plugins/undotree.lua create mode 100644 lua/custom/plugins/zenmode.lua diff --git a/README.md b/README.md index f445b65ecd5..2de4d4a0c09 100644 --- a/README.md +++ b/README.md @@ -83,7 +83,7 @@ git clone https://github.com/nvim-lua/kickstart.nvim.git %userprofile%\AppData\L If you're using `powershell.exe` ``` -git clone https://github.com/nvim-lua/kickstart.nvim.git $env:USERPROFILE\AppData\Local\nvim\ +gimv /home/user/oldname /home/user/newnamet clone https://github.com/nvim-lua/kickstart.nvim.git $env:USERPROFILE\AppData\Local\nvim\ ``` diff --git a/init.lua b/init.lua index 88658ef3033..4c80c36d977 100644 --- a/init.lua +++ b/init.lua @@ -91,7 +91,7 @@ vim.g.mapleader = ' ' vim.g.maplocalleader = ' ' -- 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` @@ -118,8 +118,15 @@ vim.opt.clipboard = 'unnamedplus' -- Enable break indent vim.opt.breakindent = true +-- My settings +vim.opt.smartindent = true +vim.opt.wrap = false +vim.opt.swapfile = false +vim.opt.backup = false + -- Save undo history vim.opt.undofile = true +vim.opt.undodir = os.getenv("HOME") .. "/.vim/undodir" -- Case-insensitive searching UNLESS \C or one or more capital letters in the search term vim.opt.ignorecase = true @@ -238,7 +245,7 @@ require('lazy').setup({ -- require('Comment').setup({}) -- "gc" to comment visual regions/lines - { 'numToStr/Comment.nvim', opts = {} }, + { 'numToStr/Comment.nvim', opts = {} }, -- Here is a more advanced example where we pass configuration -- options to `gitsigns.nvim`. This is equivalent to the following Lua: @@ -273,7 +280,7 @@ require('lazy').setup({ -- after the plugin has been loaded: -- config = function() ... end - { -- Useful plugin to show you pending keybinds. + { -- Useful plugin to show you pending keybinds. 'folke/which-key.nvim', event = 'VimEnter', -- Sets the loading event to 'VimEnter' config = function() -- This is the function that runs, AFTER loading @@ -325,7 +332,7 @@ require('lazy').setup({ { 'nvim-telescope/telescope-ui-select.nvim' }, -- Useful for getting pretty icons, but requires a Nerd Font. - { 'nvim-tree/nvim-web-devicons', enabled = vim.g.have_nerd_font }, + { 'nvim-tree/nvim-web-devicons', enabled = vim.g.have_nerd_font }, }, config = function() -- Telescope is a fuzzy finder that comes with a lot of different things that @@ -418,11 +425,11 @@ require('lazy').setup({ -- Useful status updates for LSP. -- NOTE: `opts = {}` is the same as calling `require('fidget').setup({})` - { 'j-hui/fidget.nvim', opts = {} }, + { 'j-hui/fidget.nvim', opts = {} }, -- `neodev` configures Lua LSP for your Neovim config, runtime and plugins -- used for completion, annotations and signatures of Neovim apis - { 'folke/neodev.nvim', opts = {} }, + { 'folke/neodev.nvim', opts = {} }, }, config = function() -- Brief aside: **What is LSP?** @@ -605,9 +612,9 @@ require('lazy').setup({ -- You can add other tools here that you want Mason to install -- for you, so that they are available from within Neovim. local ensure_installed = vim.tbl_keys(servers or {}) - vim.list_extend(ensure_installed, { - 'stylua', -- Used to format Lua code - }) + --vim.list_extend(ensure_installed, { + -- 'stylua', -- Used to format Lua code + --}) require('mason-tool-installer').setup { ensure_installed = ensure_installed } require('mason-lspconfig').setup { @@ -785,7 +792,8 @@ require('lazy').setup({ -- Like many other themes, this one has different styles, and you could load -- any other, such as 'tokyonight-storm', 'tokyonight-moon', or 'tokyonight-day'. vim.cmd.colorscheme 'tokyonight-night' - + vim.api.nvim_set_hl(0, "Normal", { bg = "none" }) + vim.api.nvim_set_hl(0, "NormalFloat", { bg = "none" }) -- You can configure highlights by doing something like: vim.cmd.hi 'Comment gui=none' end, @@ -835,7 +843,7 @@ require('lazy').setup({ 'nvim-treesitter/nvim-treesitter', build = ':TSUpdate', opts = { - ensure_installed = { 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'vim', 'vimdoc' }, + ensure_installed = { 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'vim', 'vimdoc', 'python' }, -- Autoinstall languages that are not installed auto_install = true, highlight = { @@ -885,7 +893,7 @@ require('lazy').setup({ -- -- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going. -- For additional information, see `:help lazy.nvim-lazy.nvim-structuring-your-plugins` - -- { import = 'custom.plugins' }, + { import = 'custom.plugins' }, }, { ui = { -- If you are using a Nerd Font: set icons to an empty table which will use the diff --git a/lua/custom/plugins/fugitive.lua b/lua/custom/plugins/fugitive.lua new file mode 100644 index 00000000000..7104c7acce7 --- /dev/null +++ b/lua/custom/plugins/fugitive.lua @@ -0,0 +1,38 @@ +return { + "tpope/vim-fugitive", + config = function() + vim.keymap.set("n", "gs", vim.cmd.Git) + + local Chibs_Fugitive = vim.api.nvim_create_augroup("ThePrimeagen_Fugitive", {}) + + local autocmd = vim.api.nvim_create_autocmd + autocmd("BufWinEnter", { + group = Chibs_Fugitive, + pattern = "*", + callback = function() + if vim.bo.ft ~= "fugitive" then + return + end + + local bufnr = vim.api.nvim_get_current_buf() + local opts = { buffer = bufnr, remap = false } + vim.keymap.set("n", "p", function() + vim.cmd.Git('push') + end, opts) + + -- rebase always + vim.keymap.set("n", "P", function() + vim.cmd.Git({ 'pull', '--rebase' }) + end, opts) + + -- NOTE: It allows me to easily set the branch i am pushing and any tracking + -- needed if i did not set the branch up correctly + vim.keymap.set("n", "t", ":Git push -u origin ", opts); + end, + }) + + + vim.keymap.set("n", "gu", "diffget //2") + vim.keymap.set("n", "gh", "diffget //3") + end +} diff --git a/lua/custom/plugins/undotree.lua b/lua/custom/plugins/undotree.lua new file mode 100644 index 00000000000..c2a46cdc309 --- /dev/null +++ b/lua/custom/plugins/undotree.lua @@ -0,0 +1,7 @@ +return { + "mbbill/undotree", + + config = function() + vim.keymap.set("n", "u", vim.cmd.UndotreeToggle) + end +} diff --git a/lua/custom/plugins/zenmode.lua b/lua/custom/plugins/zenmode.lua new file mode 100644 index 00000000000..b1cfb47029b --- /dev/null +++ b/lua/custom/plugins/zenmode.lua @@ -0,0 +1,32 @@ +return { + "folke/zen-mode.nvim", + config = function() + vim.keymap.set("n", "zz", function() + require("zen-mode").setup { + window = { + width = 90, + options = {} + }, + } + require("zen-mode").toggle() + vim.wo.wrap = false + vim.wo.number = true + vim.wo.rnu = true + end) + + + vim.keymap.set("n", "zZ", function() + require("zen-mode").setup { + window = { + width = 80, + options = {} + }, + } + require("zen-mode").toggle() + vim.wo.wrap = false + vim.wo.number = false + vim.wo.rnu = false + vim.opt.colorcolumn = "0" + end) + end +} From c779245033a11b7612b4c3b7987a5bac946dddb7 Mon Sep 17 00:00:00 2001 From: ch1bs Date: Sat, 3 Aug 2024 22:32:59 +0300 Subject: [PATCH 2/7] update --- init.lua | 18 +++++++++++++++++- lua/custom/plugins/oil.lua | 24 ++++++++++++++++++++++++ lua/kickstart/plugins/lint.lua | 3 ++- 3 files changed, 43 insertions(+), 2 deletions(-) create mode 100644 lua/custom/plugins/oil.lua diff --git a/init.lua b/init.lua index 4c80c36d977..042de7cbf04 100644 --- a/init.lua +++ b/init.lua @@ -584,6 +584,21 @@ require('lazy').setup({ -- But for many setups, the LSP (`tsserver`) will work just fine -- tsserver = {}, -- + -- + pylsp = { + settings = { + pylsp = { + plugins = { + pycodestyle = { + maxLineLength = 120, + }, + flake8 = { + maxLineLength = 120, + } + } + } + } + }, lua_ls = { -- cmd = {...}, @@ -646,7 +661,7 @@ require('lazy').setup({ }, }, opts = { - notify_on_error = false, + notify_on_error = true, format_on_save = function(bufnr) -- Disable "format_on_save lsp_fallback" for languages that don't -- have a well standardized coding style. You can add additional @@ -659,6 +674,7 @@ require('lazy').setup({ end, formatters_by_ft = { lua = { 'stylua' }, + python = { 'black', args = { "--line-length", "120" } }, -- Conform can also run multiple formatters sequentially -- python = { "isort", "black" }, -- diff --git a/lua/custom/plugins/oil.lua b/lua/custom/plugins/oil.lua new file mode 100644 index 00000000000..b3b2ed59802 --- /dev/null +++ b/lua/custom/plugins/oil.lua @@ -0,0 +1,24 @@ +return { + { + "stevearc/oil.nvim", + dependencies = { "nvim-tree/nvim-web-devicons" }, + config = function() + require("oil").setup { + columns = { "icon" }, + keymaps = { + [""] = false, + [""] = "actions.select_split", + }, + view_options = { + show_hidden = true, + }, + } + + -- Open parent directory in current window + vim.keymap.set("n", "-", "Oil", { desc = "Open parent directory" }) + + -- Open parent directory in floating window + vim.keymap.set("n", "-", require("oil").toggle_float) + end, + }, +} diff --git a/lua/kickstart/plugins/lint.lua b/lua/kickstart/plugins/lint.lua index 7f0dc42fbbf..095eb8ee7f4 100644 --- a/lua/kickstart/plugins/lint.lua +++ b/lua/kickstart/plugins/lint.lua @@ -8,7 +8,8 @@ return { lint.linters_by_ft = { markdown = { 'markdownlint' }, } - + local flake8 = lint.linters.flake8 + flake8.cmd = "flake8 --max-line-length 120" -- To allow other plugins to add linters to require('lint').linters_by_ft, -- instead set linters_by_ft like this: -- lint.linters_by_ft = lint.linters_by_ft or {} From 67be49cbfe171b6232808c58db570bbe6364d1b1 Mon Sep 17 00:00:00 2001 From: ch1bs Date: Wed, 25 Sep 2024 13:57:02 +0300 Subject: [PATCH 3/7] added toggleterm --- init.lua | 13 +++++++------ lua/custom/plugins/toggleterm.lua | 7 +++++++ lua/custom/plugins/transparent.lua | 1 + 3 files changed, 15 insertions(+), 6 deletions(-) create mode 100644 lua/custom/plugins/toggleterm.lua create mode 100644 lua/custom/plugins/transparent.lua diff --git a/init.lua b/init.lua index 042de7cbf04..4214ca396da 100644 --- a/init.lua +++ b/init.lua @@ -280,13 +280,12 @@ require('lazy').setup({ -- after the plugin has been loaded: -- config = function() ... end - { -- Useful plugin to show you pending keybinds. + { -- Useful plugin to show you pending keybinds. 'folke/which-key.nvim', - event = 'VimEnter', -- Sets the loading event to 'VimEnter' - config = function() -- This is the function that runs, AFTER loading - require('which-key').setup() - - -- Document existing key chains + version = "2.1.0", + event = 'VimEnter', -- Sets the loading event to 'VimEnter' + config = function() -- This is the function that runs, AFTER loading + require('which-key').setup() -- Document existing key chains require('which-key').register { ['c'] = { name = '[C]ode', _ = 'which_key_ignore' }, ['d'] = { name = '[D]ocument', _ = 'which_key_ignore' }, @@ -649,6 +648,7 @@ require('lazy').setup({ { -- Autoformat 'stevearc/conform.nvim', + version = "7.1.0", lazy = false, keys = { { @@ -934,3 +934,4 @@ require('lazy').setup({ -- The line beneath this is called `modeline`. See `:help modeline` -- vim: ts=2 sts=2 sw=2 et +require('lspconfig').svelte.setup { filetypes = { "svelte", "html" } } diff --git a/lua/custom/plugins/toggleterm.lua b/lua/custom/plugins/toggleterm.lua new file mode 100644 index 00000000000..779fb577bca --- /dev/null +++ b/lua/custom/plugins/toggleterm.lua @@ -0,0 +1,7 @@ +return { + 'akinsho/toggleterm.nvim', + version = "*", + config=true, + keys = { {'t', ":ToggleTerm size=15"},} +} + diff --git a/lua/custom/plugins/transparent.lua b/lua/custom/plugins/transparent.lua new file mode 100644 index 00000000000..4d5b87b39f4 --- /dev/null +++ b/lua/custom/plugins/transparent.lua @@ -0,0 +1 @@ +return { "xiyaowong/transparent.nvim" } From 766a88ad146aea731417c2c42c2bfb14fee028a1 Mon Sep 17 00:00:00 2001 From: chibs4 <47668526+chibs4@users.noreply.github.com> Date: Thu, 3 Oct 2024 14:15:57 +0300 Subject: [PATCH 4/7] Update toggleterm.lua --- lua/custom/plugins/toggleterm.lua | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lua/custom/plugins/toggleterm.lua b/lua/custom/plugins/toggleterm.lua index 779fb577bca..87f9398c221 100644 --- a/lua/custom/plugins/toggleterm.lua +++ b/lua/custom/plugins/toggleterm.lua @@ -1,7 +1,10 @@ return { 'akinsho/toggleterm.nvim', version = "*", - config=true, - keys = { {'t', ":ToggleTerm size=15"},} + config = true, + keys = { + { 't', ":ToggleTerm size=15" }, + { 't', mode = { "t" }, "ToggleTerm size=15" }, + { '', mode = { "t" }, [[]] } + } } - From 71ccfc85bc62f57d502eeb7713a8d0304b127620 Mon Sep 17 00:00:00 2001 From: chibs4 <47668526+chibs4@users.noreply.github.com> Date: Thu, 10 Oct 2024 18:01:45 +0300 Subject: [PATCH 5/7] Update init.lua --- init.lua | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/init.lua b/init.lua index 4214ca396da..98055ae56f5 100644 --- a/init.lua +++ b/init.lua @@ -164,6 +164,12 @@ vim.opt.scrolloff = 10 -- [[ Basic Keymaps ]] -- See `:help vim.keymap.set()` +-- Set pasting from 0 register +vim.keymap.set('n', 'p', '"0p') +-- Set deleting into nothing +vim.keymap.set('n', 'd', '"_d') +vim.keymap.set('x', 'd', '"_d') + -- Set highlight on search, but clear on pressing in normal mode vim.opt.hlsearch = true vim.keymap.set('n', '', 'nohlsearch') From 42ba661c86c2f34f4d6bba54f6944f531fd20073 Mon Sep 17 00:00:00 2001 From: chibs4 <47668526+chibs4@users.noreply.github.com> Date: Tue, 19 Nov 2024 14:18:39 +0300 Subject: [PATCH 6/7] Update init.lua --- init.lua | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/init.lua b/init.lua index 98055ae56f5..a20abf9f940 100644 --- a/init.lua +++ b/init.lua @@ -98,6 +98,10 @@ vim.g.have_nerd_font = true -- NOTE: You can change these options as you wish! -- For more options, you can see `:help option-list` +-- Русский язык +vim.opt.langmap = +"ФИСВУАПРШОЛДЬТЩЗЙКЫЕГМЦЧНЯ;ABCDEFGHIJKLMNOPQRSTUVWXYZ,фисвуапршолдьтщзйкыегмцчня;abcdefghijklmnopqrstuvwxyz" + -- Make line numbers default vim.opt.number = true -- You can also add relative line numbers, to help with jumping. @@ -163,6 +167,7 @@ vim.opt.scrolloff = 10 -- [[ Basic Keymaps ]] -- See `:help vim.keymap.set()` +vim.keymap.set("i", "jk", "") -- Set pasting from 0 register vim.keymap.set('n', 'p', '"0p') From 6605e3461eb554931bab145d992ce0a095414f87 Mon Sep 17 00:00:00 2001 From: chibs4 <47668526+chibs4@users.noreply.github.com> Date: Mon, 7 Apr 2025 14:07:03 +0300 Subject: [PATCH 7/7] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 2de4d4a0c09..cb83d2ea2a7 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ +https://www.reddit.com/r/neovim/comments/193hxsb/i_write_sql_most_days_is_neovim_still_worth_it/ + # kickstart.nvim ## Introduction