--[[ speedie's neovim configuration -- https://git.speedie.site/speedie/speedie-nvim -- ]]-- local g = vim.g -- Convenient alias local opt = vim.opt -- Convenient alias local keymap = vim.api.nvim_set_keymap -- Convenient alias local autocmd = vim.api.nvim_create_autocmd -- Convenient alias local defaultKeybindOptions = { noremap = true, silent = true } -- Default keybind options LoadPreviousSessionOnLoad = true -- Load previous session or not EnableImageSupport = false -- Enable image support or not ImageBackend = 'kitty' -- Image backend to support (kitty/ueberzug) MaxAccelerationSpeed = 300 -- Max speed for j/k/gj/gk bindings. Theme = 'tokyonight-day' -- Theme to use StatusTheme = 'tokyonight' -- Status theme to use DictFile = 'en_dict.txt' -- Dictionary to use for spell check Font = ':' -- Font to use (GUI only) CursorAnimationLength = 0 -- Cursor animation length (Neovide only) ScrollAnimationLength = 0.1 -- Scroll animation length (Neovide only) Languages = { -- Languages to support - Used to configure highlighting 'html', -- For HTML 'css', -- For CSS 'c', -- For C 'cpp', -- For C++ 'php', -- For PHP 'lua', -- For Lua 'markdown', -- For Markdown 'markdown_inline', -- Also for Markdown 'meson', -- For meson } LanguageServers = { -- Language servers to use for LSP, run LspInstall to see available servers 'html', -- For HTML 'cssls', -- For CSS 'clangd', -- For C and C++ 'lua_ls', -- For Lua 'marksman', -- For Markdown 'swift_mesonls', -- For meson } Themes = { { 'nyoom-engineering/oxocarbon.nvim' }, -- Oxocarbon { 'folke/tokyonight.nvim' }, -- Tokyo Night --[[ { 'rmehri01/onenord.nvim', branch = 'main' }, -- One Nord theme { 'romgrk/doom-one.vim' }, -- Doom-One theme { 'catppuccin/nvim' }, -- Catppuccin theme(s) ]]-- } -- Themes to download as plugins Plugins = { -- Plugins to use { 'nvim-telescope/telescope.nvim', dependencies = { 'nvim-lua/plenary.nvim', }, }, -- Fuzzy-finding { '3rd/image.nvim' }, -- Images in Neovim { 'nvim-treesitter/nvim-treesitter' }, -- Better syntax highlighting { 'akinsho/bufferline.nvim' }, -- Tabs { 'nvim-lualine/lualine.nvim' }, -- Status line { 'm4xshen/autoclose.nvim' }, -- Autoclose brackets { 'stevearc/conform.nvim' }, -- Formatting { 'dinhhuy258/git.nvim' }, -- Git integration { 'NeogitOrg/neogit', dependencies = { 'nvim-lua/plenary.nvim', 'sindrets/diffview.nvim', 'nvim-telescope/telescope.nvim', }, }, { 'lewis6991/gitsigns.nvim' }, -- Provides Git icons { 'nvim-tree/nvim-web-devicons' }, -- Provides general icons { 'williamboman/mason.nvim', dependencies = { 'williamboman/mason-lspconfig.nvim', 'neovim/nvim-lspconfig', 'hrsh7th/cmp-nvim-lsp', 'hrsh7th/nvim-cmp', 'octaltree/cmp-look', 'L3MON4D3/LuaSnip', }, }, -- LSP { 'nvim-tree/nvim-tree.lua' }, -- File manager { 'lukas-reineke/indent-blankline.nvim', dependencies = { 'nvim-treesitter/nvim-treesitter', }, }, -- Indentation blankline { 'uga-rosa/translate.nvim' }, -- Built in translate { 'uga-rosa/ccc.nvim' }, -- Color picker { 'swaits/thethethe.nvim', event = 'VeryLazy', opts = {}, }, -- Autocorrect plugin { 'ahmedkhalf/project.nvim', dependencies = { 'stevearc/overseer.nvim', }, }, -- Project manager { 'Zeioth/compiler.nvim' }, -- Compiler { 'folke/trouble.nvim' }, -- Display warnings and errors neatly { 'folke/noice.nvim', event = 'VeryLazy', dependencies = { 'MunifTanjim/nui.nvim', 'rcarriga/nvim-notify', }, }, -- Message boxes { 'folke/which-key.nvim' }, -- Display possible keybinds { 'rainbowhxch/accelerated-jk.nvim' }, -- Accelerated movement { 'NvChad/nvim-colorizer.lua' }, -- Colorize #RRGGBB text { 'RRethy/vim-illuminate' }, -- Highlight other instances of the cursor position word { 'stevearc/aerial.nvim' }, -- Object viewer { 'caenrique/swap-buffers.nvim' }, -- Swap buffers { 'LunarVim/bigfile.nvim' }, -- Disable heavy features if the file is big { 'altermo/nxwm', branch = 'x11', }, -- GUI display { 'OXY2DEV/markview.nvim' }, -- Markdown viewer { 'speedie1337/hologram.nvim' }, -- Image support (incl. Markdown) { 'tpope/vim-sleuth' }, -- Automatically adjust tab options based on the file } opt.title = true -- Display title opt.spelllang = 'en_us' -- Use English (United States) as spellcheck language by default opt.number = false -- Show line numbers opt.relativenumber = true -- Show relative line numbers opt.mouse = 'a' -- Enable mouse opt.clipboard = 'unnamedplus' -- Use system clipboard opt.hidden = true -- Hides buffers opt.smarttab = true -- Enable smart tab opt.ignorecase = true -- Enable case insensitivity when searching opt.smartcase = true -- Pretty much same for this one opt.hlsearch = false -- Don't highlight searches opt.smartindent = true -- Automatically indent the next line opt.autoindent = true -- Pretty much same for this one opt.expandtab = true -- Replace tabs with spaces automatically opt.autoread = true -- Automatically reload a file if it has been modified. opt.swapfile = false -- Don't use a swapfile opt.writebackup = true -- Back up, to prevent against potential crashes opt.cursorline = true -- Show the cursor line opt.undolevels = 10000 -- Allow up to 10000 undos opt.tabstop = 4 -- Display a tab (\t) as 4 spaces opt.softtabstop = 4 -- Display a tab (\t) as 4 spaces opt.shiftwidth = 4 -- Indents for << or >> opt.spellsuggest = 'best,5' -- Prefer the best suggestions opt.foldmethod = 'indent' -- Fold based on indents opt.timeoutlen = 0 -- Show keybinds after this many milliseconds opt.termguicolors = true -- Enable true color opt.autochdir = true -- Automatically change directory to the file we're editing opt.shortmess:append { -- Disable some notifications A = true, -- Don't display swap file warning W = true, -- Don't display notification on save I = true, -- Don't display intro F = true, -- Don't display file information when editing a file c = true, -- Don't display notification about search results } opt.fillchars = { -- Display tab indents using this character vert = '▏', } g.mapleader = ' ' -- Leader key g.maplocalleader = ' ' -- Leader key -- Keybinds for handling splits keymap('n', '', 'h', defaultKeybindOptions) -- Move left keymap('n', '', 'j', defaultKeybindOptions) -- Move down keymap('n', '', 'k', defaultKeybindOptions) -- Move up keymap('n', '', 'l', defaultKeybindOptions) -- Move right keymap('n', '', 'split', defaultKeybindOptions) -- Split horizontally keymap('n', '', 'vsplit', defaultKeybindOptions) -- Split vertically keymap('n', '', 'only', defaultKeybindOptions) -- Close all buffers except selected keymap('n', '', 'vertical resize -10', defaultKeybindOptions) -- Decrease size vertically by 10 keymap('n', '', 'resize -10', defaultKeybindOptions) -- Decrease size horizontally by 10 keymap('n', '', 'resize +10', defaultKeybindOptions) -- Increase size horizontally by 10 keymap('n', '', 'vertical resize +10', defaultKeybindOptions) -- Increase size vertically by 10 keymap('n', '', 'lua require("swap-buffers").swap_buffers("h")', defaultKeybindOptions) -- Decrease size vertically by 10 keymap('n', '', 'lua require("swap-buffers").swap_buffers("j")', defaultKeybindOptions) -- Decrease size vertically by 10 keymap('n', '', 'lua require("swap-buffers").swap_buffers("k")', defaultKeybindOptions) -- Decrease size vertically by 10 keymap('n', '', 'lua require("swap-buffers").swap_buffers("l")', defaultKeybindOptions) -- Decrease size vertically by 10 keymap('n', '', 'term', defaultKeybindOptions) -- Open a terminal emulator -- Keybinds for language/spell keymap('n', '', 'set spell!', defaultKeybindOptions) -- Enable spell check keymap('n', '', 'set spelllang=en_us', defaultKeybindOptions) -- Set spell check langauge to English (United States) keymap('n', '', 'set spelllang=sv_se', defaultKeybindOptions) -- Set spell check language to Swedish keymap('n', '', 'silent execute "!setxkbmap us"', defaultKeybindOptions) -- Set keyboard layout to English (United States) keymap('n', '', 'silent execute "!setxkbmap se"', defaultKeybindOptions) -- Set keyboard layout to Swedish keymap('n', 'ca', 'z=', defaultKeybindOptions) -- Suggest suitable spell check replacements -- Miscellanious keymap('n', '', 'tab :new', defaultKeybindOptions) -- Create new buffer keymap('n', 'j', '(accelerated_jk_j)', defaultKeybindOptions) -- Move down keymap('n', 'k', '(accelerated_jk_k)', defaultKeybindOptions) -- Move up keymap('n', 'gj', '(accelerated_jk_gj)', defaultKeybindOptions) -- Move down (line wrapping) keymap('n', 'gk', '(accelerated_jk_gk)', defaultKeybindOptions) -- Move up (line wrapping) keymap('n', 'd', '"_d', defaultKeybindOptions) -- Delete without yanking keymap('x', 'd', '"_d', defaultKeybindOptions) -- Delete without yanking keymap('x', 'p', '"_dP', defaultKeybindOptions) -- Paste without clearing clipboard keymap('n', 'c', '"_c', defaultKeybindOptions) -- Change without yanking keymap('n', 'ZX', 'q!', defaultKeybindOptions) -- Quit without saving keymap('n', 'Zz', 'w!', defaultKeybindOptions) -- Save keymap('n', '', 'v/{%', defaultKeybindOptions) -- Select an entire function keymap('n', '', 'NvimTreeToggle', defaultKeybindOptions) -- Toggle NvimTree keymap('n', '.', 'Trouble toggle diagnostics', defaultKeybindOptions) -- Toggle Trouble keymap('n', ',', 'AerialToggle', defaultKeybindOptions) -- Toggle Aerial keymap('n', 'G', 'Neogit', defaultKeybindOptions) -- Toggle Neogit keymap('n', 'gt', 'Gitsigns toggle_current_line_blame', defaultKeybindOptions) -- Toggle current line blame keymap('n', '', 'Telescope fd', defaultKeybindOptions) -- Toggle Telescope file opener keymap('n', 'P', 'Telescope projects', defaultKeybindOptions) -- Toggle Telescope project opener keymap('n', 'C', 'CccPick', defaultKeybindOptions) -- Toggle color picker keymap('n', ';', 'CompilerOpen', defaultKeybindOptions) -- Toggle compiler options -- Keybinds for handling tabs keymap('n', '', 'BufferLineCyclePrev', defaultKeybindOptions) -- Cycle previous keymap('n', '', 'BufferLineCycleNext', defaultKeybindOptions) -- Cycle next keymap('n', '', 'BufferLineCycleNext', defaultKeybindOptions) -- Also cycle next keymap('n', '', 'BufferLineMovePrev', defaultKeybindOptions) -- Move to the previous tab keymap('n', '>', 'BufferLineMoveNext', defaultKeybindOptions) -- Move to the next tab keymap('n', '', 'BufferLineGoToBuffer 1', defaultKeybindOptions) -- Move to buffer 1 keymap('n', '', 'BufferLineGoToBuffer 2', defaultKeybindOptions) -- Move to buffer 2 keymap('n', '', 'BufferLineGoToBuffer 3', defaultKeybindOptions) -- Move to buffer 3 keymap('n', '', 'BufferLineGoToBuffer 4', defaultKeybindOptions) -- Move to buffer 4 keymap('n', '', 'BufferLineGoToBuffer 5', defaultKeybindOptions) -- Move to buffer 5 keymap('n', '', 'BufferLineGoToBuffer 6', defaultKeybindOptions) -- Move to buffer 6 keymap('n', '', 'BufferLineGoToBuffer 7', defaultKeybindOptions) -- Move to buffer 7 keymap('n', '', 'BufferLineGoToBuffer 8', defaultKeybindOptions) -- Move to buffer 8 keymap('n', '', 'BufferLineGoToBuffer 9', defaultKeybindOptions) -- Move to buffer 9 keymap('n', '', 'BufferLineGoToBuffer -1', defaultKeybindOptions) -- Move to the last buffer keymap('n', '', 'BufferLineTogglePin', defaultKeybindOptions) -- Toggle pin for a tab keymap('n', '', 'bdelete', defaultKeybindOptions) -- Close a tab autocmd('BufWritePre', { -- Remove trailing spaces pattern = { '*' }, callback = function() vim.cmd('%s/\\s\\+$//e') end, }) autocmd('BufReadPre', { -- Enable spell check for all Markdown files pattern = { '*.md' }, callback = function() vim.cmd('set spell') end, }) require('bootstrap') -- Set up Lazy and plugins. Has to be done before keybinds are defined.