The words Under construction in black text on a yellow background with diagonal black stipes surrounding it
I'm in the process of moving my site. It's still a work in progress. Please excuse the mess and broken links.

Today I Learned Mapping te to tabedit in Vim

TODO: Pull subtitle into page object

Vim's `:tabedit` command seems long considering how often it's used. Applying logic from this StackOverflow answer produces this customization:

code_start_default_section code_end_default_section

It defines a `:te` shortcut which expands to `:tabedit`. Throw it in `~/.vimrc` and save five characters for every tab open.

_It's worth pointing out that this accepted StackOverflow answer. For example, `ca te tabedit`. The gotcha hidden in this approach is that it expands across the command. Trying to run `:!ls /tmp/te/` will be altered to `:!ls /tmp/tabedit/`. Not so good._

_And, yes, I added an answer to help out there too._

Debugging Stuff

I'm moving stuff around right now. All this below is helping me figure out where to put stuff

        -- title

Today I Learned Mapping te to tabedit in Vim

-- p

Vim's `:tabedit` command seems long considering how often it's used. Applying logic from <<link|this StackOverflow answer|http://stackoverflow.com/a/7515418/102401>> produces this customization:

-- code/
-- bash{numberLines: true}

cnoreabbrev <expr> te getcmdtype() == ":" && getcmdline() == 'te' ? 'tabedit' : 'te'

-- /code

-- p

It defines a `:te` shortcut which expands to `:tabedit`. Throw it in `~/.vimrc` and save five characters for every tab open.

-- p

_It's worth pointing out that <<link|this accepted StackOverflow answer|http://stackoverflow.com/a/6638381/102401) provides a dangerous alternative. It recommends `ca` (aka `cabbrev`>>. For example, `ca te tabedit`. The gotcha hidden in this approach is that it expands across the command. Trying to run `:!ls /tmp/te/` will be altered to `:!ls /tmp/tabedit/`. Not so good._

-- p

_And, yes, I <<link|added an answer|http://stackoverflow.com/a/30599815/102401>> to help out there too._


-- categories
-- Vim
-- TIL

-- metadata
-- date: 2015-06-02 00:00:00
-- id: 20en3wsi
-- status: published
-- type: post
-- SCRUBBED_NEO: false
-- site: aws