Asfand Ali
Asfand Ali

Reputation: 51

Overriding default neovim dashboard and/or default glepnir/dashboard-nvim dashboard doesn't work

I am able to see the pure default nvim dashboard that is like a maroon-ish colour and the dashboard is something like nvim 0.9.0-dev... as well as when i run all of the below code, i can see the dashboard-nvim dashboard that has a big block of acii that says 'dashboard', but i cant seem to see my own neovim ascii that i try to set using vim.g.dashboard_custom_header in set.lua

These are essentially all the relevant bits of code I have, and, yes, ~/.local/share/nvim/site/pack/packer/dashboard-nvim exists, and :CheckHealth looks perectly fine, and i've restartd nvim countless times, and even tried deleting ~/.cache/nvim/dashboard/cache:

~/.config/nvim/init.lua:

require("custom")

~/.config/nvim/lua/custom/init.lua:

require("custom.remap")
require("custom.set")

~/.config/nvim/lua/custom/packer.lua:

--p This file can be loaded by calling `lua require('plugins')` from your init.vim

-- Only required if you have packer configured as `opt`
vim.cmd [[packadd packer.nvim]]

return require('packer').startup(function(use)
    -- Packer can manage itself
    use 'wbthomason/packer.nvim'
    use {
        'nvim-telescope/telescope.nvim', tag = '0.1.1',
        -- or                            , branch = '0.1.x',
        requires = { {'nvim-lua/plenary.nvim'} }
    }
    use('nvim-treesitter/nvim-treesitter', {run = ':TSUpdate'})
    use('nvim-treesitter/playground')
    use('theprimeagen/harpoon')
    use('mbbill/undotree')
    use('tpope/vim-fugitive')
    use('andweeb/presence.nvim')
    use { 'catppuccin/nvim', as = "catppuccin" }
    use('hrsh7th/cmp-nvim-lsp')
    use('hrsh7th/nvim-cmp')
    use('jose-elias-alvarez/null-ls.nvim')
    use('nvim-tree/nvim-web-devicons')
    use('L3MON4D3/LuaSnip')
    use('lewis6991/gitsigns.nvim')
    use('neovim/nvim-lspconfig')
    use('nvim-lualine/lualine.nvim')
    use('nvim-telescope/telescope-file-browser.nvim')
    use('onsails/lspkind-nvim')
    use('ryanoasis/vim-devicons')
    use('saadparwaiz1/cmp_luasnip')
    use('tpope/vim-commentary')
    use('windwp/nvim-autopairs')
    use ("glepnir/dashboard-nvim")
    use {
        'VonHeikemen/lsp-zero.nvim',
        branch = 'v1.x',
        requires = {
            -- LSP Support
            {'neovim/nvim-lspconfig'},             -- Required
            {'williamboman/mason.nvim'},           -- Optional
            {'williamboman/mason-lspconfig.nvim'}, -- Optional

                -- Autocompletion
                {'hrsh7th/nvim-cmp'},         -- Required
                {'hrsh7th/cmp-nvim-lsp'},     -- Required
                {'hrsh7th/cmp-buffer'},       -- Optional
                {'hrsh7th/cmp-path'},         -- Optional
                {'saadparwaiz1/cmp_luasnip'}, -- Optional
                {'hrsh7th/cmp-nvim-lua'},     -- Optional

                -- Snippets
                {'L3MON4D3/LuaSnip'},             -- Required
                {'rafamadriz/friendly-snippets'}, -- Optional
            }
        }
    end)

~/.config/nvim/lua/custom/remap.lua:


vim.g.mapleader = " "
vim.keymap.set("n", "<leader>pv", vim.cmd.Ex)

vim.keymap.set("v", "J", ":m '>+1<CR>gv=gv")
vim.keymap.set("v", "K", ":m '<-2<CR>gv=gv")

vim.keymap.set("n", "J", "mzJ`z")
vim.keymap.set("n", "<C-d>", "<C-d>zz")
vim.keymap.set("n", "<C-u>", "<C-u>zz")
vim.keymap.set("n", "n", "nzzzv")
vim.keymap.set("n", "N", "Nzzzv")

vim.keymap.set("n", "<leader>vwm", function()
    require("vim-with-me").StartVimWithMe()
end)
vim.keymap.set("n", "<leader>svwm", function()
    require("vim-with-me").StopVimWithMe()
end)

