From 74858f94885c3bc9cef98a128a4710c2c2b99177 Mon Sep 17 00:00:00 2001 From: Thomas Voss Date: Tue, 12 Sep 2023 12:17:08 +0200 Subject: nvim: Include more Neovim configurations --- .config/nvim/.gitignore | 1 - .config/nvim/lua/mango/init.lua | 3 +++ .config/nvim/lua/mango/lib.lua | 11 ++++++++++ .config/nvim/lua/mango/packer.lua | 39 +++++++++++++++++++++++++++++++++ .config/nvim/lua/mango/remap.lua | 45 +++++++++++++++++++++++++++++++++++++++ .config/nvim/lua/mango/set.lua | 36 +++++++++++++++++++++++++++++++ 6 files changed, 134 insertions(+), 1 deletion(-) create mode 100644 .config/nvim/lua/mango/init.lua create mode 100644 .config/nvim/lua/mango/lib.lua create mode 100644 .config/nvim/lua/mango/packer.lua create mode 100644 .config/nvim/lua/mango/remap.lua create mode 100644 .config/nvim/lua/mango/set.lua (limited to '.config/nvim') diff --git a/.config/nvim/.gitignore b/.config/nvim/.gitignore index 7fd58ac..c4f171b 100644 --- a/.config/nvim/.gitignore +++ b/.config/nvim/.gitignore @@ -1,6 +1,5 @@ /ftdetect /ftplugin /indent -/lua /plugin /syntax diff --git a/.config/nvim/lua/mango/init.lua b/.config/nvim/lua/mango/init.lua new file mode 100644 index 0000000..9e7f273 --- /dev/null +++ b/.config/nvim/lua/mango/init.lua @@ -0,0 +1,3 @@ +require('mango.packer') +require('mango.remap') +require('mango.set') diff --git a/.config/nvim/lua/mango/lib.lua b/.config/nvim/lua/mango/lib.lua new file mode 100644 index 0000000..60857c8 --- /dev/null +++ b/.config/nvim/lua/mango/lib.lua @@ -0,0 +1,11 @@ +local M = {} + +function M.setTabWidth(tw, localp) + local opt = localp and vim.opt_local or vim.opt + + opt.tabstop = tw + opt.softtabstop = tw + opt.shiftwidth = tw +end + +return M diff --git a/.config/nvim/lua/mango/packer.lua b/.config/nvim/lua/mango/packer.lua new file mode 100644 index 0000000..ae250e7 --- /dev/null +++ b/.config/nvim/lua/mango/packer.lua @@ -0,0 +1,39 @@ +vim.cmd.packadd('packer.nvim') + +return require('packer').startup(function(use) + use 'wbthomason/packer.nvim' + + use { + 'nvim-telescope/telescope.nvim', + tag = '0.1.2', + requires = { {'nvim-lua/plenary.nvim'} } + } + + use { + 'rose-pine/neovim', + as = 'rose-pine', + config = function() + vim.cmd.colorscheme('rose-pine') + end + } + + use('nvim-treesitter/nvim-treesitter', {run = ':TSUpdate'}) + use 'mbbill/undotree' + use 'tpope/vim-fugitive' + + use { + 'VonHeikemen/lsp-zero.nvim', + branch = 'v2.x', + requires = { + -- LSP Support + {'neovim/nvim-lspconfig'}, + {'williamboman/mason.nvim'}, + {'williamboman/mason-lspconfig.nvim'}, + + -- Autocompletion + {'hrsh7th/nvim-cmp'}, + {'hrsh7th/cmp-nvim-lsp'}, + {'L3MON4D3/LuaSnip'}, + } + } +end) diff --git a/.config/nvim/lua/mango/remap.lua b/.config/nvim/lua/mango/remap.lua new file mode 100644 index 0000000..3c4c526 --- /dev/null +++ b/.config/nvim/lua/mango/remap.lua @@ -0,0 +1,45 @@ +local function remap(modes, from, to) + modes:gsub('.', function(c) + vim.keymap.set(c, from, to) + end) +end + +vim.g.mapleader = ' ' + +-- Make adjustments for my custom keyboard layout +remap('nv', '€', '$') +remap('nv', ')', '0') +remap('n', '<', '<<') +remap('n', '>', '>>') + +-- Open netrw +remap('n', 'rw', vim.cmd.Ex) + +-- Better frame navigation +remap('n', '', 'h') +remap('n', '', 'j') +remap('n', '', 'k') +remap('n', '', 'l') + +-- I prefer visual-line mode on ‘V’ +remap('n', 'V', '') +remap('n', '', 'V') + +-- Move selections up and down +remap('v', '', ":m '>+1gv=gv") +remap('v', '', ":m '<-2gv=gv") + +-- Don’t move cursor with various commands +remap('n', 'J', 'mzJ`z') +remap('n', '', 'zz') +remap('n', '', 'zz') +remap('n', 'n', 'nzzzv') +remap('n', 'N', 'Nzzzv') + +-- Paste and delete without clobbering primary register +remap('x', 'p', '"_dP') +remap('nv', 'd', '"_d') + +-- Copy to system clipboard +remap('vn', 'y', '"+y') +remap('n', 'Y', '"+Y') diff --git a/.config/nvim/lua/mango/set.lua b/.config/nvim/lua/mango/set.lua new file mode 100644 index 0000000..28c5cf2 --- /dev/null +++ b/.config/nvim/lua/mango/set.lua @@ -0,0 +1,36 @@ +local lib = require('mango.lib') +local opt = vim.opt + +opt.nu = true +opt.relativenumber = true + +lib.setTabWidth(4) +opt.expandtab = false +opt.smartindent = true + +opt.wrap = false + +opt.swapfile = false +opt.backup = false +opt.undodir = os.getenv('XDG_STATE_HOME') .. '/nvim/undo' +opt.undofile = true + +opt.hlsearch = true +opt.incsearch = true + +opt.termguicolors = true + +opt.scrolloff = 8 +-- TODO: Research +-- opt.signcolumn = 'yes' +-- opt.isfname:append('@-@') + +opt.updatetime = 50 + +opt.colorcolumn = '81' + +-- Disable auto commenting +vim.bo.formatoptions = 'jnql' + +opt.splitright = true +opt.splitbelow = true -- cgit v1.2.3