dotfiles

config files and scripts
git clone git://git.hanetzok.net/dotfiles
Log | Files | Refs | README

commit 54763909135e8b370dd8563fe1b91576f62fceaf
parent 3268d563e08211462b85073177e2dc0968343468
Author: Markus Hanetzok <markus@hanetzok.net>
Date:   Thu, 27 Mar 2025 18:06:49 +0100

add neovim config

Diffstat:
A.config/nvim/after/airline.lua | 3+++
A.config/nvim/init.lua | 3+++
A.config/nvim/lua/core/options.lua | 34++++++++++++++++++++++++++++++++++
A.config/nvim/lua/core/packer.lua | 17+++++++++++++++++
A.config/nvim/lua/core/remaps.lua | 29+++++++++++++++++++++++++++++
5 files changed, 86 insertions(+), 0 deletions(-)

diff --git a/.config/nvim/after/airline.lua b/.config/nvim/after/airline.lua @@ -0,0 +1,3 @@ +vim.g.airline_symbols = '' +vim.g.airline_symbols_colnr = ' C:' +vim.g.airline_symbols_maxlinenr = ' ' diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua @@ -0,0 +1,3 @@ +require("core.remaps") +require("core.options") +require("core.packer") diff --git a/.config/nvim/lua/core/options.lua b/.config/nvim/lua/core/options.lua @@ -0,0 +1,34 @@ +local g = vim.g -- Global variables +local opt = vim.opt -- Set options (global/buffer/windows-scoped) + +-- General +opt.mouse = 'a' -- Enable mouse support +opt.clipboard = 'unnamedplus' -- Copy/paste to system clipboard +opt.swapfile = false -- Don't use swapfile +opt.completeopt = 'menuone,noinsert,noselect' -- Autocomplete options + +-- Neovim UI +opt.relativenumber = true -- Show relative line numbers +opt.showmatch = true -- Highlight matching parenthesis +opt.foldmethod = 'marker' -- Enable folding (default 'foldmarker') +opt.colorcolumn = '80' -- Line lenght marker at 80 columns +opt.splitright = true -- Vertical split to the right +opt.splitbelow = true -- Horizontal split to the bottom +opt.ignorecase = true -- Ignore case letters when search +opt.smartcase = true -- Ignore lowercase for the whole pattern +opt.linebreak = true -- Wrap on word boundary +opt.termguicolors = true -- Enable 24-bit RGB colors +opt.laststatus=3 -- Set global statusline + +-- Tabs, indent +opt.expandtab = true -- Use spaces instead of tabs +opt.shiftwidth = 2 -- Shift 2 spaces when tab +opt.tabstop = 2 -- 1 tab == 2 spaces +opt.smartindent = true -- Autoindent new lines + +-- Memory, CPU +opt.hidden = true -- Enable background buffers +opt.history = 100 -- Remember N lines in history +opt.lazyredraw = true -- Faster scrolling +opt.synmaxcol = 240 -- Max column for syntax highlight +opt.updatetime = 250 -- ms to wait for trigger an event diff --git a/.config/nvim/lua/core/packer.lua b/.config/nvim/lua/core/packer.lua @@ -0,0 +1,17 @@ +vim.cmd [[packadd packer.nvim]] + +return require('packer').startup(function(use) + -- Packer can manage itself + use 'wbthomason/packer.nvim' + + use('preservim/nerdtree') + + use('jreybert/vimagit') + + use('vim-airline/vim-airline') + + use('ap/vim-css-color') + + use('vimwiki/vimwiki') + +end) diff --git a/.config/nvim/lua/core/remaps.lua b/.config/nvim/lua/core/remaps.lua @@ -0,0 +1,29 @@ +local function map(mode, lhs, rhs, opts) + local options = { noremap=true, silent=true } + if opts then + options = vim.tbl_extend('force', options, opts) + end + vim.api.nvim_set_keymap(mode, lhs, rhs, options) +end + +vim.g.mapleader = ' ' + +-- General mappings +map('i', 'kk', '<Esc>') +map('n', '<leader>c', ':nohl<CR>') + +-- Movement +map('n', '<C-h>', '<C-w>h') +map('n', '<C-j>', '<C-w>j') +map('n', '<C-k>', '<C-w>k') +map('n', '<C-l>', '<C-w>l') + +-- Terminal +map('n', '<C-t>', ':Term<CR>', { noremap = true}) +map('n', '<Esc>', '<C-\\><C-n>') + +-- NERDTree +map('n', '<leader>q', ':NERDTreeToggle<CR>') + +-- Vimagit +map('n', '<leader>g', ':Magit<CR>')