-- greatest remap ever
vim.keymap.set("x", "<leader>p", [["_dP]])

-- next greatest remap ever : asbjornHaland
vim.keymap.set({"n", "v"}, "<leader>d", [["_d]])

-- This is going to get me cancelled
vim.keymap.set("i", "<C-c>", "<Esc>")

vim.keymap.set("n", "Q", "<nop>")
vim.keymap.set("n", "<C-f>", "<cmd>silent !tmux neww tmux-sessionizer<CR>")
vim.keymap.set("n", "<leader>f", vim.lsp.buf.format)

vim.keymap.set("n", "<C-k>", "<cmd>cnext<CR>zz")
vim.keymap.set("n", "<C-j>", "<cmd>cprev<CR>zz")
vim.keymap.set("n", "<leader>k", "<cmd>lnext<CR>zz")
vim.keymap.set("n", "<leader>j", "<cmd>lprev<CR>zz")

vim.keymap.set("n", "<leader>s", [[:%s/\<<C-r><C-w>\>/<C-r><C-w>/gI<Left><Left><Left>]])
vim.keymap.set("n", "<leader>x", "<cmd>!chmod +x %<CR>", { silent = true })

vim.keymap.set("n", "<leader>vpp", "<cmd>e ~/.dotfiles/nvim/.config/nvim/lua/theprimeagen/packer.lua<CR>");
vim.keymap.set("n", "<leader>mr", "<cmd>CellularAutomaton make_it_rain<CR>");

vim.keymap.set("n", "<leader><leader>", function()
    vim.cmd("so")
end)

vim.keymap.set("n", "<leader>w", "<C-w>k")
vim.keymap.set("n", "<leader>a", "<C-w>h")
vim.keymap.set("n", "<leader>s", "<C-w>j")
vim.keymap.set("n", "<leader>d", "<C-w>l")
vim.keymap.set("n", "<Tab>", ":bn<CR>", { silent = true })
vim.keymap.set("n", "<S-Tab>", ":bp<CR>", { silent = true })
vim.keymap.set("n", "<leader>q", ":bp<CR>:bd #<CR>", { silent = true })
vim.keymap.set("n", "<leader>x", ":%y<CR>")
vim.keymap.set("n", "k", "v:count == 0 ? \"gk\" : \"k\"", { expr = true, silent = true })
vim.keymap.set("n", "j", "v:count == 0 ? \"gj\" : \"j\"", { expr = true, silent = true })
vim.keymap.set("n", "<leader>t", ":split term://bash <CR>", { silent = true })
vim.keymap.set("t", "<leader><Esc>", "<C-\\><C-n>", { silent = true })
vim.keymap.set("n", "<leader>v", ":edit ~/.config/nvim/init.lua<CR>", { silent = true })

vim.cmd "sign define DiagnosticSignError text= texthl=DiagnosticSignError"
vim.cmd "sign define DiagnosticSignWarn text= texthl=DiagnosticSignWarn" 
vim.cmd "sign define DiagnosticSignInfo text= texthl=DiagnosticSignInfo"
vim.cmd "sign define DiagnosticSignHint text= texthl=DiagnosticSignHint"

~/.config/nvim/lua/custom/set.lua:

vim.g.mapleader = " "

vim.opt.clipboard = "unnamedplus"

vim.opt.nu = true
vim.opt.relativenumber = true

vim.opt.tabstop = 4
vim.opt.softtabstop = 4
vim.opt.shiftwidth = 4
vim.opt.expandtab = true

vim.opt.smartindent = true

vim.opt.wrap = false

vim.opt.swapfile = false
vim.opt.backup = false
vim.opt.undodir = os.getenv("HOME") .. "/.vim/undodir"
vim.opt.undofile = true 

vim.opt.hlsearch = false
vim.opt.incsearch = true

vim.opt.termguicolors = true

vim.opt.scrolloff = 8
vim.opt.signcolumn = "yes"
vim.opt.isfname:append("@-@")

vim.opt.splitbelow = true
vim.opt.splitright = true

vim.opt.list = false

vim.g.catppuccin_flavour = "mocha"
vim.cmd "colorscheme catppuccin"

vim.g.dashboard_default_executive = "telescope"
vim.g.dashboard_custom_header = {
    [[    )       )        (      *      ]],
    [[ ( /(    ( /(        )\ ) (  `     ]],
    [[ )\())(  )\())(   ( (()/( )\))(    ]],
    [[ ((_)\ )\((_)\ )\  )\ /(_)|(_)()\  ]],
    [[  _((_|(_) ((_|(_)((_|_)) (_()((_) ]],
    [[ | \| | __/ _ \ \ / /|_ _||  \/  | ]],
    [[ | .` | _| (_) \ V /  | | | |\/| | ]],
    [[ |_|\_|___\___/ \_/  |___||_|  |_| ]],
}
--vim.g.dashboard_custom_center = {
    --    {
        --        icon = " ",
        --        desc = "New File",
        --        action = "DashboardNewFile",
        --        shortcut = "SPC m",
        --    },
        --    {
            --        icon = "  ",
            --        desc = "Browse Files",
            --        action = "Telescope file_browser",
            --        shortcut = "SPC n",
            --    },
            --    {
                --        icon = "  ",
                --        desc = "Find Files",
                --        action = "Telescope find_files",
                --        shortcut = "SPC f",
                --    },
                --    {
                    --        icon = "󰏫  ",
                    --        desc = "Confgiure Neovim",
                    --        action = "edit ~/.config/nvimlua/init.lua",
                    --        shortcut = "SPC v",
                    --    },
                    --    {
                        --        icon = "󰗼  ",
                        --        desc = "Exit Neovim",
                        --        action = "quit",
                        --    }
                        --}

Upvotes: 2

Views: 3962

Answers (1)

Asfand Ali
Asfand Ali

Reputation: 51

Preface: I'm not sure if this is just some recent update to how glepnir/dashboard-nvim works, im terrible at reading/understanding docs(just me?), it took me spamming internet, yt etc. and when i was adding brackets around the setup curly braces: db.setup({...}) it wasn't working, and one time i forgot to add those(typical dev stuff) and it worked sigh

I have figured this out, some how, some way, as all devs do: ~/.config/nvim/lua/custom/packer.lua:

--p This file can be loaded by calling `lua require('plugins')` from your init.vim

-- Only required if you have packer configured as `opt`
vim.cmd [[packadd packer.nvim]]

return require('packer').startup(function(use)
    -- Packer can manage itself
    use 'wbthomason/packer.nvim'
    use {
        'nvim-telescope/telescope.nvim', tag = '0.1.1',
        -- or                            , branch = '0.1.x',
        requires = { {'nvim-lua/plenary.nvim'} }
    }
    use('nvim-treesitter/nvim-treesitter', {run = ':TSUpdate'})
    use('nvim-treesitter/playground') 
    use('theprimeagen/harpoon') 
    use('mbbill/undotree') 
    use('tpope/vim-fugitive')
    use('andweeb/presence.nvim')
    use { 'catppuccin/nvim', as = "catppuccin" }
    use('glepnir/dashboard-nvim')
    use('hrsh7th/cmp-nvim-lsp')
    use('hrsh7th/nvim-cmp')
    use('jose-elias-alvarez/null-ls.nvim')
    use('kyazdani42/nvim-web-devicons')
    use('L3MON4D3/LuaSnip')
    use('lewis6991/gitsigns.nvim')
    use('neovim/nvim-lspconfig')
    use('nvim-lualine/lualine.nvim')
    use('nvim-telescope/telescope-file-browser.nvim')
    use('onsails/lspkind-nvim')
    use('ryanoasis/vim-devicons')
    use('saadparwaiz1/cmp_luasnip')
    use('tpope/vim-commentary')
    use('windwp/nvim-autopairs')
    use {
        'VonHeikemen/lsp-zero.nvim',
        branch = 'v1.x',
        requires = {
            -- LSP Support
            {'neovim/nvim-lspconfig'},             -- Required
            {'williamboman/mason.nvim'},           -- Optional
            {'williamboman/mason-lspconfig.nvim'}, -- Optional

                -- Autocompletion
                {'hrsh7th/nvim-cmp'},         -- Required
                {'hrsh7th/cmp-nvim-lsp'},     -- Required
                {'hrsh7th/cmp-buffer'},       -- Optional
                {'hrsh7th/cmp-path'},         -- Optional
                {'saadparwaiz1/cmp_luasnip'}, -- Optional
                {'hrsh7th/cmp-nvim-lua'},     -- Optional

                -- Snippets
                {'L3MON4D3/LuaSnip'},             -- Required
                {'rafamadriz/friendly-snippets'}, -- Optional
            }
        }
    end)

~/.config/nvim/after/plugin/dashboard.lua:

local db = require("dashboard")

db.setup {
    config = {
        header = {
            "my very own custom header for my custom dashboard"
        }
    }
}

Upvotes: 3

Related Questions