qwertyboy

- friends
10 link karma
1,398 comment karma
send messageredditor for
what's this?

TROPHY CASE


  • Six-Year Club

I made a CLI app to give you the power of Google Search in your command line. by KerrickLongin commandline

[–]qwertyboy 5 points6 points ago

I use something like:

g() { w3m -dump "http://google.com/search?q=$*" | more; }

You can replace w3m with elinks or whatever, and you can easily adjust it to whatever you like.

Actually, I use a slightly more complex function that lets me open a text browser and access several search engines, reclaiming them "from the false-prophet, pox-infested heathen lands of html forms, placing these wonders where they belong; deep in unix heartland, as god-loving extensions to the shell."

having some problems with vim/tmux by Watabou90in commandline

[–]qwertyboy 1 point2 points ago

Thanks for all the info. Long status lines sound like a likely suspect, especially for people who use zsh (oh my!), because zle (the zsh equivalent of readline) uses the terminal's ability to "rewind" the cursor - which is why zsh can do all that cool menu completion stuff.

You still don't "know" the problem lies with tmux. Problems live in the crossroads, where several factors meet, and you have so many... Long status lines and zle are likely, but you have your vimrc (which, judging by your tmux.conf, is long, complex and not entirely understood - which is a great way to start), you have your keyboard layout (who knows what evil lies in the way Apple handles arrow keys?!). In any event, you can't compare anything that happens in the terminal to running macvim, which is a dedicated GUI application. Especially when you are talking about graphic degradations.

BTW: moving about in insert mode, using the arrow keys... A Jedi craves not these things. It's a bad habit. A throwback. Mapping your arrow keys to nop for a few weeks is the recommended cure.

having some problems with vim/tmux by Watabou90in commandline

[–]qwertyboy 1 point2 points ago

Glad to be of assistance, and please, do update when you find the culprit. It might merit a bug report.

Our D&D group has 13 people playing 15 characters. Here's a drawing one of the players did of everyone wearing their Sunday Best. by destructormuffinin rpg

[–]qwertyboy 0 points1 point ago

Sound's like an awesome game, thanks for sharing. Just note that it's suspension of disbelief (or, if you really want to be precise: willing suspension of disbelief, to differentiate it from all the suspension we do without noticing).

having some problems with vim/tmux by Watabou90in commandline

[–]qwertyboy 1 point2 points ago

Your first step should be elimination.

Start vim with 'vim -u NONE' to ignore your vimrc and plugins. Did the problem go away? What if you disable tmux's configuration files ('mv {.,}tmux.conf')?

By selectively removing (temporarily, of course) sections from your configuration files you can zero in on the problem. And then, if the solution does not become obvious, you can come back here and post your findings.

Note that copying a bunch of configs from other people is a great start, but if you really want to learn - you should probably delete it all and add stuff only when you find yourself missing it. That way you really know what every line does.

Alternating row colors (banded rows) by nunzin vim

[–]qwertyboy 0 points1 point ago

Interesting idea. I toyed with it a bit and got something that sort of half works:

hi odd ctermbg=1
hi even ctermbg=2

syn match odd "^.*$" contains=ALL nextgroup=even skipnl
syn match even "^.*$" contains=ALL nextgroup=odd skipnl

Pretty self explanatory - I'm creating two alternating groups, each matching a single line. Note that the highlight is for a color terminal. You can substitute it with guibg or termbg or whatever

This needs some polish (I had to disable syntax highlighting to see the effect), but it's a direction.

Then I googled a bit and found the following thread with the following script (which I will copy below for posterity). The script isn't very elegant, but setting:

hi EvenLbg ctermbg=235

and then sourcing the script seems to just work. Using it right now, typing this comment.

