aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.vimrc13
-rw-r--r--grep.vim18
-rwxr-xr-xinstall.sh7
-rw-r--r--xmonad.hs7
4 files changed, 33 insertions, 12 deletions
diff --git a/.vimrc b/.vimrc
index 9d7059e..7a329af 100644
--- a/.vimrc
+++ b/.vimrc
@@ -106,26 +106,27 @@ nnoremap <leader>l :ls<CR>
" file manipulation with leader
nnoremap <leader>w :w<CR>
nnoremap <leader>x :x<CR>
-
" open vimrc in split
nnoremap <leader>rc :vsplit $MYVIMRC<cr>
" source vimrc
nnoremap <leader>src :source $MYVIMRC<cr>
-
" file toggle
nnoremap <leader>z zi
-
" create c function body from prototype
nnoremap gcf A<BS><CR>{<CR><CR>}<ESC>
-
" put semicolon at the end of line
nnoremap <leader>; mqA;<ESC>`q
+" grep
+" nnoremap <leader>gw :silent grep -R <cword> .<CR>:copen<CR>
+" nnoremap <leader>gW :silent execute "grep! -R " . shellescape(expand("<cWORD>")) . " ."<CR>:copen<CR>
+" nnoremap <leader>gn :cnext<CR>
+" nnoremap <leader>gp :cprevious<CR>
+
+
" 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 <leader>g :set operatorfunc=<SID>GrepOp<CR>g@
+vnoremap <leader>g :<C-u>call <SID>GrepOp(visualmode())<CR>
+
+function! s:GrepOp(type)
+ let saved = @@
+
+ if a:type ==# 'v'
+ execute "normal! `<v`>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 = [ ("<XF86AudioRaiseVolume>", spawn "pulseaudio-ctl up")
, ("<XF86AudioLowerVolume>", spawn "pulseaudio-ctl down")
, ("<XF86AudioMute>", spawn "pulseaudio-ctl mute")
+ , ("<XF86MonBrightnessUp>", spawn "xbacklight -inc 5")
+ , ("<XF86MonBrightnessDown>", spawn "xbacklight -dec 5")
]
- -- , ("<XF86AudioPlay>", spawn "playerctl play-pause")
- -- , ("<XF86AudioPrev>", spawn "playerctl previous")
- -- , ("<XF86AudioNext>", spawn "playerctl next")
- -- , ("<XF86MonBrightnessUp>", spawn "lux -a 5%")
- -- , ("<XF86MonBrightnessDown>", spawn "lux -s 5%")