dotfiles

Cross platform dotfiles for linux, mac and windows
git clone git@getsh.org:dotfiles.git
Log | Files | Refs

commit 7f98c9f4e28483e42fd0867eab1e3e1b50778084
parent 7db4d15022274fae7daefa2cba8ebffe7b8ed5b7
Author: Bharatvaj <bharatvaj@yahoo.com>
Date:   Sat,  1 Oct 2022 06:27:06 +0530

Add snippets for vim with minisnip

Move common properties to vimcommon/vimrc

Add sh/irc and sh/ncp

Diffstat:
M.config/nvim/init.lua | 8+++-----
M.config/vim/vimrc | 13++++---------
M.gitignore | 6+++---
M.gitmodules | 3+++
R.local/bin/call -> .local/bin/bash/call | 0
A.local/bin/sh/irc | 25+++++++++++++++++++++++++
A.local/bin/sh/ncp | 11+++++++++++
M.local/share/.gitignore | 15+++++++++++++++
A.local/share/vimcommon/minisnip/_c_i | 1+
A.local/share/vimcommon/minisnip/_c_main | 4++++
A.local/share/vimcommon/minisnip/_c_p | 1+
A.local/share/vimcommon/minisnip/_cmake_min | 5+++++
A.local/share/vimcommon/minisnip/_cmake_p | 1+
A.local/share/vimcommon/minisnip/_cpp_cout | 1+
A.local/share/vimcommon/minisnip/_java_main | 3+++
A.local/share/vimcommon/minisnip/_java_p | 1+
A.local/share/vimcommon/minisnip/_sh_p | 1+
A.local/share/vimcommon/pack/general/start/vim-minisnip | 1+
A.local/share/vimcommon/vimrc | 5+++++
19 files changed, 88 insertions(+), 17 deletions(-)

diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua @@ -27,8 +27,10 @@ g.netrw_liststyle = 3 require('nvim_comment').setup() +-- TODO use lua api +vim.cmd('source $XDG_DATA_HOME/vimcommon/vimrc') + vim.cmd([[ -set packpath^=$XDG_DATA_HOME/vimcommon function! s:load_plugins(t) abort packadd vim-tmux-navigator packadd mru @@ -44,7 +46,3 @@ augroup user_cmds augroup END ]]) --- theme --- hyper-red --- TODO use lua api -vim.cmd('source $XDG_CONFIG_HOME/vim/hyper-red.vim') diff --git a/.config/vim/vimrc b/.config/vim/vimrc @@ -54,7 +54,6 @@ set nospell set background=dark syntax on indent off -source $XDG_CONFIG_HOME/vim/hyper-red.vim " Plugins source $XDG_CONFIG_HOME/vim/plugin/plugin.vim @@ -62,8 +61,10 @@ source $XDG_CONFIG_HOME/vim/plugin/plugin.vim " Keybindings source $XDG_CONFIG_HOME/vim/keybindings.vim +" Common vimrc +source $XDG_DATA_HOME/vimcommon/vimrc + set packpath^=$XDG_DATA_HOME/vim -set packpath^=$XDG_DATA_HOME/vimcommon function! s:load_plugins(t) abort set synmaxcol=128 @@ -86,6 +87,7 @@ function! s:load_plugins(t) abort packadd vim-surround packadd vim-ninja-feet packadd vim-fugitive + packadd vim-unimpaired packadd vim-better-whitespace packadd gruvbox-material endfunction @@ -95,13 +97,6 @@ augroup user_cmds autocmd VimEnter * call timer_start(20, function('s:load_plugins')) augroup END -function! SetColorColumnColor() - if &background ==# 'dark' - source $XDG_CONFIG_HOME/vim/hyper-red.vim - endif -endfunction -autocmd OptionSet background call SetColorColumnColor() - if has("gui") source $XDG_CONFIG_HOME/vim/gvimrc endif diff --git a/.gitignore b/.gitignore @@ -14,8 +14,9 @@ # Config !.config/ -# Local shell scripts !.local/ + +# Local shell scripts !.local/bin/ # !.local/bin/** !.local/bin/cmd/ @@ -23,5 +24,4 @@ !.local/bin/sh/ !.local/bin/sh/** -# !.local/share/vim/pack/**/start/** -# !.local/share/vim/pack/**/opt/** +!.local/share/ diff --git a/.gitmodules b/.gitmodules @@ -67,3 +67,6 @@ [submodule ".local/share/vim/pack/general/opt/vim-maildir"] path = .local/share/vim/pack/general/opt/vim-maildir url = https://github.com/ferranpm/vim-maildir +[submodule ".local/share/vimcommon/pack/general/start/vim-minisnip"] + path = .local/share/vimcommon/pack/general/start/vim-minisnip + url = https://github.com/joereynolds/vim-minisnip/ diff --git a/.local/bin/call b/.local/bin/bash/call diff --git a/.local/bin/sh/irc b/.local/bin/sh/irc @@ -0,0 +1,25 @@ +#!/bin/sh + +test -z "${FUZZER}" && { printf "FUZZER not set\n"; exit 1; } + +CHATS="irc.freenode.net\nirc.libera.chat" + +startii() { + pick=`echo ${CHATS} | ${FUZZER}` + ii -s "${pick}" -n $IRC_NICK & +} + +startvim() { + vim "+packadd birck.vim | Birck" +} + + +iipid="$(pgrep ii)" + +if [ -n "${iipid}" ]; then + printf "ii is already running with pid: %s\n" "${iipid}" +else + startii +fi + +startvim diff --git a/.local/bin/sh/ncp b/.local/bin/sh/ncp @@ -0,0 +1,11 @@ +#!/bin/sh + +# Copies the given file over a server. +# 0x0.st is used for copying. +# WARNING: Don't use this for sensitive files. +if [ $# -ne 1 ]; then + printf "Usage: %s <file_to_upload>\n" "$0" + exit 1 +fi +file_to_upload="$1" +curl -F "file=@$file_to_upload" https://0x0.st diff --git a/.local/share/.gitignore b/.local/share/.gitignore @@ -1,2 +1,17 @@ +!vim/ !vim/pack/ !vim/pack/* + +!nvim/ +!nvim/pack/ +!nvim/pack/** + + +!vimcommon/ +!vimcommon/* +!vimcommon/pack/ +!vimcommon/pack/** +!vimcommon/minisnip/ +!vimcommon/minisnip/* + +tags diff --git a/.local/share/vimcommon/minisnip/_c_i b/.local/share/vimcommon/minisnip/_c_i @@ -0,0 +1 @@ +#include <{{++}}.{{+h+}}> diff --git a/.local/share/vimcommon/minisnip/_c_main b/.local/share/vimcommon/minisnip/_c_main @@ -0,0 +1,4 @@ +int main(int argc, char* argv[]) { + {{++}} + return 0; +} diff --git a/.local/share/vimcommon/minisnip/_c_p b/.local/share/vimcommon/minisnip/_c_p @@ -0,0 +1 @@ +printf("{{+%s\n+}}", {{++}}); diff --git a/.local/share/vimcommon/minisnip/_cmake_min b/.local/share/vimcommon/minisnip/_cmake_min @@ -0,0 +1,5 @@ +cmake_minimum_required(VERSION {{++}}) + +project({{++}}) + +add_executable({{++}} PUBLIC {{++}}) diff --git a/.local/share/vimcommon/minisnip/_cmake_p b/.local/share/vimcommon/minisnip/_cmake_p @@ -0,0 +1 @@ +messages({{++}}) diff --git a/.local/share/vimcommon/minisnip/_cpp_cout b/.local/share/vimcommon/minisnip/_cpp_cout @@ -0,0 +1 @@ +std::cout << {{++}} << std::endl; diff --git a/.local/share/vimcommon/minisnip/_java_main b/.local/share/vimcommon/minisnip/_java_main @@ -0,0 +1,3 @@ +public static void main(String args[]) { + {{++}} +} diff --git a/.local/share/vimcommon/minisnip/_java_p b/.local/share/vimcommon/minisnip/_java_p @@ -0,0 +1 @@ +System.out.print({{++}}); diff --git a/.local/share/vimcommon/minisnip/_sh_p b/.local/share/vimcommon/minisnip/_sh_p @@ -0,0 +1 @@ +printf "{{+%s\n+}}" {{+""+}} diff --git a/.local/share/vimcommon/pack/general/start/vim-minisnip b/.local/share/vimcommon/pack/general/start/vim-minisnip @@ -0,0 +1 @@ +Subproject commit 1897727298c658dde9ec9deda0e56b608c8b2f32 diff --git a/.local/share/vimcommon/vimrc b/.local/share/vimcommon/vimrc @@ -0,0 +1,5 @@ +set packpath^=$XDG_DATA_HOME/vimcommon + +let g:minisnip_dir=$XDG_DATA_HOME . '/vimcommon/minisnip' + +source $XDG_CONFIG_HOME/vim/hyper-red.vim