summaryrefslogtreecommitdiff
path: root/.config/nvim
diff options
context:
space:
mode:
Diffstat (limited to '.config/nvim')
-rw-r--r--.config/nvim/.gitignore1
-rw-r--r--.config/nvim/lua/mango/init.lua3
-rw-r--r--.config/nvim/lua/mango/lib.lua11
-rw-r--r--.config/nvim/lua/mango/packer.lua39
-rw-r--r--.config/nvim/lua/mango/remap.lua45
-rw-r--r--.config/nvim/lua/mango/set.lua36
6 files changed, 134 insertions, 1 deletions
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', '<leader>rw', vim.cmd.Ex)
+
+-- Better frame navigation
+remap('n', '<C-h>', '<C-w>h')
+remap('n', '<C-j>', '<C-w>j')
+remap('n', '<C-k>', '<C-w>k')
+remap('n', '<C-l>', '<C-w>l')
+
+-- I prefer visual-line mode on ‘V’
+remap('n', 'V', '<C-v>')
+remap('n', '<C-v>', 'V')
+
+-- Move selections up and down
+remap('v', '<C-J>', ":m '>+1<CR>gv=gv")
+remap('v', '<C-K>', ":m '<-2<CR>gv=gv")
+
+-- Don’t move cursor with various commands
+remap('n', 'J', 'mzJ`z')
+remap('n', '<C-d>', '<C-d>zz')
+remap('n', '<C-u>', '<C-u>zz')
+remap('n', 'n', 'nzzzv')
+remap('n', 'N', 'Nzzzv')
+
+-- Paste and delete without clobbering primary register
+remap('x', '<leader>p', '"_dP')
+remap('nv', '<leader>d', '"_d')
+
+-- Copy to system clipboard
+remap('vn', '<leader>y', '"+y')
+remap('n', '<leader>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