Compare commits

...

2 commits

4 changed files with 45 additions and 3 deletions

16
bin/git-pick Executable file
View file

@ -0,0 +1,16 @@
#!/bin/sh
mkdir -p "$(git rev-parse --git-dir)/fzf"
history="$(git rev-parse --git-dir)/fzf/history"
null=$(printf "\0")
IFS=''
git status --porcelain | while read line
do
path=$(echo $line | cut -b 4-)
type=$(echo $line | cut -b -3)
/bin/echo -e "$type\x00$(basename $path)\x00$path"
done \
| fzf --multi --with-nth=2 -d '\0' -q "$*" --history=$history \
--preview='if [ ${1} = "??" ]; then /bin/echo -e "\x1b[32m"; cat {3}; else git diff --color {3}; fi' \
| cut -d "$null" -f 3-

View file

@ -20,7 +20,8 @@
[alias]
adog = log --all --decorate --oneline --graph --date-order
dog = log --decorate --oneline --graph --date-order
fadd = "! git pick-modified | xargs --open-tty git add"
fadd = "! git pick | xargs --open-tty git add"
fig = "! git pick | xargs -L1 git ignore"
faddall = "! git status --porcelain | cut -b 4- | fzf --multi --layout=reverse-list | xargs --open-tty git add"
fixup = "!git commit --patch --no-edit --amend $(git diff --name-only HEAD~1..HEAD)"
h = log -1 --format=%h
@ -34,8 +35,6 @@
track = add --intent-to-add
ts = timeshift
reword = commit --amend --no-verify
pick-modified = "! git status --porcelain | sed '/^??/d' | cut -b 4- | fzf --multi --layout reverse-list"
pm = pick-modified
[user]
useConfigOnly = true
[user "darkwiiplayer"]

View file

@ -46,4 +46,29 @@ return function(_, bufnr)
vim.lsp.buf.rename()
end
end, {nargs = "?"})
vim.api.nvim_buf_create_user_command(bufnr, "LspDocumentHighlight", function(args)
local disable = vim.b.document_highlight
arg = args.fargs[1]
if arg then
if string.lower(arg) == "on" then
disable = false
elseif string.lower(arg) == "off" then
disable = true
else
error "Argument must be either 'on' or 'off' or absent"
end
end
if disable then
require("lsp.document_highlight").stop(bufnr)
vim.b.document_highlight = false
else
require("lsp.document_highlight").start(bufnr)
vim.b.document_highlight = true
end
end, {nargs = "?", complete = function(lead)
return vim.fn.filter({ "on", "off" }, function(_, val)
return val:find("^" .. lead)
end)
end})
end

2
vimrc
View file

@ -5,6 +5,8 @@ let &rtp=&rtp.','.expand('<sfile>:p:h').'/vim/pack/*/start/*'
set nocompatible
set updatetime=600
au VimEnter * TSEnable highlight
au VimEnter * TSEnable incremental_selection
au VimEnter * TSEnable indent