From bb31dbfd4e788f0efcbb0e6ab8264a12116aa672 Mon Sep 17 00:00:00 2001 From: Charles Date: Sat, 7 Mar 2020 23:40:57 +0100 Subject: xmonad brightness handling --- .vimrc | 13 +++++++------ grep.vim | 18 ++++++++++++++++++ install.sh | 7 ++++++- xmonad.hs | 7 ++----- 4 files changed, 33 insertions(+), 12 deletions(-) create mode 100644 grep.vim diff --git a/.vimrc b/.vimrc index 9d7059e..7a329af 100644 --- a/.vimrc +++ b/.vimrc @@ -106,26 +106,27 @@ nnoremap l :ls " file manipulation with leader nnoremap w :w nnoremap x :x - " open vimrc in split nnoremap rc :vsplit $MYVIMRC " source vimrc nnoremap src :source $MYVIMRC - " file toggle nnoremap z zi - " create c function body from prototype nnoremap gcf A{} - " put semicolon at the end of line nnoremap ; mqA;`q +" grep +" nnoremap gw :silent grep -R .:copen +" nnoremap gW :silent execute "grep! -R " . shellescape(expand("")) . " .":copen +" nnoremap gn :cnext +" nnoremap gp :cprevious + + " remove trailing white space on save autocmd BufWritePre * %s/\s\+$//e - " initialise buf for fold toggle autocmd BufReadPre * :normal zMzi - " real tab in c file for school projects autocmd Filetype c setlocal noexpandtab diff --git a/grep.vim b/grep.vim new file mode 100644 index 0000000..3b80fa1 --- /dev/null +++ b/grep.vim @@ -0,0 +1,18 @@ +nnoremap g :set operatorfunc=GrepOpg@ +vnoremap g :call GrepOp(visualmode()) + +function! s:GrepOp(type) + let saved = @@ + + if a:type ==# 'v' + execute "normal! `y" + elseif a:type ==# 'char' + execute "normal! `[v`]y" + else + return + endif + + silent execute "grep! -R " . shellescape(@@) . " ." + copen + let @@ = saved +endfunction diff --git a/install.sh b/install.sh index 4076d59..1929eb8 100755 --- a/install.sh +++ b/install.sh @@ -10,6 +10,8 @@ # Creating links ln -sf $DOTDIR/.zshrc $HOME/.zshrc ln -sf $DOTDIR/.vimrc $HOME/.vimrc +[ ! -d $HOME/.vim/plugin ] && mkdir -p $HOME/.vim/plugin +ln -sf $DOTDIR/grep.vim $HOME/.vim/plugin/grep.vim [ ! -d $HOME/.xmonad ] && mkdir $HOME/.xmonad ln -sf $DOTDIR/xmonad.hs $HOME/.xmonad/xmonad.hs @@ -26,8 +28,11 @@ ln -sf $DOTDIR/redshift.conf $HOME/.config/redshift.conf ################ # vim Plug -curl -fLo ~/.vim/autoload/plug.vim --create-dirs \ +PLUGFILE=$HOME/.vim/autoload/plug.vim +if [ ! -f $PLUGFILE ]; then +curl -fLo $PLUGFILE --create-dirs \ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim +fi vim -c "PlugInstall" -c "qa" # zsh pluggins diff --git a/xmonad.hs b/xmonad.hs index eb9edb3..d64f95b 100644 --- a/xmonad.hs +++ b/xmonad.hs @@ -27,9 +27,6 @@ myStartupHook = do myKeys = [ ("", spawn "pulseaudio-ctl up") , ("", spawn "pulseaudio-ctl down") , ("", spawn "pulseaudio-ctl mute") + , ("", spawn "xbacklight -inc 5") + , ("", spawn "xbacklight -dec 5") ] - -- , ("", spawn "playerctl play-pause") - -- , ("", spawn "playerctl previous") - -- , ("", spawn "playerctl next") - -- , ("", spawn "lux -a 5%") - -- , ("", spawn "lux -s 5%") -- cgit