command-t icon indicating copy to clipboard operation
command-t copied to clipboard

Add filetype finder, allowing the user to use 'setfiletype' easily.

Open endel opened this issue 13 years ago • 4 comments

I found it very handy. Mainly to swap filetype from html / css / javascript / eruby.

Use the following code on your .vimrc to map filetype finder to <Leader> + f:

if !hasmapto(':CommandTFiletype<CR>')
  silent! nnoremap <unique> <silent> <Leader>f :CommandTFiletype<CR>
endif

endel avatar Feb 26 '12 00:02 endel

Any thoughts about this? The code is pretty simple and clear. Thanks

endel avatar Mar 10 '12 14:03 endel

Sorry for ignoring this for nearly 4 years. I see no reason why something like this shouldn't be included, although it will need a rebase before it can merge cleanly (which I'll take care of). Thanks for the PR.

wincent avatar Nov 15 '15 01:11 wincent

I implemented a CommandTEx command in this branch that uses Command-T to find and autocomplete ex commands - inspired by SkyBison. It can be used as a setfiletype-finder like this:

nnoremap <Leader>f :<C-u>CommandTEx setfiletype<Space><CR>

It started as a proof of concept hack but, after using it for a few months without running into any issues, I would now consider it stable - although, it could use some cleanup. Here are the CommandTEx mappings I regularly use:

nnoremap g:         :<C-u>CommandTEx<CR>
nnoremap <Leader>c  :<C-u>CommandTEx cd<Space><CR>
nnoremap <Leader>e  :<C-u>CommandTEx edit<Space><CR>
nnoremap <Leader>se :<C-u>CommandTEx split<Space><CR>
nnoremap <Leader>ve :<C-u>CommandTEx vsplit<Space><CR>
nnoremap <Leader>te :<C-u>CommandTEx tabedit<Space><CR>
nnoremap <Leader>d  :<C-u>CommandTEx bdelete<Space><CR>
nnoremap <Leader>h  :<C-u>CommandTEx help<Space><CR>

If you think CommandTEx is useful, feel free to modify the code and merge it into your next branch.

Also, here's a GIF showing CommandTEx in action:

CommandTEx

The keystrokes used in the GIF were :CommandTEx<Space>bdelete<Space><CR><C-l><CR>.

djjcast avatar Nov 15 '15 23:11 djjcast

@djjcast: That looks pretty cool. I can see something like this being generally useful. Thanks for sharing.

wincent avatar Nov 26 '15 15:11 wincent

Given the big rewrite for v6.0.x, older PRs will need to be re-rolled against main and target the new version, so I'm closing this one out. Feedback issue for 6.0.x is here:

  • https://github.com/wincent/command-t/issues/393

wincent avatar Aug 26 '22 21:08 wincent