--[[ speedie's neovim configuration -- https://git.speedie.site/speedie/speedie-nvim -- ]]-- 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 SessionFile = '~/.config/nvim/.session.nvim' -- File where the previous buffer is stored LeaderKey = ' ' -- The leader key to use. MaxAccelerationSpeed = 300 -- Max speed for j/k/gj/gk bindings. Theme = 'oxocarbon' -- Theme to use 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 } LanguageServers = { -- Language servers to use for LSP, run LspInstall to see available servers 'html', -- For HTML 'cssls', -- For CSS 'clangd', -- For C and C++ 'phpactor', -- For PHP 'lua_ls', -- For Lua 'marksman', -- For Markdown } Themes = { { 'nyoom-engineering/oxocarbon.nvim' }, -- Oxocarbon --[[ { '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 { '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 { 'lewis6991/gitsigns.nvim' }, -- Provides Git icons { 'nvim-tree/nvim-web-devicons' }, -- Provides general icons { 'williamboman/mason.nvim', dependencies = { 'williamboman/mason-lspconfig.nvim', }, }, -- Server auto-install { 'VonHeikemen/lsp-zero.nvim', branch = 'v3.x', dependencies = { 'neovim/nvim-lspconfig', 'hrsh7th/cmp-nvim-lsp', 'hrsh7th/nvim-cmp', 'L3MON4D3/LuaSnip', }, }, -- LSP { 'nvim-tree/nvim-tree.lua' }, -- File manager { 'lukas-reineke/indent-blankline.nvim', dependencies = { 'nvim-treesitter/nvim-treesitter', }, }, -- Indentation blankline { 'folke/trouble.nvim' }, -- Display warnings and errors neatly { 'uga-rosa/translate.nvim' }, -- Built in translate { 'folke/noice.nvim', event = "VeryLazy", dependencies = { 'MunifTanjim/nui.nvim', 'rcarriga/nvim-notify', }, opts = {}, }, -- Message boxes { 'rainbowhxch/accelerated-jk.nvim' }, -- Accelerated movement { 'NvChad/nvim-colorizer.lua' }, -- Colorize #RRGGBB text { 'RRethy/vim-illuminate' }, -- Highlight other instances of the cursor position word { 'LunarVim/bigfile.nvim' }, -- Disable heavy features if the file is big } require('bootstrap') -- Set up Lazy and plugins. opt.title = true -- Display title opt.spelllang = 'en_us' -- Use English (United States) as spellcheck language by default 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.swapfile = false -- Don't use a swapfile 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.laststatus = 0 -- Don't display file information opt.termguicolors = true -- Enable true color opt.autochdir = true -- Automatically change directory to the file we're editing opt.background = 'dark' -- Set background to dark opt.fillchars = { vert = '▏', } -- Keybinds for handling splits keymap('n', '', 'h', defaultKeybindOptions) keymap('n', '', 'j', defaultKeybindOptions) keymap('n', '', 'k', defaultKeybindOptions) keymap('n', '', 'l', defaultKeybindOptions) keymap('n', '', 'split', defaultKeybindOptions) keymap('n', '', 'vsplit', defaultKeybindOptions) keymap('n', '', 'only', defaultKeybindOptions) keymap('n', '', 'term', defaultKeybindOptions) keymap('n', '', 'Telescope fd', defaultKeybindOptions) keymap('n', 'H', 'vertical resize -10', defaultKeybindOptions) keymap('n', 'J', 'resize -10', defaultKeybindOptions) keymap('n', 'K', 'resize +10', defaultKeybindOptions) keymap('n', 'L', 'vertical resize +10', defaultKeybindOptions) -- Keybinds for language/spell keymap('n', '', 'set spell!', defaultKeybindOptions) keymap('n', '', 'set spelllang=en_us', defaultKeybindOptions) keymap('n', '', 'set spelllang=sv_se', defaultKeybindOptions) keymap('n', '', 'silent execute "!setxkbmap us"', defaultKeybindOptions) keymap('n', '', 'silent execute "!setxkbmap se"', defaultKeybindOptions) keymap('n', 'ca', 'z=', defaultKeybindOptions) -- Miscellanious keymap('n', '', 'tab :new', defaultKeybindOptions) keymap('n', 'j', '(accelerated_jk_j)', defaultKeybindOptions) keymap('n', 'k', '(accelerated_jk_k)', defaultKeybindOptions) keymap('n', 'gj', '(accelerated_jk_gj)', defaultKeybindOptions) keymap('n', 'gk', '(accelerated_jk_gk)', defaultKeybindOptions) keymap('n', 'd', '"_d', defaultKeybindOptions) keymap('x', 'd', '"_d', defaultKeybindOptions) keymap('x', 'p', '"_dP', defaultKeybindOptions) keymap('n', 'c', '"_c', defaultKeybindOptions) keymap('n', 'ZX', 'q!', defaultKeybindOptions) keymap('n', 'Zz', 'w!', defaultKeybindOptions) keymap('n', '', 'v/{%', defaultKeybindOptions) keymap('n', '', 'NvimTreeToggle', defaultKeybindOptions) keymap('n', '', 'TroubleToggle', defaultKeybindOptions) -- Keybinds for handling tabs keymap('n', '', 'BufferLineCyclePrev', defaultKeybindOptions) keymap('n', '', 'BufferLineCycleNext', defaultKeybindOptions) keymap('n', '', 'BufferLineCycleNext', defaultKeybindOptions) keymap('n', '', 'BufferLineMovePrev', defaultKeybindOptions) keymap('n', '>', 'BufferLineMoveNext', defaultKeybindOptions) keymap('n', '', 'BufferLineGoToBuffer 1', defaultKeybindOptions) keymap('n', '', 'BufferLineGoToBuffer 2', defaultKeybindOptions) keymap('n', '', 'BufferLineGoToBuffer 3', defaultKeybindOptions) keymap('n', '', 'BufferLineGoToBuffer 4', defaultKeybindOptions) keymap('n', '', 'BufferLineGoToBuffer 5', defaultKeybindOptions) keymap('n', '', 'BufferLineGoToBuffer 6', defaultKeybindOptions) keymap('n', '', 'BufferLineGoToBuffer 7', defaultKeybindOptions) keymap('n', '', 'BufferLineGoToBuffer 8', defaultKeybindOptions) keymap('n', '', 'BufferLineGoToBuffer 9', defaultKeybindOptions) keymap('n', '', 'BufferLineGoToBuffer -1', defaultKeybindOptions) keymap('n', '', 'BufferLineTogglePin', defaultKeybindOptions) keymap('n', '', 'bdelete', defaultKeybindOptions) 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, }) autocmd('BufWritePre', { -- Replace four spaces with tabs in Makefiles pattern = { 'Makefile' }, callback = function() vim.cmd("autocmd BufWritePre Makefile %s/ /\t/e") end, })