Joined May 2011
·

Dmitry Medvinsky

Russia
·
·

Posted to vim -x as a password manager over 1 year ago

By default Vim uses cryptmethod=zip which is not really secure. If you actually want to use Vim as your password manager, this is an essential setting in your .vimrc:

set cryptmethod=blowfish

There is also atool with aunpack command. Not only it handles different types, it also creates a directory for extracted files if there are more than one in the archive root.

Posted to Removing a remote branch in git over 1 year ago

What about git push --delete remote-name branch-name? Not that obscure even if you don't know the internals.

If that's only about difference in x flag, that's easier to use

chmod -R u=rwX,go=rX .

That is, using capitalized X. It means setting executable flag for directories only or if x is already set.

man chmod

When I use something different from JS and CSS and compile them into JS and CSS, I stick to something like this (but then again, it depends on the project):

root/
    src/
        coffee/
            index.coffee
        stylus/
            index.stylus
    public/
        js/
        css/
        img/
        index.html

By the way, here's the generic version of config (doesn't not error if option is not present):

if exists('&colorcolumn')
    set colorcolumn=80
endif
Posted to Deleting remote branches over 1 year ago

There is more intuitive

git push --delete origin branch_name

in git for several versions already.

I'm pretty sure this doesn't work in vi. Vim >= 7.3 only.

Posted to Less command: edit file shortcut over 1 year ago

@sheerun True, but %f isn't interesting, it is passed anyway so that file is opened. What might be interesting is %lm or %lt. In case you want to use them, then yes, LESSEDIT it is.

Posted to Reload bash configuration over 1 year ago

Sometimes it is better to

exec $SHELL

For example if you deleted some wrong aliases, they won't be unset by sourcing a new rc file. But a fresh shell won't have them.

Posted to Less command: edit file shortcut over 1 year ago

Standard VISUAL and EDITOR variables usually have this covered.

If you don't need whatever you did in your local master branch, I think this is simper (you don't need to delete your temporary branch afterwards):

git fetch remoteSource
git reset --hard remoteSource/master

The third way

:26s/modesl/models/

On line 26 substitute modesl for models.

If you're running Vim 7.3 (or better) you can use set colorcolumn=80 which draws the vertical bar at this column. It lets you easily see the desired text width.

To gracefully support older Vims, use:

if exists('&colorcolumn')
    set colorcolumn=80
endif

To change the color, use ColorColumn highlight group.

On Linux you're better of with pgrep which is less error prone and has many nifty options (like searching by user, too).

It is installed on all Linux distros I've seen so far, maybe even BSDs, but not on OS X.

Achievements
604 Karma
45,670 Total ProTip Views
Interests & Skills