summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorluxagraf <sng@luxagraf.net>2020-07-15 09:29:55 -0400
committerluxagraf <sng@luxagraf.net>2020-07-15 09:29:55 -0400
commit768a4df311c1a0b296481860258a7f58d3a87fa6 (patch)
tree2e0b10a24ebc607b9bdfcc727f99f802ee89348d
parentfe4d14419e52e4afbc2a7feefdc34cae2f30a3e1 (diff)
added latest tweaks to my setup
-rw-r--r--.bashrc61
-rw-r--r--.config/ranger/bookmarks2
-rw-r--r--.config/sway/config19
-rw-r--r--.gitignore_global1
-rw-r--r--.newsboat/config2
-rw-r--r--.tmux.conf4
-rw-r--r--.vimrc57
-rwxr-xr-xbin/fuz19
-rwxr-xr-xbin/fzsnip4
-rw-r--r--bin/parse_subids.py14
-rwxr-xr-xbin/snippet.py9
11 files changed, 156 insertions, 36 deletions
diff --git a/.bashrc b/.bashrc
index 8c3348c..b10576d 100644
--- a/.bashrc
+++ b/.bashrc
@@ -55,12 +55,20 @@ HISTTIMEFORMAT='%F %T '
shopt -s autocd
shopt -s cdable_vars
+export FZF_DEFAULT_OPTS="
+--color dark,hl:33,hl+:37,fg+:235,bg+:136,fg+:254
+--color info:254,prompt:37,spinner:108,pointer:235,marker:235
+ --no-mouse --height 70% -1 --multi --inline-info --preview='[[ \$(file --mime {}) =~ binary ]] && echo {} is a binary file || (bat --style=numbers --color=always {} || cat {}) 2> /dev/null | head -300' --preview-window='right:hidden:wrap' --bind='f3:execute(bat --style=numbers {} || less -f {}),f2:toggle-preview,ctrl-d:half-page-down,ctrl-u:half-page-up,ctrl-a:select-all+accept,ctrl-y:execute-silent(echo {+} | wl-copy),ctrl-x:execute(rm -i {+})+abort'"
+if type rg &> /dev/null; then
+ export FZF_DEFAULT_COMMAND='rg --files --no-ignore-vcs --hidden'
+ export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND"
+fi
# Don't use ~ to define your home here, it won't work.
export wir="$HOME/writing/wired"
export reg="$HOME/writing/register"
export ars="$HOME/writing/ars-technica/"
export l="$HOME/writing/luxagraf/"
-export lux="$HOME/Sites/luxagraf"
+export lux="$HOME/sites/luxagraf.net"
export d="$HOME/documents"
export rec="$HOME/documents/recipes"
@@ -89,7 +97,20 @@ export PS1="\[\033[33;1m\]\[\033[m\]\$(pwd-prompt.bash) \[$txtred\]\$git_dirty\[
# Complete all the things
source ~/bin/pass-completion.bash
-
+source /usr/share/fzf/key-bindings.bash
+source /usr/share/fzf/completion.bash
+
+fzf-snippet() {
+ selected="$(cat ~/documents/snippets | sed '/^$/d' | sort -n | fzf -e -i )"
+ # remove tags, leading and trailing spaces, also no newline
+ printf "$selected" | sed -e s/\;\;\.\*\$// | sed 's/^[ \t]*//;s/[ \t]*$//' | wl-copy
+}
+
+fzf-snip() {
+ selected="$(python ~/bin/snippet.py | fzf -e -i )"
+ #strip tags and any trailing space before sending to wl-copy
+ echo -e "$selected"| sed -e 's/tags\:\.\*\$//;$d' | wl-copy
+}
# get a forecast:
function fore(){
@@ -113,10 +134,18 @@ function fnt(){
#fuzzy find
function f() {
- find ${2:-.} -name \*$1\*
+ rg -l $1 ${2:-.} | fzf --preview="bat {}" --preview-window=right:70%:wrap
}
+#fuzzy find file names only
+function ff() {
+ ag -g "$1" ${2:-.} | fzf --preview="bat {}" --preview-window=right:70%:wrap
+}
+# Notational Velocity
+function fn() {
+ rg -l $1 ${2:-~/notes} | fzf --preview="bat {}" --preview-window=right:70%:wrap
+}
function tolux() {
scp $3 $1 lxf:/home/lxf/$2
@@ -154,6 +183,8 @@ function extract() # Handy Extract Program
export PIP_REQUIRE_VIRTUALENV=true
# cache pip-installed packages to avoid re-downloading
export PIP_DOWNLOAD_CACHE=$HOME/.pip/cache
+export BAT_PAGER="less -R"
+export BAT_THEME="Monokai Extended"
# Create a new directory and enter it
function md() {
@@ -231,9 +262,7 @@ function markdone(){
}
fd() {
- local dir
- dir=$(find ${1:-.} -path '*/\.*' -prune \
- -o -type d -print 2> /dev/null | fzf +m) &&
+ dir=$(zg ${1:-~/} -path '*/\.*' -prune -o -type d -print 2> /dev/null | fzf +m) &&
cd "$dir"
}
@@ -350,3 +379,23 @@ ssh-add -l >/dev/null || alias ssh='ssh-add -l >/dev/null || ssh-add && unalias
#PATH="$(ruby -e 'print Gem.user_dir')/bin:$PATH"
+
+fd() {
+ local dir
+ dir=$(find ${1:-.} -path '*/\.*' -prune \
+ -o -type d -print 2> /dev/null | fzf +m) &&
+ cd "$dir"
+}
+
+# fshow - git commit browser
+fshow() {
+ git log --graph --color=always \
+ --format="%C(auto)%h%d %s %C(black)%C(bold)%cr" "$@" |
+ fzf --ansi --no-sort --reverse --tiebreak=index --bind=ctrl-s:toggle-sort \
+ --bind "ctrl-m:execute:
+ (grep -o '[a-f0-9]\{7\}' | head -1 |
+ xargs -I % sh -c 'git show --color=always % | less -R') << 'FZF-EOF'
+ {}
+FZF-EOF"
+}
+RIPGREP_CONFIG_PATH=~/.ripgreprc
diff --git a/.config/ranger/bookmarks b/.config/ranger/bookmarks
index a0e839a..459a76b 100644
--- a/.config/ranger/bookmarks
+++ b/.config/ranger/bookmarks
@@ -1,4 +1,4 @@
-':/home/lxf
+':/home/lxf/sites/discursive/design/sass
d:/home/lxf/documents
l:/home/lxf/writing/luxagraf
b:/home/lxf/writing/lbh
diff --git a/.config/sway/config b/.config/sway/config
index 804d73f..eacbd05 100644
--- a/.config/sway/config
+++ b/.config/sway/config
@@ -218,13 +218,22 @@ bindsym $mod+Space exec alacritty --class 'launcher' --command bash -c 'compgen
# pass chooser
bindsym $mod+p exec alacritty --class 'launcher' --command bash -c 'pass clip --fzf | xargs -r swaymsg -t command exec'
-#snippet manager
-bindsym $mod+s exec alacritty --class 'launcher' --command bash -c 'pet exec | wl-copy | xargs -r swaymsg -t command exec'
-
for_window [app_id="^launcher$"] floating enable, border none, resize set width 25 ppt height 20 ppt, move position 0 px 0 px
-bindsym $mod+b exec alacritty --class 'qutesearch' --command bash -c 'url=$(cat .config/qutebrowser/bookmarks/urls | fzf | cut -d \" \" -f 1) && qutebrowser "$url" | xargs -r swaymsg -t command exec'
+#snippet manager old
+#bindsym $mod+s exec alacritty --class 'launcher' --command bash -c 'pet exec | wl-copy | xargs -r swaymsg -t command exec'
+
+#snippet manager
+bindsym $mod+s exec alacritty --class 'smsearch' --command bash -c 'fzsnip | xargs -r swaymsg -t command exec'
+
+bindsym $mod+b exec alacritty --class 'smsearch' --command bash -c 'url=$(cat .config/qutebrowser/bookmarks/urls | fzf | cut -d \" \" -f 1) && qutebrowser "$url" | xargs -r swaymsg -t command exec'
+
+for_window [app_id="^smsearch$"] floating enable, border none, resize set width 80 ppt height 60 ppt, move position 0 px 0 px
+
+
+bindsym $mod+n exec alacritty --class 'smsearch' --command bash -c 'notes'
-for_window [app_id="^qutesearch$"] floating enable, border none, resize set width 80 ppt height 60 ppt, move position 0 px 0 px
+for_window [app_id="^smsearch$"] floating enable, border none, resize set width 80 ppt height 60 ppt, move position 0 px 0 px
+exec udevmon -c /home/lxf/.udevmon.yaml >udevmon.log 2>udevmon.err &
exec_always ~/.config/waybar/waybar.sh
diff --git a/.gitignore_global b/.gitignore_global
index 610d761..26f2255 100644
--- a/.gitignore_global
+++ b/.gitignore_global
@@ -39,3 +39,4 @@ Thumbs.db
*.swo
bin/venv/
bin/venv3/
+!mail/*
diff --git a/.newsboat/config b/.newsboat/config
index 3b9dced..bfd5936 100644
--- a/.newsboat/config
+++ b/.newsboat/config
@@ -15,6 +15,8 @@ bind-key k up
bind-key g home
bind-key G end
+#macro y set browser "mpv %u" ; open-in-browser ; set browser "browser %u"
+
download-full-page yes
confirm-exit yes
#browser "~/bin/open-in-pane"
diff --git a/.tmux.conf b/.tmux.conf
index e3dd749..4cdf789 100644
--- a/.tmux.conf
+++ b/.tmux.conf
@@ -43,8 +43,8 @@ bind ^A select-pane -t :.+
# smart pane switching with awareness of vim splits
bind -n C-h run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-h) || tmux select-pane -L"
-bind -n C-j run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-j) || tmux select-pane -D"
-bind -n C-k run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-k) || tmux select-pane -U"
+bind -n C-n run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-j) || tmux select-pane -D"
+bind -n C-p run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-k) || tmux select-pane -U"
bind -n C-l run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-l) || tmux select-pane -R"
#alternative for ctrl-l
diff --git a/.vimrc b/.vimrc
index 46999b1..87bb5bb 100644
--- a/.vimrc
+++ b/.vimrc
@@ -6,7 +6,6 @@ call vundle#begin()
Bundle 'gmarik/Vundle.vim'
Bundle 'ervandew/supertab'
Bundle 'airblade/vim-gitgutter'
-Bundle 'ctrlpvim/ctrlp.vim'
Bundle 'scrooloose/syntastic'
Bundle 'tpope/vim-fugitive'
Bundle 'tpope/vim-surround'
@@ -23,12 +22,15 @@ Bundle 'christoomey/vim-tmux-navigator'
Bundle 'nicholaides/words-to-avoid.vim'
Bundle 'reedes/vim-wordy'
Bundle 'vim-scripts/vim-auto-save'
-Bundle 'vim-scripts/utl.vim'
Bundle 'tmhedberg/SimpylFold'
Bundle 'nvie/vim-flake8'
Bundle 'majutsushi/tagbar'
Bundle 'francoiscabrol/ranger.vim'
-Bundle 'rbgrouleff/bclose.vim'
+Bundle 'junegunn/fzf'
+Bundle 'junegunn/fzf.vim'
+Bundle 'chengzeyi/fzf-preview.vim'
+Bundle 'alok/notational-fzf-vim'
+Bundle 'junegunn/limelight.vim'
call vundle#end()
filetype plugin indent on
"}}}
@@ -72,12 +74,10 @@ let @c ='icheers Scott Gilbertson sng@luxagraf.net '
let @w ='icheers Scott Gilbertson scott_gilbertson@condenast.com'
let @t ='iThank you for your help. '
-let @m ='iScott Gilbertson 1720 Epps Bridge Pkwy Ste 108 #139 Athens, GA, 30606 (706) 438-4297 '
let @h ="iHello, my name is Scott Gilbertson and and I am a product writer with WIRED's Gear team. I am reaching out because we're working on an article about "
let @b ='tag=w050b-20'
let @n ='tag=wirednl-20'
let @d ='<div class="cluster"> <span class="row-2"> </span> </div>'
-
" get rid of line breaks in paragraphs
let @p ='g/^./ .,/^$/-1 join'
" }}}
@@ -105,13 +105,14 @@ map <silent> <C-U> ]s
map <silent> <C-I> z=
"quicker way to get to the thesaurus:
inoremap ;t <c-x><c-t>
-
+nnoremap ;m :%s/ $//<cr>
"Let's just leave the whole w out of it shall we.
noremap <C-h> <C-w>h
noremap <C-j> <C-w>j
noremap <C-k> <C-w>k
noremap <C-l> <C-w>l
+nmap <leader>n :NV!<cr>
" Convert curly quotes to straight. {{{
" Any argument causes substitute to confirm changes.
function! ToStraight(line1, line2, args)
@@ -278,7 +279,7 @@ set thesaurus+=/home/lxf/.mthesaur.txt
" NValt style searching with Ack to quicklist
command! -nargs=1 Nvs :Ack -i -n "<args>" $NOTES_DIR
command! -nargs=1 Ngrep vimgrep "<args>" $NOTES_DIR/*.txt|:cw
-noremap <leader>n :Ngrep
+"noremap <leader>n :Ngrep
noremap <leader>v :Nvs
" }}}
" Filetype stuff {{{
@@ -377,19 +378,34 @@ noremap zE <Nop>
" }}}
" Plugins {{{
"Ctrl P {{{
-nnoremap <leader>r :CtrlPMRU<cr>
-nnoremap <leader>m :CtrlPBuffer<cr>
-nnoremap <leader>. :CtrlP<cr>
-nnoremap <leader>w :CtrlP ~/writing/wired/<cr>
-nnoremap <leader>a :CtrlP app/<cr>
-nnoremap <leader>d :CtrlP $HOME/notes/<cr>
-nnoremap <leader>l :CtrlP $HOME/writing/luxagraf/<cr>
+"nnoremap <leader>r :CtrlPMRU<cr>
+"nnoremap <leader>m :CtrlPBuffer<cr>
+"nnoremap <leader>. :CtrlP<cr>
+"nnoremap <leader>w :CtrlP ~/writing/wired/<cr>
+"nnoremap <leader>a :CtrlP app/<cr>
+"nnoremap <leader>d :CtrlP $HOME/notes/<cr>
+"nnoremap <leader>l :CtrlP $HOME/writing/luxagraf/<cr>
let g:ctrlp_custom_ignore = {
\ 'dir': '\v[\/]\.(git|hg|svn|venv|site|static)$',
\ 'file': '\v\.(pyc|so|dll)$',
\ }
"}}}
+"FZF {{{
+let g:fzf_preview_window='right:60%'
+nnoremap <leader>. :FZF<cr>
+nnoremap <leader>r :History<cr>
+nnoremap <leader>w :FZF ~/writing/conde/wired/<cr>
+nnoremap <leader>a :FZF app/<cr>
+nnoremap <leader>l :FZF ~/writing/luxagraf/<cr>
+nnoremap <leader>g :BLines<cr>
+"}}}
+" FZF Notational Velocity plugin {{{
+let g:nv_search_paths = ['~/notes', '~/writing/luxagraf/', '~/documents/bookmarks/']
+"}}}
"
+" SimpylFold Python folding plugin {{{
+let g:SimpylFold_docstring_preview = 0
+"}}}
" make YCM compatible with UltiSnips (using supertab)
let g:ycm_key_list_select_completion = ['<C-n>', '<Down>']
let g:ycm_key_list_previous_completion = ['<C-p>', '<Up>']
@@ -399,6 +415,19 @@ let g:SuperTabDefaultCompletionType = '<C-n>'
" let g:UltiSnipsExpandTrigger = "<tab>"
" let g:UltiSnipsJumpForwardTrigger = "<tab>"
" let g:UltiSnipsJumpBackwardTrigger = "<s-tab>"
+"
+" goyo / limelight
+
+" Color name (:help cterm-colors) or ANSI code
+let g:limelight_conceal_ctermfg = 'gray'
+let g:limelight_conceal_ctermfg = 240
+"
+" " Color name (:help gui-colors) or RGB color
+let g:limelight_conceal_guifg = 'DarkGray'
+let g:limelight_conceal_guifg = '#777777'
+"
+" " Default: 0.5
+let g:limelight_default_coefficient = 0.5
nnoremap <silent> <c-s> :NV<CR>
let g:markdown_fold_style = 'nested'
diff --git a/bin/fuz b/bin/fuz
new file mode 100755
index 0000000..de158c1
--- /dev/null
+++ b/bin/fuz
@@ -0,0 +1,19 @@
+#!/usr/bin/env bash
+set -e
+
+main() {
+ previous_file="$1"
+ file_to_edit=`select_file $previous_file`
+
+ if [ -n "$file_to_edit" ] ; then
+ "$EDITOR" "$file_to_edit"
+ main "$file_to_edit"
+ fi
+}
+
+select_file() {
+ given_file="$1"
+ fzf --preview="bat {}" --preview-window=right:70%:wrap --query="$given_file"
+}
+
+main ""
diff --git a/bin/fzsnip b/bin/fzsnip
new file mode 100755
index 0000000..fd50bd1
--- /dev/null
+++ b/bin/fzsnip
@@ -0,0 +1,4 @@
+#!/usr/bin/env bash
+selected="$(python ~/bin/snippet.py | fzf -e -i )"
+#strip tags and any trailing space before sending to wl-copy
+echo -e "$selected"| sed -e 's/tags\:\.\*\$//;$d' | wl-copy
diff --git a/bin/parse_subids.py b/bin/parse_subids.py
index 5e8b8f2..466c15b 100644
--- a/bin/parse_subids.py
+++ b/bin/parse_subids.py
@@ -1,19 +1,17 @@
from bs4 import BeautifulSoup
import markdown
-
-with open('/home/lxf/writing/wired/bf-photo-deals.txt', 'r') as f:
+with open('/home/lxf/writing/conde/wired/weekend-deals-061320.txt', 'r') as f:
data = f.read()
-result = open('/home/lxf/writing/wired/subid-links.txt', 'a')
+result = open('/home/lxf/writing/conde/wired/subid-links.txt', 'a')
+print(data)
soup = BeautifulSoup(markdown.markdown(data), "lxml")
-subid = "blackfridayphotodeals2019"
-page_url = "https://www.wired.com/story/best-black-friday-photography-deals-2019/"
+subid = "weekenddeals06132020"
+page_url = "https://www.wired.com/story/weekend-deals-june-12-2020"
for a in soup.find_all('a'):
start = a['href'].split('//')[1][:4]
if str(start) == 'best' or start == 'goto':
- l = "%s,,%s,Impact,%s\n" % (page_url, subid, a['href'])
+ l = "%s,%s,%s,Impact,%s\n" % (page_url, subid, a.contents[0], a['href'])
result.write(l)
result.close()
-def parse_links(f):
-
diff --git a/bin/snippet.py b/bin/snippet.py
new file mode 100755
index 0000000..e3acad4
--- /dev/null
+++ b/bin/snippet.py
@@ -0,0 +1,9 @@
+import re
+with open('/home/lxf/documents/textsnippets.txt', 'r') as f:
+ data = f.read()
+snips = re.split("---", data)
+for snip in snips:
+ # strip the blank line at the end
+ s = '\n'.join(snip.split('\n')[1:-1])
+ #make sure we output the newlines, but no strong wrapping single quotes
+ print(repr(s.strip()).strip('\''))