Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[ ~/.config/nvim/init.lua ]|--
- Table of content:
- [--first_configs--]: vim opts with that should be set first
- [--pluging_configs--]: plugin configuration with Lazy.nvim
- [--vim.opt--]: regular vim options
- [--keymaps--]: custom keymaps, can also be keymaps for plugins
- [--hi_groups--]: custom highlight groups / colors
- [[------------------------------- Header end ---------------------------------]]
- ---------- First configs ----------------------------------- |--first_configs--|
- -- Set leaderkey
- vim.g.mapleader = ' '
- -- disable netrw
- vim.g.loaded_netrw = 1
- vim.g.loaded_netrwPlugin = 1
- ---------- Plugins config -------------------------------- |--pluging_configs--|
- -- Get Lazy.nvim
- local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
- if not (vim.uv or vim.loop).fs_stat(lazypath) then
- local lazyrepo = "https://github.com/folke/lazy.nvim.git"
- local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath })
- if vim.v.shell_error ~= 0 then
- vim.api.nvim_echo({
- { "Failed to clone lazy.nvim:\n", "ErrorMsg" },
- { out, "WarningMsg" },
- { "\nPress any key to exit..." },
- }, true, {})
- vim.fn.getchar()
- os.exit(1)
- end
- end
- vim.opt.rtp:prepend(lazypath)
- -- Setup plugins with lazy.nvim
- require("lazy").setup({
- spec = {
- {
- "catppuccin/nvim",
- name = "catppuccin",
- priority = 1000,
- opts = {
- background = {
- light = "latte",
- dark = "macchiato",
- },
- show_end_of_buffer = false, -- shows the '~' on empty lines
- default_integrations = true,
- integrations = {
- telescope = { style = "nvchad"}
- }
- }
- },
- {
- "karb94/neoscroll.nvim",
- keys = {"<C-d>", "<C-u>", "<C-f>", "<C-b>", "zz", "zt", "zb"},
- opts = {
- hide_cursor = false,
- easing = "sine"
- }
- },
- {
- "nvim-treesitter/nvim-treesitter",
- event = { "BufRead" },
- build = ":TSUpdate",
- config = function ()
- require("nvim-treesitter.configs").setup({
- -- https://github.com/nvim-treesitter/nvim-treesitter?tab=readme-ov-file#modules
- ensure_installed = { "c", "lua", "vim", "vimdoc", "query", "markdown", "markdown_inline", "html", "javascript", "css" },
- auto_install = false,
- -- List of parsers to ignore installing (or "all")
- ignore_install = {},
- highlight = {
- enable = true,
- disable = function(lang, buf)
- local max_filesize = 500 * 1024 -- 500 KB
- local ok, stats = pcall(vim.loop.fs_stat, vim.api.nvim_buf_get_name(buf))
- if ok and stats and stats.size > max_filesize then
- return true
- end
- end,
- additional_vim_regex_highlighting = false,
- },
- })
- end
- },
- {
- 'nvim-lualine/lualine.nvim',
- opts = {
- options = {
- theme = 'palenight',
- component_separators = { left = '', right = ''},
- section_separators = { left = '', right = ''},
- disabled_filetypes = {
- statusline = {},
- winbar = {},
- },
- always_divide_middle = false,
- globalstatus = true,
- refresh = {
- statusline = 1000,
- tabline = 1000,
- winbar = 1000,
- }
- },
- sections = {
- lualine_a = {'mode'},
- lualine_b = {},
- lualine_c = {'filename'},
- lualine_x = {'encoding', 'fileformat', 'filetype'},
- lualine_y = {'progress'},
- lualine_z = {'location'}
- }
- }
- },
- {
- 'nvimdev/dashboard-nvim',
- event = 'VimEnter',
- opts = {
- theme = 'doom',
- hide = {
- statusline = false,
- tabline = false,
- winbar = false
- },
- config = {
- header = {
- '⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀',
- '⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀',
- '⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀',
- '⠀⠀⡠⡪⢀⠀⠀⠀⠀⠀⠀⢈⠢⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀',
- '⣠⣮⢎⢎⠠⠠⠀⠀⠀⠀⠀⢠⢣⡌⢢⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣶⣶⡆⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀',
- '⡇⡙⣖⢕⠀⠔⠐⠀⠀⠀⠀⠸⢶⡹⢦⡅⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣀⡀⠀⠀⠀⠀⣀⣀⣛⣛⡃⢀⣀⡀⢀⣀⡀⠀⠀⣀⣀⣀⡀⠀',
- '⢧⡕⢬⣳⡁⠐⢈⠈⢀⠀⠀⢸⢧⡹⡖⡅⠀⠀⠀⢸⣧⠖⠛⠛⠻⣦⡀⢀⡴⠚⠛⠛⢲⡄⠀⣴⠞⠛⠛⠻⣦⠈⣿⣿⡄⠀⠀⣼⣿⡏⣿⣿⡇⢸⣿⣿⡿⠿⣿⣷⣿⡿⠿⣿⣿⣆',
- '⢧⡚⡵⣊⠃⡈⠀⠌⡀⠠⠀⢸⢧⡻⣝⡆⠀⠀⠀⢸⣿⠀⠀⠀⠀⣿⡇⣾⣥⣤⣤⣤⣤⣿⢸⡇⠀⠀⠀⠀⢹⡇⠸⣿⣿⡀⣰⣿⡿⠀⣿⣿⡇⢸⣿⣿⠀⠀⢸⣿⣿⠀⠀⢸⣿⣿',
- '⣎⠷⣥⢏⠀⠡⡂⠄⡁⢂⠱⣼⣞⣧⢿⡅⠀⠀⠀⢸⣿⠀⠀⠀⠀⣿⡇⣿⠀⠀⠀⠀⠀⠀⢸⡇⠀⠀⠀⠀⢸⡇⠀⢹⣿⣧⣿⣿⠁⠀⣿⣿⡇⢸⣿⣿⠀⠀⢸⣿⣿⠀⠀⢸⣿⣿',
- '⣭⣻⡜⣯⠀⠀⠐⠔⠠⣁⢂⢹⣾⣽⣿⡇⠀⠀⠀⢸⣿⠀⠀⠀⠀⣿⡇⠘⣧⣄⣀⣀⣠⡄⠈⢷⣄⣀⣀⣠⡿⠁⠀⠀⢿⣿⣿⠇⠀⠀⣿⣿⡇⢸⣿⣿⠀⠀⢸⣿⣿⠀⠀⢸⣿⣿',
- '⣷⣳⢿⡵⠀⠀⠀⠈⠢⢂⢌⢾⣞⣿⣿⡇⠀⠀⠀⠈⠉⠀⠀⠀⠀⠉⠁⠀⠀⠉⠉⠉⠉⠀⠀⠀⠈⠉⠉⠉⠀⠀⠀⠀⠈⠉⠉⠀⠀⠀⠉⠉⠁⠈⠉⠉⠀⠀⠈⠉⠉⠀ ⠈⠉⠉',
- '⠘⢿⣟⣿⠀⠀⠀⠀⠀⠑⡢⣺⣿⣿⠟⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀',
- '⠀⠀⠙⢿⠀⠀⠀⠀⠀⠀⠈⢼⠟⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀',
- '⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀',
- '⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀',
- '⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀'
- },
- center = {
- {
- icon = ' ',
- icon_hl = 'Normal',
- desc = 'Empty File ',
- key = 'e',
- key_format = ' %s',
- action = 'bd'
- },
- {
- icon = ' ',
- desc = 'Find File',
- key = 'f',
- key_format = ' %s',
- action = 'Telescope find_files'
- },
- {
- icon = ' ',
- icon_hl = 'Normal',
- desc = 'Recent Files',
- key = 'r',
- key_format = ' %s',
- action = 'Telescope oldfiles'
- },
- {
- icon = ' ',
- icon_hl = 'DashboardCustomYellow',
- desc = 'Notes Folder',
- key = 'n',
- key_format = ' %s',
- action = 'e /home/tiago/Documents/Sync/Note/'
- },
- {
- icon = ' ',
- icon_hl = 'Normal',
- desc = 'Temporary Files',
- key = 't',
- key_format = ' %s',
- action = 'OpenTemp'
- },
- {
- icon = ' ',
- icon_hl = 'DashboardCustomGreen',
- desc = 'Quit',
- key = 'q',
- key_format = ' %s',
- action = 'q'
- },
- {
- icon = '',
- desc = '',
- key = 'i',
- action = 'lua vim.cmd("bd"); vim.api.nvim_feedkeys("i", "n", false)'
- },
- },
- footer = {'Wait, what is called !?'},
- }
- },
- dependencies = { {'nvim-tree/nvim-web-devicons'}}
- },
- {
- "folke/which-key.nvim",
- event = "VeryLazy",
- opts = {},
- keys = {
- {
- "<leader>?",
- function()
- require("which-key").show({ global = false })
- end,
- desc = "Local Keymaps",
- }
- }
- },
- {
- "nvim-tree/nvim-tree.lua",
- keys = {
- { "<leader>e", ":NvimTreeOpen<CR>", desc = "Open NvimTree" },
- },
- event = { "BufAdd" },
- dependencies = {
- "nvim-tree/nvim-web-devicons",
- },
- opts = {
- renderer = {
- icons = {
- symlink_arrow = " ",
- glyphs = {
- folder = {
- arrow_closed = "",
- arrow_open = "",
- default = "",
- open = "",
- empty = "",
- empty_open = "",
- symlink = "",
- symlink_open = "",
- }
- }
- }
- }
- }
- },
- {
- "gerazov/toggle-bool.nvim",
- keys = { "<leader><leader>" },
- opts = {
- mapping = "<leader><leader>",
- additional_toggles = {
- Yes = 'No',
- On = 'Off',
- ["0"] = "1",
- Enable = 'Disable',
- Enabled = 'Disabled',
- First = 'Last',
- Before = 'After',
- Persistent = 'Ephemeral',
- Allow = 'Deny',
- All = 'None',
- },
- }
- },
- { 'nvim-telescope/telescope-fzf-native.nvim', lazy = true, build = 'cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release && cmake --build build --config Release' },
- {
- 'nvim-telescope/telescope.nvim', branch = '0.1.x',
- cmd = { "Telescope" },
- dependencies = {
- 'nvim-lua/plenary.nvim',
- 'nvim-telescope/telescope-fzf-native.nvim'
- },
- -- TELESCOPE DOESN'T WORK WITH OPTS = {}
- config = function ()
- require('telescope').setup({
- defaults = {
- layout_config = {
- prompt_position = 'top',
- },
- sorting_strategy = 'ascending',
- }
- })
- require('telescope').load_extension('fzf')
- end
- },
- { "nvim-tree/nvim-web-devicons", opts = {} },
- {
- "ggandor/leap.nvim",
- event = { "BufRead", "TextChangedI" },
- config = function ()
- vim.keymap.set('n', 's', '<Plug>(leap)')
- end
- }
- },
- -- Other Lazy.nvim settings --
- -- colorscheme that will be used when installing plugins.
- install = { colorscheme = { "catppuccin" } },
- change_detection = {
- enabled = false -- doesn't seam to work anyway
- },
- })
- ---------- End of plugin config ---------------------------------- |--vim.opt--|
- -- Set color scheme
- vim.cmd.colorscheme("catppuccin")
- -- set command timeout
- vim.opt.timeoutlen = 400
- -- set Scroll margin
- vim.opt.scrolloff = 6
- -- Incrementally highlight characters while typing.
- vim.opt.incsearch = true
- -- Smart case while searching
- vim.opt.ignorecase = true
- vim.opt.smartcase = true
- -- Line break on words
- vim.opt.linebreak = true
- -- Chars to use with vim list
- vim.opt.list = true
- vim.opt.listchars = { tab = '» ', trail = '·', nbsp = '␣' }
- -- Vim folds
- vim.opt.foldmethod = "indent"
- vim.opt.foldlevelstart = 99
- -- Indentation to 2 spaces
- vim.opt.tabstop=2
- vim.opt.shiftwidth=2
- vim.opt.smartindent = true
- vim.opt.expandtab = true -- Replaces ' '(tab) with ' '(spaces)
- -- Hybrid line number
- vim.opt.number = true
- vim.opt.relativenumber = true
- -- Hide mode in command line (mode shown in lualine.nvim)
- vim.opt.showmode = false
- -- Hide command line
- vim.opt.cmdheight = 0
- -- Auto change dir
- vim.opt.autochdir = true
- -- Remove 'How to disable mouse' :help link in mouse popup menu
- vim.cmd.aunmenu('PopUp.-1-')
- vim.cmd.aunmenu('PopUp.How-to\\ disable\\ mouse')
- ---------- Keymaps ----------------------------------------------- |--keymaps--|
- -- Resize splits with alt
- vim.api.nvim_set_keymap("n", "<A-h>", ":vertical resize -2<CR>", { noremap = true, silent = true })
- vim.api.nvim_set_keymap("n", "<A-l>", ":vertical resize +2<CR>", { noremap = true, silent = true })
- vim.api.nvim_set_keymap("n", "<A-j>", ":resize +1<CR>", { noremap = true, silent = true })
- vim.api.nvim_set_keymap("n", "<A-k>", ":resize -1<CR>", { noremap = true, silent = true })
- -- Map <C-n> and <C-w> in :term
- vim.api.nvim_set_keymap("t", "<C-n>", "<C-\\><C-N>", { noremap = true, silent = true })
- vim.api.nvim_set_keymap("t", "<C-w>", "<C-\\><C-N><C-w>", { noremap = true, silent = true })
- -- Buffers management keymaps
- vim.api.nvim_set_keymap("n", "<tab>", ":bn<CR>", { noremap = true, silent = true })
- vim.api.nvim_set_keymap("n", "<S-tab>", ":bp<CR>", { noremap = true, silent = true })
- vim.api.nvim_set_keymap("n", "<leader>x", ":bd<CR>", { noremap = true, silent = true, desc = 'Delete current buffer' })
- -- Open / preview with Vivaldi
- vim.api.nvim_set_keymap("n", "<leader>p", ":silent !vivaldi '%'<CR>", { noremap = true, silent = true, desc = 'Preview with Vivaldi' })
- -- leader + c -> "+ register
- vim.api.nvim_set_keymap("n", "<leader>c", "\"+", { noremap = true, desc = 'System clipboard register' })
- vim.api.nvim_set_keymap("v", "<leader>c", "\"+", { noremap = true, desc = 'System clipboard register' })
- -- Telescope keymap
- vim.keymap.set('n', '<leader>ff', ':Telescope find_files<CR>', { silent = true, desc = 'Telescope find files' })
- vim.keymap.set('n', '<leader>fg', ':Telescope live_grep<CR>', { silent = true, desc = 'Telescope live grep' })
- vim.keymap.set('n', '<leader>fb', ':Telescope buffers<CR>', { silent = true, desc = 'Telescope buffers' })
- vim.keymap.set('n', '<leader>fh', ':Telescope help_tags<CR>', { silent = true, desc = 'Telescope help tags' })
- vim.keymap.set('n', '<leader>fr', ':Telescope oldfiles<CR>', { silent = true, desc = 'Telescope recent files' })
- vim.keymap.set('n', '<leader>fc', ':Telescope commands<CR>', { silent = true, desc = 'Telescope commands' })
- vim.keymap.set('n', '<leader>ft', ':Telescope<CR>', { silent = true, desc = 'Telescope' })
- ---------- Custom colors --------------------------------------- |--hi_groups--|
- -- Set tabline colors
- vim.cmd.highlight({"TabLineFill", "guifg=#697098", "guibg=#292d3e"})
- vim.cmd.highlight({"TabLine", "guifg=#697098", "guibg=#3e4452"})
- vim.cmd.highlight({"TabLineSel", "guifg=#292d3e", "guibg=#c792ea"})
- -- Dashboard colors
- vim.cmd.highlight({"DashboardHeader", "guifg=#4dd28b"})
- vim.cmd("hi! link DashboardIcon DashboardDesc") -- blend icon color with text
- vim.cmd("hi! link DashboardKey Normal") -- blend icon color with text
- -- Dashboard custom highlight groups
- vim.cmd.highlight({"DashboardCustomYellow", "guifg=#f0c70f"})
- vim.cmd.highlight({"DashboardCustomGreen", "guifg=#00c34a"})
Advertisement
Add Comment
Please, Sign In to add comment