Oh, and here is the script (don't forget to hilight EvenLbg):

" for loops and a few of the autocmd events don't exist in previous versions
if v:version < 700
finish
endif

sign define EvenL linehl=EvenLbg

func! s:ColorAltLines()
if exists('b:ALTLINES_disable') || exists('g:ALTLINES_disable')
    return
elseif &buftype=="" && (!exists('b:ALTLINES_changedtick') || b:ALTLINES_changedtick != b:changedtick) && line('$') > 1
    let l:range = (exists('b:ALTLINES_quick') ? max([line('.')-100+line('.')%2, 2]).','.min([line('.')+100,line('$')]) : '2,'.line('$'))
    let l:starttime = localtime()
    if exists('b:ALTLINES_changedtick') " don't unplace signs if they've never been placed
    for id in eval('range('.l:range.',2)')
        exec 'sign unplace '.id.' buffer='.bufnr('%')
        if localtime()-l:starttime >= 10
        " force quick update next time and quit, it's taking way to long
        let b:ALTLINES_quick = 1
        return
        endif
    endfor
    endif
    let l:pos_sav = getpos('.')
    keepjumps exec l:range.'g#^#if line(".")%2==0 && localtime() - l:starttime < 16 | exec "sign place ".line(".")." line=".line(".")." name=EvenL buffer=".bufnr("%") | endif'
    call setpos('.',l:pos_sav)
    nohls
    if localtime() - l:starttime > 4
    let b:ALTLINES_quick = 1
    endif
    let b:ALTLINES_changedtick = b:changedtick
endif
endfun

augroup ALT_LINES
au!
autocmd BufWinEnter,InsertLeave,CursorHold,CursorHoldI * call s:ColorAltLines()
augroup END

Pattern to match first occurrence in line? by whatbookbookin vim

[–]qwertyboy 22 points23 points ago

Just to clarify:

^    - start of line
.    - any character
\{-} - as few as possible (AKA non-greedy)
\zs  - match start (yes, there is also \ze)
\@<! - does not appear before (AKA negative look-behind)
\v   - assume everything other than digits, letters and underscore is
       control characters with special meanings (AKA very magic)

Regular expressions: if your eyes don't bleed, you're doing it wrong.

Anything better than Vundle? by cyberdouchein vim

[–]qwertyboy 1 point2 points ago

Just to be clear, vundle let's you do the same thing by calling "bundle" conditionally (in an autocommand, for example).

Linux distro under 1GB of storage by yerffejin linux

[–]qwertyboy 1 point2 points ago

Thank you for the clarification, I stand corrected.

I have never used the arch installer, using pacman directly to install a fresh environment. And it always comes out significantly bigger than, e.g., a minimal debian.

Linux distro under 1GB of storage by yerffejin linux

[–]qwertyboy 0 points1 point ago

That's not entirely true. Arch, by default, comes with dev packages, and is therefore significantly larger than most minimalistic installs.

It's been over 20 years and this is still the finest keyboard ever made. by FightingInternetin geek

[–]qwertyboy 2 points3 points ago

doubleplusungood

FTFY

When editing StackOverflow, I sometimes need to indent several hundred lines of text... by jjedin vim

[–]qwertyboy 0 points1 point ago

Using your mouse with vim? ಠ_ಠ

:)

Which version? by juicetygerin debian

[–]qwertyboy 0 points1 point ago

...why would a machine have 10gb of ram if it was 32bit? :p

Why not? 32 bits work great with up to 64 gigs of RAM.

All the good music players are GTK by sigtrapin fossworldproblems

[–]qwertyboy 0 points1 point ago

Oh no, MPD is much more than that. It's all about splitting the part that plays music from the UI that controls it.

The part that plays is always on. There is no reason for my music to stop just because I exited the interface, or even X. That's very nice, especially if you are not into running stuff you don't need (due to hardware limitations or just an obsessive nature).

And since the UI is separate, it becomes easier to find (or hack) an interface that's best suits you. GUI, Web interface, terminal applications (like ncmpc) or even CLI (mpc). And it can run from anywhere - your phone, your girlfriend's laptop or your web enabled washing machine. For me, controlling my music from the shell was the dealmaker. My player is a script that runs some MPC commands, optionally piping them through dmenu for selection, and it does exactly what I want. And that's the true magic of MPD. At least for me.

Strange bug with a mapped search. by pythorin vim

[–]qwertyboy 1 point2 points ago

Not sure what's going on (if you publish some problematic lines I'll test it), but I don't think that equality sign belongs there. Also, it is a good thing to get used to noremap, or even nnoremap if you only issue this command from normal mode (ordinary map does visual and op-pending modes as well).

I ported the Command-T matcher to CtrlP by burkein vim

[–]qwertyboy 2 points3 points ago

Take a look at fasd.

Why I Quit by fregoliin comics

[–]qwertyboy 1 point2 points ago

This guy has some amazing work in that blog. Well worth the browse.

Color partial tab completions in Zsh? by bear24rwin zsh

[–]qwertyboy 0 points1 point ago

I found a kludge to solve this, so I'm posting here, in case someone searches for it. Would love to see a better solution.

unambigandmenu() {
    zle expand-or-complete
    zle magic-space
    zle backward-delete-char
    zle expand-or-complete
}
zle -N unambigandmenu
bindkey "^i" unambigandmenu

