commit a2dc28a361a5846e35c5014935604fbf4e694ee2
parent 627ef4695587ded1354ef850342a7f3b425247a8
Author: Bharatvaj <bharatvaj@yahoo.com>
Date: Mon, 4 Jul 2022 17:01:03 +0530
Merge branch 'windows_leftovers' into base
Diffstat:
14 files changed, 85 insertions(+), 44 deletions(-)
diff --git a/.config/.gitignore b/.config/.gitignore
@@ -9,8 +9,10 @@
!bash/**
!clink
!clink/clink_settings
+cmd/userenv.bat
+!cmd/
+# TODO specify each file individually
!cmd/
-!cmd/**
!git/
!git/config
!i3
diff --git a/.config/cmd/aliases.bat b/.config/cmd/aliases.bat
@@ -3,6 +3,4 @@ doskey vi=vim $*
doskey n=nvim $*
doskey g=git $*
doskey e=%EDITOR% $*
-doskey l=%USERPROFILE%\.config\cmd\lfcd.cmd
-
-set SOURCE_DEV_TOOLS="C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\Build\vcvarsall.bat"
+doskey l=lfcd.cmd
diff --git a/.config/cmd/env.bat b/.config/cmd/env.bat
@@ -0,0 +1,15 @@
+set HOME=%USERPROFILE%
+set XDG_CONFIG_HOME=%USERPROFILE%\.config
+set XDG_DATA_HOME=%USERPROFILE%\.local\share
+set XDG_CACHE_HOME=%USERPROFILE%\.cache
+set VISUAL=vim
+set EDITOR=%VISUAL%
+
+set GNUPGHOME=%XDG_DATA_HOME%\gnupg
+set PASSWORD_STORE_DIR=%XDG_DATA_HOME%\pass
+set PASS_BASE_DIR=%XDG_DATA_HOME%\pass
+set NB_PATH=%XDG_DATA_HOME%\notebook
+
+set MYVIMRC=%XDG_CONFIG_HOME%\vim\vimrc
+set VIMINIT=source $MYVIMRC
+set PATH=%PATH%;%USERPROFILE%\.local\bin\cmd
diff --git a/.config/cmd/environment.bat b/.config/cmd/environment.bat
@@ -1,9 +0,0 @@
-set VISUAL=vim
-set EDITOR=%VISUAL%
-set XDG_CONFIG_HOME=%USERPROFILE%\.config
-set XDG_DATA_HOME=%USERPROFILE%\.local\share
-set XDG_CACHE_HOME=%USERPROFILE%\.cache
-
-set MYVIMRC=%XDG_CONFIG_HOME%\vim\vimrc
-set VIMINIT=source $MYVIMRC
-
diff --git a/.config/cmd/profile.cmd b/.config/cmd/profile.cmd
@@ -3,5 +3,7 @@
cd %USERPROFILE%
prompt $P ∆
-@call %XDG_CONFIG_HOME%\cmd\environment.bat
+@call %XDG_CONFIG_HOME%\cmd\env.bat
+@call %XDG_CONFIG_HOME%\cmd\userenv.bat
+
@call %XDG_CONFIG_HOME%\cmd\aliases.bat
diff --git a/.config/cmd/setup.cmd b/.config/cmd/setup.cmd
@@ -11,3 +11,5 @@ IF NOT EXIST %USERPROFILE%\.config\vim\vimrc mklink %USERPROFILE%\_vimrc %USERPR
mkdir %SYSTEMDRIVE%\bin
cp %SCOOP%\apps\busybox\current\busybox.exe %SYSTEMDRIVE%\bin
cp %SCOOP%\shims\sh.* %SYSTEMDRIVE%\bin
+:: TODO Report this in scoop and remove this line
+rm %SCOOP%\apps\gpg\current\bin\gpgconf.ctl
diff --git a/.config/nvim/lua/keybindings.lua b/.config/nvim/lua/keybindings.lua
@@ -0,0 +1,10 @@
+local map = require("utils").map
+map("n", "<Leader>ww", ":w<CR>", { silent = true })
+map("n", "<Leader>wq", ":wq<CR>", { silent = true })
+map("n", "<Leader>qq", ":q<CR>", { silent = true })
+map("n", "<CR>", ":noh<CR>", { silent = true })
+
+map("n", "<leader>f", ":find ", { silent = false })
+map("n", "<leader>co", ":copen<cr>", { silent = false })
+map("n", "<leader>g", ":grep ", { silent = false})
+map("n", "<leader>ec", ":edit ~/.config/nvim/init.lua<cr>", { silent = false})
diff --git a/.config/sh/aliases b/.config/sh/aliases
@@ -36,4 +36,4 @@ alias g=git
alias l=lfcd
alias n='nvim'
alias v='vim'
-alias x=extract
+alias x=extract_archive
diff --git a/.config/sh/functions b/.config/sh/functions
@@ -1,5 +1,5 @@
# TODO implement [dest_dir] functionality
-extract () {
+extract_archive () {
test $# -lt 1 && { printf "Usage: $0 <archive>\n"; exit 1; }
test -f $1 || { printf "$0: $1: No such file \n"; exit 1; }
case $1 in
diff --git a/.config/vim/keybindings/keybindings.vim b/.config/vim/keybindings/keybindings.vim
@@ -1,14 +1,19 @@
" General keybindings
-nnoremap <leader>t :tabnew<cr>
-nnoremap <leader>p :Rg<cr>
-nnoremap <leader>f :find
-nnoremap <Leader>l :ls<CR>:b<space>
nmap <leader>F :GFiles<cr>
+nnoremap <Leader>l :ls<CR>:b<space>
+nnoremap <leader><leader> :grep
nnoremap <leader>co :copen<cr>
-nnoremap <leader>g :grep
nnoremap <leader>ec :edit ~/.config/vim/vimrc<cr>
+nnoremap <leader>f :find
+nnoremap <leader>g :grep
+nnoremap <leader>p :Rg<cr>
+nnoremap <leader>t :tabnew<cr>
nnoremap Y y$
+
+fun! GitFind()
+endfun
+
fun! SetupCommandAlias(from, to)
exec 'cnoreabbrev <expr> '.a:from
\ .' ((getcmdtype() is# ":" && getcmdline() is# "'.a:from.'")'
@@ -37,7 +42,13 @@ nnoremap <leader>ww :w<cr>
nnoremap <leader>qq :q<cr>
" Run Make
-nnoremap <leader>bb :Make<CR>
+
+function SaveAndBuild()
+ wall
+ Make
+endfunction
+
+nnoremap <leader>bb :call SaveAndBuild()<CR>
" Generate ctags
map <leader>c :!ctags -R -f ./.git/tags .<CR>
diff --git a/.gitignore b/.gitignore
@@ -17,7 +17,7 @@
# Local shell scripts
!.local/
!.local/bin/
-!.local/bin/*
+!.local/bin/**
# !.local/share/vim/pack/**/start/**
# !.local/share/vim/pack/**/opt/**
diff --git a/.local/bin/cmd/j.cmd b/.local/bin/cmd/j.cmd
@@ -0,0 +1,16 @@
+@echo off
+setlocal EnableDelayedExpansion
+
+for /f "delims=" %%i in ('"autojump.exe" %*') do set new_path=%%i
+if exist !new_path!\nul (
+echo "!new_path!"
+pushd "!new_path!"
+REM endlocal is necessary so that we can change directory for outside of this script
+REM but will automatically popd. We mush pushd twice to work around this.
+pushd "!new_path!"
+endlocal
+popd
+) else (
+echo autojump: directory %* not found
+echo try `autojump --help` for more information
+)
diff --git a/.local/bin/cmd/lfcd.cmd b/.local/bin/cmd/lfcd.cmd
@@ -0,0 +1,15 @@
+@echo off
+rem Change working dir in cmd.exe to last dir in lf on exit.
+rem
+rem You need to put this file to a folder in %PATH% variable.
+
+:tmploop
+set tmpfile="%tmp%\lf.%random%.tmp"
+if exist %tmpfile% goto:tmploop
+lf -last-dir-path=%tmpfile% %*
+if not exist %tmpfile% exit
+set /p dir=<%tmpfile%
+del /f %tmpfile%
+if not exist "%dir%" exit
+if "%dir%" == "%cd%" exit
+cd /d "%dir%"
diff --git a/.local/bin/passfind b/.local/bin/passfind
@@ -1,21 +0,0 @@
-#!/bin/sh
-
-# Adapted from https://gist.github.com/heywoodlh/4c1e27f477a896bc3b0f6d55e2748d26
-
-## Assumes that the user is using otp plugin
-## Install fzf and make sure pass is configured beforehand
-
-## If you want to grab the totp code, use like so: `pass-fzf.sh otp`, otherwise script will assume you want password
-
-type="${1}"
-
-PASS_DIR=${XDG_DATA_HOME}/pass
-selection="$(find -L ${PASS_DIR} -name '*.gpg' -exec realpath --relative-to=${PASS_DIR} {} | sed -e 's/.gpg//' | fzf --layout=reverse)"
-
-if [ "${type}" == "otp" ]
-then
- pass otp show "${selection}"
-else
- pass show "${selection}"
-fi
-