From e3cb32d735eb180f8d7e349005f1b54b90f85c70 Mon Sep 17 00:00:00 2001 From: Gabe Venberg Date: Wed, 21 Jun 2023 22:32:39 -0500 Subject: [PATCH] added vim_minimal config, for server nvim setups. --- .../.config/systemd/user/ssh-agent.service | 2 +- vim_minimal/.config/nvim/foldtext.vimrc | 9 +++ vim_minimal/.config/nvim/init.lua | 81 +++++++++++++++++++ 3 files changed, 91 insertions(+), 1 deletion(-) create mode 100644 vim_minimal/.config/nvim/foldtext.vimrc create mode 100644 vim_minimal/.config/nvim/init.lua diff --git a/ssh-agent-systemd/.config/systemd/user/ssh-agent.service b/ssh-agent-systemd/.config/systemd/user/ssh-agent.service index 9428410..8b39bb8 100644 --- a/ssh-agent-systemd/.config/systemd/user/ssh-agent.service +++ b/ssh-agent-systemd/.config/systemd/user/ssh-agent.service @@ -4,7 +4,7 @@ Description=SSH key agent [Service] Type=simple Environment=SSH_AUTH_SOCK=%t/ssh-agent.socket -ExecStart=/usr/bin/ssh-agent -D -a $SSH_AUTH_SOCK +ExecStart=-/usr/bin/ssh-agent -D -a $SSH_AUTH_SOCK [Install] WantedBy=default.target diff --git a/vim_minimal/.config/nvim/foldtext.vimrc b/vim_minimal/.config/nvim/foldtext.vimrc new file mode 100644 index 0000000..9cb0e6b --- /dev/null +++ b/vim_minimal/.config/nvim/foldtext.vimrc @@ -0,0 +1,9 @@ +"TODO: port to LUA! +function! Minimal_foldtext() + let lines_count = v:foldend - v:foldstart + 1 + let lines_count_text = '+' . v:folddashes . '| ' . printf("%10S" , lines_count) . ' lines |' + let line_level_text = '| ' . printf("%8S" , 'level ' . v:foldlevel) . ' |' + let fold_text_end = line_level_text . repeat('-',8) + let fold_text_length = strlen(lines_count_text . fold_text_end) + &foldcolumn + return lines_count_text . repeat('-' , winwidth(0) - fold_text_length - 4) . fold_text_end +endfunction diff --git a/vim_minimal/.config/nvim/init.lua b/vim_minimal/.config/nvim/init.lua new file mode 100644 index 0000000..04b7e7d --- /dev/null +++ b/vim_minimal/.config/nvim/init.lua @@ -0,0 +1,81 @@ +--set some aliases to make typing this faster. +local cmd = vim.cmd +local opt = vim.opt +local fn = vim.fn +local map = vim.api.nvim_set_keymap + +--leader key is set through a variable, for some reason. +vim.g.mapleader = ';' + +--helper functions +local function keyCode(string) + return vim.api.nvim_replace_termcodes(str, true, true, true, true) +end + +--options using vim.opt (aliased, of course.) +opt.mouse = 'a' +opt.lazyredraw = true +opt.termguicolors = true +opt.autoread = true +opt.swapfile = false +opt.history = 500 +opt.formatoptions = 'rojq' +--disable hard text wrapping, will only wrap visually. +opt.textwidth = 0 +opt.wrapmargin = 0 +opt.wrap = true +opt.linebreak = true +opt.breakindent = true +--add ruler to side of screen. +opt.number = true +opt.numberwidth=2 +--displays cordinates of your cursor in statusbar +opt.ruler = true +--always leave 5 cells between cursor and side of window. +opt.scrolloff = 5 +--better command line completion +opt.wildmenu = true +--ignore case in search if search is all lowercase. +opt.ignorecase = true +opt.smartcase = true +--show unfinished commands in statusbar. +opt.showcmd = true +--regex stuff +opt.magic = true +--always have a status line +opt.laststatus = 2 +--tab stuff +opt.tabstop = 4 +opt.shiftwidth = 0 --zero inherrits tabstop. +opt.autoindent = true +opt.smartindent = true +opt.smarttab = true +--space based tabs. +-- opt.softtabstop=-1 --negative value inherrits shiftwidth. +-- opt.expandtab=true +--highlight search results as you type. +opt.hlsearch = true +opt.incsearch = true +--foling stuff +opt.foldlevelstart = 5 +cmd([[source ~/.config/nvim/foldtext.vimrc]]) +opt.foldmethod = 'indent' +opt.foldtext = 'minimal_foldtext()' +opt.fillchars = 'stl:=,stlnc: ,vert:|,fold:-' +opt.foldcolumn = '4' +opt.foldenable = true +opt.foldignore = '' + +--keyboard mappings +local opts = { noremap = true, silent = true } +--toggle spell check +map('n', 'sp', ':setlocal spell!', opts) +--use ctrl+direction to move between splits. +map('n', '', 'h', opts) +map('n', '', 'j', opts) +map('n', '', 'k', opts) +map('n', '', 'l', opts) +--toggle folds with space. +map('', '', 'za', opts) +--clear highlighting with leader+h +map('', 'h', ':nohls', opts)