So now, whenever I start completion (which, for me, means inserting the longest unambiguous string AND displaying the menu), my widget adds a space, deletes it, and starts completion again - so the PREFIX variable used in list-color will have the correct value.

It still boggles my mind a bit that bash has this feature out of the box while zsh requires such an ugly hack. Has to be a better way.

Tell me. Tell me everything. by fckjoshin linux

[–]qwertyboy 1 point2 points ago

Limited drivers used to be a problem a few years ago, but I have not run into driver problem for years. In fact, in the past couple of years it seems hardware support on linux (with a vanilla kernel) is superior to that on windows. Almost anything I plug into linux just works out of the box, while in windows I still have to install drivers and pray.

And the best thing linux can give you, which windows takes away, is freedom. Freedom to chose. To change. To make sure your computer - which is an important part of your life - does exactly what you want it to.

How to delete lines into a named buffer? by SibLiantin vim

[–]qwertyboy 10 points11 points ago

Oh, and don't forget that when you delete into a named register (note, OP, "buffer" means something entirely different in vim), you can append to it (instead of clobbering whatever is already there) by using a capital letter. You can go over your code, deleting all sorts of stuff with "Ad, and then dump everything you deleted in one place with "ap.

Color partial tab completions in Zsh? by bear24rwin zsh

[–]qwertyboy 0 points1 point ago

Thanks for replying - I'll try to explain more clearly. With your setup (BTW, sweeeet!) in the above situation, when I hit tab for the first time I see no menu at all, only the insertion of the longest nonambiguous match.

Try to setopt nolistambiguous and you will see what I mean. I got it to work in bash, so I am pretty sure zsh can pull it. Only question is how.

Vim - I'm confused exact cursor postion when it stand at '()' or '{}' by mattengiin vim

[–]qwertyboy 1 point2 points ago

Changing the shape and color of your cursor depends on your terminal emulation, and can be a bitch, but you can easily control the highlight color of the matching parens with the highlight command ("hi" for short). To turn it green on a color terminal you would issue:

highlight MatchParen ctermbg=2

Read more about highlight to figure out (":h hi").

You could also use cursorline and cursorcolumn, which constantly remind you where the cursor is. I find this very useful:

set cursorline
set cursorcolumn

Another nice trick is making sure they appear only in the active window:

au WinEnter * setlocal cursorline | setlocal cursorcolumn
au WinLeave * setlocal nocursorline | setlocal nocursorcolumn

And, of course, you can color them any way you like with the highlight command.

Have fun.

Color partial tab completions in Zsh? by bear24rwin zsh

[–]qwertyboy 0 points1 point ago

That's very nice, but does not seem to work properly after insertion of longest unambiguous completion. With my current settings, if I have file1 and file2 and I type "ls fi" and try to complete, zsh will complete to "ls file" and show me the two options in the menu - but PREFIX is still set to "ls fi", so the coloring is all wrong.

Maybe there is a way to use compstate to get what I want?

I'm bored of ncmpc++. What's your favorite MPD client, and why? by f0nd004uin linux

[–]qwertyboy 3 points4 points ago

I use mpc, because I like CLI (and there is a big difference between terminal applications, like ncmpc, and actual CLI), and I write my own scripts to do whatever I want.

My default script accepts strings as arguments and searches for them. So running it with "winter" will get me all the songs, artists, albums and whatnots that contain the word winter; but running it with "winter funk" will get both versions of A Hazy Shade of Winter by Simon and GarFUNKel.

If mpd is not playing, it will make a new playlist of the results and play it. If mpd is already playing it will just add the results to the end of the playlist.

And best of all, if called with no argument is pipes a list of all tracks into dmenu and uses the result as arguments, so I can press a button, get a list of tracks that shrinks to match as I type. I can navigate it and hit enter to play a specific track or hit shift-enter to play all the matches. Pretty sweet.

#!/bin/dash
if [ "$*" ]; then
    list='mpc search'
    for arg in "$@"; do
        list="$list any $arg"
    done
    list=$($list)
else
    list=$(mpc listall | dmenu)
fi

[ "$list" ] || exit 0

[ "$(mpc status | grep "\[playing\]")" ] || mpc clear
echo "$list" | mpc add
[ 0 = "$?" ] && mpc play && mpc playlist || $0 $list

exit 0

Ninja edit: I should note that I use dmenu in vertical mode, with the number of matches displayed, which makes it all very usable.

view more: next