diff --git a/.bin/xcons b/.bin/xcons index 85752b4..be920a9 100755 --- a/.bin/xcons +++ b/.bin/xcons @@ -14,8 +14,8 @@ else if xwininfo -id $WID | fgrep -q IsUnMapped then # move window to current workspace - #wmctrl -i -r $WID -t $(xprop -root _NET_CURRENT_DESKTOP | cut -d'=' -f2) - wmctrl -i -r $WID -t $_SWM_WS + wmctrl -i -r $WID -t $(xprop -root _NET_CURRENT_DESKTOP | cut -d'=' -f2) + #wmctrl -i -r $WID -t $_SWM_WS # remove hidden flag wmctrl -i -r $WID -b remove,hidden else diff --git a/.config/bspwm/bspwmrc b/.config/bspwm/bspwmrc index 9957f00..69cc2c2 100755 --- a/.config/bspwm/bspwmrc +++ b/.config/bspwm/bspwmrc @@ -55,3 +55,6 @@ V=$(( ${RES#*x} - 2 * GAP )) bspc rule -a mpv:floatmpv sticky=on state=floating rectangle=$GAP,$GAP,$H,$V bspc rule -a Screenkey manage=off bspc rule -a scratchpad sticky=on state=floating rectangle=$GAP,$GAP,$H,$V +bspc rule -a xconsole sticky=on state=floating rectangle=$GAP,$GAP,$H,$V + + diff --git a/.vim/pack/plugins/start/file-line/README.md b/.vim/pack/plugins/start/file-line/README.md new file mode 100644 index 0000000..107ca38 --- /dev/null +++ b/.vim/pack/plugins/start/file-line/README.md @@ -0,0 +1,58 @@ +# File-line + +`file-line` is a plugin for Vim that enables opening a file in a given line. + +This is a personal fork of +[github.com/bogado/file-line](https://github.com/bogado/file-line). The fork +was created to address [this](https://github.com/bogado/file-line/issues/52) +issue, but since the code was so short I decided to rather rewrite it and do +some simplifications. + +## Installation + +If you use [vim-plug](https://github.com/junegunn/vim-plug), then add the +following line to your `vimrc` file: + +```vim +Plug 'lervag/file-line' +``` + +Or use some other plugin manager: +- [vundle](https://github.com/gmarik/vundle) +- [neobundle](https://github.com/Shougo/neobundle.vim) +- [pathogen](https://github.com/tpope/vim-pathogen) + +## Usage + +When you open a `file:line`, for instance when coping and pasting from an error +from your compiler vim tries to open a file with a colon in its name. + +Examples: + + vim index.html:20 + vim app/models/user.rb:1337 + +With this little script in your plugins folder if the stuff after the colon is +a number and a file exists with the name specified before the colon vim will +open this file and take you to the line you wished in the first place. + +## Configuration + +```vim +" Specify fallback if column is not specified +" * True: Go to first column in line (like normal |) +" * False: Go to first nonblank column (like normal ^) +let g:file_line_fallback_column0 = 1 + +" Disable flashing crosshairs on the cursor line/column +let g:file_line_crosshairs = 1 + +" Customize crosshairs behaviour +let g:file_line_crosshairs_number = 2 +let g:file_line_crosshairs_duration = 200 +``` + +## License + +This script is licensed with GPLv3. + diff --git a/.vim/pack/plugins/start/file-line/plugin/file_line.vim b/.vim/pack/plugins/start/file-line/plugin/file_line.vim new file mode 100644 index 0000000..f6e1e9f --- /dev/null +++ b/.vim/pack/plugins/start/file-line/plugin/file_line.vim @@ -0,0 +1,77 @@ +if exists('g:loaded_file_line') | finish | endif +let g:loaded_file_line = 1 + +let g:file_line_crosshairs = get(g:, 'file_line_crosshairs', 1) +let g:file_line_crosshairs_number = get(g:, 'file_line_crosshairs_number', 2) +let g:file_line_crosshairs_duration = get(g:, 'file_line_crosshairs_duration', 200) +let g:file_line_fallback_column0 = get(g:, 'file_line_fallback_column0', 1) + +augroup file_line + autocmd! + autocmd! BufNewFile * nested call s:goto_file_line() + autocmd! BufRead * nested call s:goto_file_line() +augroup END + +function! s:goto_file_line(...) + let file_line_col = a:0 > 0 ? a:1 : bufname('%') + if filereadable(file_line_col) || file_line_col ==# '' + return file_line_col + endif + + " Regex to match variants like these: + " * file(10) + " * file(line:col) + " * file:line:column: + " * file:line:column + " * file:line + let matches = matchlist(file_line_col, + \ '\(.\{-1,}\)[(:]\(\d\+\)\%(:\(\d\+\):\?\)\?') + if empty(matches) | return file_line_col | endif + + let fname = matches[1] + let line = !empty(matches[2]) ? matches[2] : '0' + let col = !empty(matches[3]) + \ ? matches[3] . '|' + \ : (g:file_line_fallback_column0 ? '|' : '^') + + if filereadable(fname) + let bufnr = bufnr('%') + execute 'keepalt edit' fnameescape(fname) + execute 'bdelete' bufnr + + execute line + execute 'normal!' col + normal! m" + normal! zv + normal! zz + filetype detect + if g:file_line_crosshairs + call s:crosshair_flash(g:file_line_crosshairs_number, g:file_line_crosshairs_duration) + endif + endif + + return fname +endfunction + + +" Flash crosshairs (reticle) on current cursor line/column to highlight it. +" Particularly useful when the cursor is at head/tail end of file, +" in which case it will not get centered. +" Ref1: https://vi.stackexchange.com/a/3481/29697 +" Ref2: https://stackoverflow.com/a/33775128/38281 +function! s:crosshair_flash(n, d) abort + let l:cul = &cursorline + let l:cuc = &cursorcolumn + + for i in range(1, a:n) + set cursorline cursorcolumn + redraw + execute 'sleep' a:d . 'm' + set nocursorline nocursorcolumn + redraw + execute 'sleep' a:d . 'm' + endfor + + let &cursorline = l:cul + let &cursorcolumn = l:cuc +endfunction