nvim
This commit is contained in:
		
							parent
							
								
									a762350f38
								
							
						
					
					
						commit
						86cb768399
					
				
					 5 changed files with 83 additions and 88 deletions
				
			
		| 
						 | 
					@ -1,44 +0,0 @@
 | 
				
			||||||
local ok, catppuccin = pcall(require, "catppuccin")
 | 
					 | 
				
			||||||
if not ok then
 | 
					 | 
				
			||||||
    return
 | 
					 | 
				
			||||||
end
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
catppuccin.setup {
 | 
					 | 
				
			||||||
    flavour = "mocha", -- latte, frappe, macchiato, mocha
 | 
					 | 
				
			||||||
    transparent_background = true,
 | 
					 | 
				
			||||||
    dim_inactive = {
 | 
					 | 
				
			||||||
        enabled = false,
 | 
					 | 
				
			||||||
        -- shade = "dark",
 | 
					 | 
				
			||||||
        -- percentage = 0.15,
 | 
					 | 
				
			||||||
    },
 | 
					 | 
				
			||||||
    integrations = {
 | 
					 | 
				
			||||||
        cmp = true,
 | 
					 | 
				
			||||||
        fidget = true,
 | 
					 | 
				
			||||||
        gitsigns = true,
 | 
					 | 
				
			||||||
        indent_blankline = {
 | 
					 | 
				
			||||||
            enabled = true,
 | 
					 | 
				
			||||||
            colored_indent_levels = false,
 | 
					 | 
				
			||||||
        },
 | 
					 | 
				
			||||||
        mason = true,
 | 
					 | 
				
			||||||
        native_lsp = {
 | 
					 | 
				
			||||||
            enabled = true,
 | 
					 | 
				
			||||||
            virtual_text = {
 | 
					 | 
				
			||||||
                errors = { "italic" },
 | 
					 | 
				
			||||||
                hints = { "italic" },
 | 
					 | 
				
			||||||
                warnings = { "italic" },
 | 
					 | 
				
			||||||
                information = { "italic" },
 | 
					 | 
				
			||||||
            },
 | 
					 | 
				
			||||||
            underlines = {
 | 
					 | 
				
			||||||
                errors = { "underline" },
 | 
					 | 
				
			||||||
                hints = { "underline" },
 | 
					 | 
				
			||||||
                warnings = { "underline" },
 | 
					 | 
				
			||||||
                information = { "underline" },
 | 
					 | 
				
			||||||
            },
 | 
					 | 
				
			||||||
        },
 | 
					 | 
				
			||||||
        telescope = true,
 | 
					 | 
				
			||||||
        treesitter = true,
 | 
					 | 
				
			||||||
        treesitter_context = true,
 | 
					 | 
				
			||||||
    },
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
vim.cmd.colorscheme "catppuccin"
 | 
					 | 
				
			||||||
| 
						 | 
					@ -1,34 +0,0 @@
 | 
				
			||||||
local ok, gs = pcall(require, "gitsigns")
 | 
					 | 
				
			||||||
if not ok then
 | 
					 | 
				
			||||||
    return
 | 
					 | 
				
			||||||
end
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
gs.setup {
 | 
					 | 
				
			||||||
    current_line_blame = true,
 | 
					 | 
				
			||||||
    current_line_blame_opts = {
 | 
					 | 
				
			||||||
        delay = 300,
 | 
					 | 
				
			||||||
    },
 | 
					 | 
				
			||||||
    on_attach = function(bufnr)
 | 
					 | 
				
			||||||
        local nmap = require("my.utils").nmap
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        nmap("]c", function()
 | 
					 | 
				
			||||||
            if vim.wo.diff then
 | 
					 | 
				
			||||||
                return "]c"
 | 
					 | 
				
			||||||
            end
 | 
					 | 
				
			||||||
            vim.schedule(function()
 | 
					 | 
				
			||||||
                gs.next_hunk()
 | 
					 | 
				
			||||||
            end)
 | 
					 | 
				
			||||||
            return "<Ignore>"
 | 
					 | 
				
			||||||
        end, "next hunk", bufnr)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        nmap("[c", function()
 | 
					 | 
				
			||||||
            if vim.wo.diff then
 | 
					 | 
				
			||||||
                return "[c"
 | 
					 | 
				
			||||||
            end
 | 
					 | 
				
			||||||
            vim.schedule(function()
 | 
					 | 
				
			||||||
                gs.prev_hunk()
 | 
					 | 
				
			||||||
            end)
 | 
					 | 
				
			||||||
            return "<Ignore>"
 | 
					 | 
				
			||||||
        end, "previous hunk", bufnr)
 | 
					 | 
				
			||||||
    end,
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
| 
						 | 
					@ -27,7 +27,7 @@ end
 | 
				
			||||||
vim.opt.rtp:prepend(lazypath)
 | 
					vim.opt.rtp:prepend(lazypath)
 | 
				
			||||||
require("lazy").setup("plugins")
 | 
					require("lazy").setup("plugins")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
vim.opt.background = "dark"
 | 
					-- vim.opt.background = "dark"
 | 
				
			||||||
vim.opt.clipboard = "unnamedplus"
 | 
					vim.opt.clipboard = "unnamedplus"
 | 
				
			||||||
vim.opt.colorcolumn = { 100 }
 | 
					vim.opt.colorcolumn = { 100 }
 | 
				
			||||||
vim.opt.completeopt = "menu,menuone,noselect"
 | 
					vim.opt.completeopt = "menu,menuone,noselect"
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,3 +1,5 @@
 | 
				
			||||||
 | 
					local M = {}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
local resize = require("my.resize").resize
 | 
					local resize = require("my.resize").resize
 | 
				
			||||||
local utils = require "my.utils"
 | 
					local utils = require "my.utils"
 | 
				
			||||||
local nmap, imap, vmap = utils.nmap, utils.imap, utils.vmap
 | 
					local nmap, imap, vmap = utils.nmap, utils.imap, utils.vmap
 | 
				
			||||||
| 
						 | 
					@ -62,7 +64,7 @@ vmap("<Leader>p", '"_dP')
 | 
				
			||||||
vmap(">", ">gv")
 | 
					vmap(">", ">gv")
 | 
				
			||||||
vmap("<", "<gv")
 | 
					vmap("<", "<gv")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
local function lsp_keymaps(client, bufnr)
 | 
					M.lsp_keymaps = function(client, bufnr)
 | 
				
			||||||
    nmap("<Leader>r", vim.lsp.buf.rename, "Rename", bufnr)
 | 
					    nmap("<Leader>r", vim.lsp.buf.rename, "Rename", bufnr)
 | 
				
			||||||
    nmap("<Leader>cf", vim.lsp.buf.format, "Format document", bufnr)
 | 
					    nmap("<Leader>cf", vim.lsp.buf.format, "Format document", bufnr)
 | 
				
			||||||
    nmap("<Leader>ca", vim.lsp.buf.code_action, "Code actions", bufnr)
 | 
					    nmap("<Leader>ca", vim.lsp.buf.code_action, "Code actions", bufnr)
 | 
				
			||||||
| 
						 | 
					@ -75,7 +77,7 @@ local function lsp_keymaps(client, bufnr)
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
end
 | 
					end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
local function telescope_keymaps(fns)
 | 
					M.telescope_keymaps = function(fns)
 | 
				
			||||||
    nmap("<C-p>", fns.project, "Find project files")
 | 
					    nmap("<C-p>", fns.project, "Find project files")
 | 
				
			||||||
    nmap("<Leader>fn", fns.dotfiles, "Dotfiles")
 | 
					    nmap("<Leader>fn", fns.dotfiles, "Dotfiles")
 | 
				
			||||||
    nmap("<Leader><C-p>", fns.builtin.git_files, "Find git files")
 | 
					    nmap("<Leader><C-p>", fns.builtin.git_files, "Find git files")
 | 
				
			||||||
| 
						 | 
					@ -83,7 +85,28 @@ local function telescope_keymaps(fns)
 | 
				
			||||||
    nmap("<Leader>gs", fns.builtin.git_status, "Git status")
 | 
					    nmap("<Leader>gs", fns.builtin.git_status, "Git status")
 | 
				
			||||||
end
 | 
					end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
return {
 | 
					M.gitsigns_keymaps = function(bufnr)
 | 
				
			||||||
    lsp_keymaps = lsp_keymaps,
 | 
					    local gs = require "gitsigns"
 | 
				
			||||||
    telescope_keymaps = telescope_keymaps,
 | 
					
 | 
				
			||||||
}
 | 
					    nmap("]c", function()
 | 
				
			||||||
 | 
					        if vim.wo.diff then
 | 
				
			||||||
 | 
					            return "]c"
 | 
				
			||||||
 | 
					        end
 | 
				
			||||||
 | 
					        vim.schedule(function()
 | 
				
			||||||
 | 
					            gs.next_hunk()
 | 
				
			||||||
 | 
					        end)
 | 
				
			||||||
 | 
					        return "<Ignore>"
 | 
				
			||||||
 | 
					    end, "next hunk", bufnr)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    nmap("[c", function()
 | 
				
			||||||
 | 
					        if vim.wo.diff then
 | 
				
			||||||
 | 
					            return "[c"
 | 
				
			||||||
 | 
					        end
 | 
				
			||||||
 | 
					        vim.schedule(function()
 | 
				
			||||||
 | 
					            gs.prev_hunk()
 | 
				
			||||||
 | 
					        end)
 | 
				
			||||||
 | 
					        return "<Ignore>"
 | 
				
			||||||
 | 
					    end, "previous hunk", bufnr)
 | 
				
			||||||
 | 
					end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					return M
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -3,7 +3,48 @@ return {
 | 
				
			||||||
        "catppuccin/nvim",
 | 
					        "catppuccin/nvim",
 | 
				
			||||||
        lazy = false,    -- make sure we load this during startup if it is your main colorscheme
 | 
					        lazy = false,    -- make sure we load this during startup if it is your main colorscheme
 | 
				
			||||||
        priority = 1000, -- make sure to load this before all the other start plugins
 | 
					        priority = 1000, -- make sure to load this before all the other start plugins
 | 
				
			||||||
        name = "catppuccin"
 | 
					        name = "catppuccin",
 | 
				
			||||||
 | 
					        opts = {
 | 
				
			||||||
 | 
					            flavour = "mocha", -- latte, frappe, macchiato, mocha
 | 
				
			||||||
 | 
					            transparent_background = false,
 | 
				
			||||||
 | 
					            dim_inactive = {
 | 
				
			||||||
 | 
					                enabled = true,
 | 
				
			||||||
 | 
					                shade = "dark",
 | 
				
			||||||
 | 
					                percentage = 0.15,
 | 
				
			||||||
 | 
					            },
 | 
				
			||||||
 | 
					            integrations = {
 | 
				
			||||||
 | 
					                cmp = true,
 | 
				
			||||||
 | 
					                fidget = true,
 | 
				
			||||||
 | 
					                gitsigns = true,
 | 
				
			||||||
 | 
					                indent_blankline = {
 | 
				
			||||||
 | 
					                    enabled = true,
 | 
				
			||||||
 | 
					                    colored_indent_levels = false,
 | 
				
			||||||
 | 
					                },
 | 
				
			||||||
 | 
					                mason = true,
 | 
				
			||||||
 | 
					                native_lsp = {
 | 
				
			||||||
 | 
					                    enabled = true,
 | 
				
			||||||
 | 
					                    virtual_text = {
 | 
				
			||||||
 | 
					                        errors = { "italic" },
 | 
				
			||||||
 | 
					                        hints = { "italic" },
 | 
				
			||||||
 | 
					                        warnings = { "italic" },
 | 
				
			||||||
 | 
					                        information = { "italic" },
 | 
				
			||||||
 | 
					                    },
 | 
				
			||||||
 | 
					                    underlines = {
 | 
				
			||||||
 | 
					                        errors = { "underline" },
 | 
				
			||||||
 | 
					                        hints = { "underline" },
 | 
				
			||||||
 | 
					                        warnings = { "underline" },
 | 
				
			||||||
 | 
					                        information = { "underline" },
 | 
				
			||||||
 | 
					                    },
 | 
				
			||||||
 | 
					                },
 | 
				
			||||||
 | 
					                telescope = true,
 | 
				
			||||||
 | 
					                treesitter = true,
 | 
				
			||||||
 | 
					                treesitter_context = true,
 | 
				
			||||||
 | 
					            },
 | 
				
			||||||
 | 
					        },
 | 
				
			||||||
 | 
					        config = function(_LazyPlugin, opts)
 | 
				
			||||||
 | 
					            require("catppuccin").setup(opts)
 | 
				
			||||||
 | 
					            vim.cmd.colorscheme "catppuccin"
 | 
				
			||||||
 | 
					        end
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        "nvim-telescope/telescope.nvim",
 | 
					        "nvim-telescope/telescope.nvim",
 | 
				
			||||||
| 
						 | 
					@ -27,7 +68,7 @@ return {
 | 
				
			||||||
            "nvim-treesitter/nvim-treesitter-context",
 | 
					            "nvim-treesitter/nvim-treesitter-context",
 | 
				
			||||||
            "nvim-treesitter/nvim-treesitter-textobjects",
 | 
					            "nvim-treesitter/nvim-treesitter-textobjects",
 | 
				
			||||||
            "nvim-treesitter/playground",
 | 
					            "nvim-treesitter/playground",
 | 
				
			||||||
        }
 | 
					        },
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        "j-hui/fidget.nvim",
 | 
					        "j-hui/fidget.nvim",
 | 
				
			||||||
| 
						 | 
					@ -82,11 +123,20 @@ return {
 | 
				
			||||||
            use_default_keymaps = false,
 | 
					            use_default_keymaps = false,
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        "lewis6991/gitsigns.nvim",
 | 
				
			||||||
 | 
					        opts = {
 | 
				
			||||||
 | 
					            current_line_blame = true,
 | 
				
			||||||
 | 
					            current_line_blame_opts = {
 | 
				
			||||||
 | 
					                delay = 300,
 | 
				
			||||||
 | 
					            },
 | 
				
			||||||
 | 
					            on_attach = require "my.keymaps".gitsigns_keymaps,
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
    { "lukas-reineke/lsp-format.nvim", tag = "v2.5.1" },
 | 
					    { "lukas-reineke/lsp-format.nvim", tag = "v2.5.1" },
 | 
				
			||||||
    { "nvim-tree/nvim-web-devicons",   lazy = true },
 | 
					    { "nvim-tree/nvim-web-devicons",   lazy = true },
 | 
				
			||||||
    "L3MON4D3/LuaSnip",
 | 
					    "L3MON4D3/LuaSnip",
 | 
				
			||||||
    "hrsh7th/cmp-cmdline",
 | 
					    "hrsh7th/cmp-cmdline",
 | 
				
			||||||
    "lewis6991/gitsigns.nvim",
 | 
					 | 
				
			||||||
    "neovim/nvim-lspconfig",
 | 
					    "neovim/nvim-lspconfig",
 | 
				
			||||||
    "nvim-lualine/lualine.nvim",
 | 
					    "nvim-lualine/lualine.nvim",
 | 
				
			||||||
    "onsails/lspkind.nvim",
 | 
					    "onsails/lspkind.nvim",
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue