command-t.txt 49 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183
  1. *command-t.txt* Command-T plug-in for Vim *command-t*
  2. CONTENTS *command-t-contents*
  3. 1. Introduction |command-t-intro|
  4. 2. Requirements |command-t-requirements|
  5. 3. Installation |command-t-installation|
  6. 3. Managing using Pathogen |command-t-pathogen|
  7. 4. Trouble-shooting |command-t-trouble-shooting|
  8. 5. Usage |command-t-usage|
  9. 6. Commands |command-t-commands|
  10. 7. Mappings |command-t-mappings|
  11. 8. Options |command-t-options|
  12. 9. FAQ |command-t-faq|
  13. 10. Tips |command-t-tips|
  14. 11. Authors |command-t-authors|
  15. 12. Development |command-t-development|
  16. 13. Website |command-t-website|
  17. 14. Donations |command-t-donations|
  18. 15. License |command-t-license|
  19. 16. History |command-t-history|
  20. INTRODUCTION *command-t-intro*
  21. The Command-T plug-in provides an extremely fast, intuitive mechanism for
  22. opening files and buffers with a minimal number of keystrokes. It's named
  23. "Command-T" because it is inspired by the "Go to File" window bound to
  24. Command-T in TextMate.
  25. Files are selected by typing characters that appear in their paths, and are
  26. ordered by an algorithm which knows that characters that appear in certain
  27. locations (for example, immediately after a path separator) should be given
  28. more weight.
  29. To search efficiently, especially in large projects, you should adopt a
  30. "path-centric" rather than a "filename-centric" mentality. That is you should
  31. think more about where the desired file is found rather than what it is
  32. called. This means narrowing your search down by including some characters
  33. from the upper path components rather than just entering characters from the
  34. filename itself.
  35. Screencasts demonstrating the plug-in can be viewed at:
  36. https://wincent.com/products/command-t
  37. REQUIREMENTS *command-t-requirements*
  38. The plug-in requires Vim compiled with Ruby support, a compatible Ruby
  39. installation at the operating system level, and a C compiler to build
  40. the Ruby extension.
  41. 1. Vim compiled with Ruby support ~
  42. You can check for Ruby support by launching Vim with the --version switch:
  43. vim --version
  44. If "+ruby" appears in the version information then your version of Vim has
  45. Ruby support.
  46. Another way to check is to simply try using the :ruby command from within Vim
  47. itself:
  48. :ruby 1
  49. If your Vim lacks support you'll see an error message like this:
  50. E319: Sorry, the command is not available in this version
  51. The version of Vim distributed with OS X may not include Ruby support (for
  52. example, Snow Leopard, which was the current version of OS X when Command-T
  53. was first released, did not support Ruby in the system Vim, but the current
  54. version of OS X at the time of writing, Mavericks, does). All recent versions
  55. of MacVim come with Ruby support; it is available from:
  56. http://github.com/b4winckler/macvim/downloads
  57. For Windows users, the Vim 7.2 executable available from www.vim.org does
  58. include Ruby support, and is recommended over version 7.3 (which links against
  59. Ruby 1.9, but apparently has some bugs that need to be resolved).
  60. 2. Ruby ~
  61. In addition to having Ruby support in Vim, your system itself must have a
  62. compatible Ruby install. "Compatible" means the same version as Vim itself
  63. links against. If you use a different version then Command-T is unlikely
  64. to work (see |command-t-trouble-shooting| below).
  65. On OS X Snow Leopard, Lion and Mountain Lion, the system comes with Ruby 1.8.7
  66. and all recent versions of MacVim (the 7.2 snapshots and 7.3) are linked
  67. against it.
  68. On OS X Mavericks, the default system ruby is 2.0, but MacVim continues to
  69. link against 1.8.7, which is also present on the system at:
  70. /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
  71. On Linux and similar platforms, the linked version of Ruby will depend on
  72. your distribution. You can usually find this out by examining the
  73. compilation and linking flags displayed by the |:version| command in Vim, and
  74. by looking at the output of:
  75. :ruby puts "#{RUBY_VERSION}-p#{RUBY_PATCHLEVEL}"
  76. A suitable Ruby environment for Windows can be installed using the Ruby
  77. 1.8.7-p299 RubyInstaller available at:
  78. http://rubyinstaller.org/downloads/archives
  79. If using RubyInstaller be sure to download the installer executable, not the
  80. 7-zip archive. When installing mark the checkbox "Add Ruby executables to your
  81. PATH" so that Vim can find them.
  82. 3. C compiler ~
  83. Part of Command-T is implemented in C as a Ruby extension for speed, allowing
  84. it to work responsively even on directory hierarchies containing enormous
  85. numbers of files. As such, a C compiler is required in order to build the
  86. extension and complete the installation.
  87. On OS X, this can be obtained by installing the Xcode Tools from the App
  88. Store.
  89. On Windows, the RubyInstaller Development Kit can be used to conveniently
  90. install the necessary tool chain:
  91. http://rubyinstaller.org/downloads/archives
  92. At the time of writing, the appropriate development kit for use with Ruby
  93. 1.8.7 is DevKit-3.4.5r3-20091110.
  94. To use the Development Kit extract the archive contents to your C:\Ruby
  95. folder.
  96. INSTALLATION *command-t-installation*
  97. You can install Command-T by obtaining the source files and building the C
  98. extension. The recommended way to get the source is by using a plug-in
  99. management system such as Pathogen (see |command-t-pathogen|).
  100. Command-T is also distributed as a "vimball" which means that it can be
  101. installed by opening it in Vim and then sourcing it:
  102. :e command-t.vba
  103. :so %
  104. The files will be installed in your |'runtimepath'|. To check where this is
  105. you can issue:
  106. :echo &rtp
  107. The C extension must then be built, which can be done from the shell. If you
  108. use a typical |'runtimepath'| then the files were installed inside ~/.vim and
  109. you can build the extension with:
  110. cd ~/.vim/ruby/command-t
  111. ruby extconf.rb
  112. make
  113. Note: If you are an RVM or rbenv user, you must perform the build using the
  114. same version of Ruby that Vim itself is linked against. This will often be the
  115. system Ruby, which can be selected before issuing the "make" command with one
  116. of the following commands:
  117. rvm use system
  118. rbenv local system
  119. Note: If you are on OS X Mavericks and compiling against MacVim, the default
  120. system Ruby is 2.0 but MacVim still links against the older 1.8.7 Ruby that is
  121. also bundled with the system; in this case the build command becomes:
  122. cd ~/.vim/ruby/command-t
  123. /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb
  124. make
  125. Note: Make sure you compile targeting the same architecture Vim was built for.
  126. For instance, MacVim binaries are built for i386, but sometimes GCC compiles
  127. for x86_64. First you have to check the platform Vim was built for:
  128. vim --version
  129. ...
  130. Compilation: gcc ... -arch i386 ...
  131. ...
  132. and make sure you use the correct ARCHFLAGS during compilation:
  133. export ARCHFLAGS="-arch i386"
  134. make
  135. Note: If you are on Fedora 17+, you can install Command-T from the system
  136. repository with:
  137. su -c 'yum install vim-command-t'
  138. MANAGING USING PATHOGEN *command-t-pathogen*
  139. Pathogen is a plugin that allows you to maintain plugin installations in
  140. separate, isolated subdirectories under the "bundle" directory in your
  141. |'runtimepath'|. The following examples assume that you already have
  142. Pathogen installed and configured, and that you are installing into
  143. ~/.vim/bundle. For more information about Pathogen, see:
  144. http://www.vim.org/scripts/script.php?script_id=2332
  145. If you manage your entire ~/.vim folder using Git then you can add the
  146. Command-T repository as a submodule:
  147. cd ~/.vim
  148. git submodule add git://git.wincent.com/command-t.git bundle/command-t
  149. git submodule init
  150. Or if you just wish to do a simple clone instead of using submodules:
  151. cd ~/.vim
  152. git clone git://git.wincent.com/command-t.git bundle/command-t
  153. Once you have a local copy of the repository you can update it at any time
  154. with:
  155. cd ~/.vim/bundle/command-t
  156. git pull
  157. Or you can switch to a specific release with:
  158. cd ~/.vim/bundle/command-t
  159. git checkout 0.8b
  160. After installing or updating you must build the extension:
  161. cd ~/.vim/bundle/command-t/ruby/command-t
  162. ruby extconf.rb
  163. make
  164. While the Vimball installation automatically generates the help tags, under
  165. Pathogen it is necessary to do so explicitly from inside Vim:
  166. :call pathogen#helptags()
  167. TROUBLE-SHOOTING *command-t-trouble-shooting*
  168. Most installation problems are caused by a mismatch between the version of
  169. Ruby on the host operating system, and the version of Ruby that Vim itself
  170. linked against at compile time. For example, if one is 32-bit and the other is
  171. 64-bit, or one is from the Ruby 1.9 series and the other is from the 1.8
  172. series, then the plug-in is not likely to work.
  173. As such, on OS X, I recommend using the standard Ruby that comes with the
  174. system (currently 1.8.7) along with the latest version of MacVim (currently
  175. version 7.3). If you wish to use custom builds of Ruby or of MacVim (not
  176. recommmended) then you will have to take extra care to ensure that the exact
  177. same Ruby environment is in effect when building Ruby, Vim and the Command-T
  178. extension.
  179. For Windows, the following combination is known to work:
  180. - Vim 7.2 from http://www.vim.org/download.php:
  181. ftp://ftp.vim.org/pub/vim/pc/gvim72.exe
  182. - Ruby 1.8.7-p299 from http://rubyinstaller.org/downloads/archives:
  183. http://rubyforge.org/frs/download.php/71492/rubyinstaller-1.8.7-p299.exe
  184. - DevKit 3.4.5r3-20091110 from http://rubyinstaller.org/downloads/archives:
  185. http://rubyforge.org/frs/download.php/66888/devkit-3.4.5r3-20091110.7z
  186. If a problem occurs the first thing you should do is inspect the output of:
  187. ruby extconf.rb
  188. make
  189. During the installation, and:
  190. vim --version
  191. And compare the compilation and linker flags that were passed to the
  192. extension and to Vim itself when they were built. If the Ruby-related
  193. flags or architecture flags are different then it is likely that something
  194. has changed in your Ruby environment and the extension may not work until
  195. you eliminate the discrepancy.
  196. USAGE *command-t-usage*
  197. Bring up the Command-T file window by typing:
  198. <Leader>t
  199. This mapping is set up automatically for you, provided you do not already have
  200. a mapping for <Leader>t or |:CommandT|. You can also bring up the file window
  201. by issuing the command:
  202. :CommandT
  203. A prompt will appear at the bottom of the screen along with a file window
  204. showing all of the files in the current directory (as returned by the
  205. |:pwd| command).
  206. For the most efficient file navigation within a project it's recommended that
  207. you |:cd| into the root directory of your project when starting to work on it.
  208. If you wish to open a file from outside of the project folder you can pass in
  209. an optional path argument (relative or absolute) to |:CommandT|:
  210. :CommandT ../path/to/other/files
  211. Type letters in the prompt to narrow down the selection, showing only the
  212. files whose paths contain those letters in the specified order. Letters do not
  213. need to appear consecutively in a path in order for it to be classified as a
  214. match.
  215. Once the desired file has been selected it can be opened by pressing <CR>.
  216. (By default files are opened in the current window, but there are other
  217. mappings that you can use to open in a vertical or horizontal split, or in
  218. a new tab.) Note that if you have |'nohidden'| set and there are unsaved
  219. changes in the current window when you press <CR> then opening in the current
  220. window would fail; in this case Command-T will open the file in a new split.
  221. The following mappings are active when the prompt has focus:
  222. <BS> delete the character to the left of the cursor
  223. <Del> delete the character at the cursor
  224. <Left> move the cursor one character to the left
  225. <C-h> move the cursor one character to the left
  226. <Right> move the cursor one character to the right
  227. <C-l> move the cursor one character to the right
  228. <C-a> move the cursor to the start (left)
  229. <C-e> move the cursor to the end (right)
  230. <C-u> clear the contents of the prompt
  231. <Tab> change focus to the file listing
  232. The following mappings are active when the file listing has focus:
  233. <Tab> change focus to the prompt
  234. The following mappings are active when either the prompt or the file listing
  235. has focus:
  236. <CR> open the selected file
  237. <C-CR> open the selected file in a new split window
  238. <C-s> open the selected file in a new split window
  239. <C-v> open the selected file in a new vertical split window
  240. <C-t> open the selected file in a new tab
  241. <C-j> select next file in the file listing
  242. <C-n> select next file in the file listing
  243. <Down> select next file in the file listing
  244. <C-k> select previous file in the file listing
  245. <C-p> select previous file in the file listing
  246. <Up> select previous file in the file listing
  247. <C-f> flush the cache (see |:CommandTFlush| for details)
  248. <C-q> place the current matches in the quickfix window
  249. <C-c> cancel (dismisses file listing)
  250. The following is also available on terminals which support it:
  251. <Esc> cancel (dismisses file listing)
  252. Note that the default mappings can be overriden by setting options in your
  253. ~/.vimrc file (see the OPTIONS section for a full list of available options).
  254. In addition, when the file listing has focus, typing a character will cause
  255. the selection to jump to the first path which begins with that character.
  256. Typing multiple characters consecutively can be used to distinguish between
  257. paths which begin with the same prefix.
  258. COMMANDS *command-t-commands*
  259. *:CommandT*
  260. |:CommandT| Brings up the Command-T file window, starting in the
  261. current working directory as returned by the|:pwd|
  262. command.
  263. *:CommandTBuffer*
  264. |:CommandTBuffer|Brings up the Command-T buffer window.
  265. This works exactly like the standard file window,
  266. except that the selection is limited to files that
  267. you already have open in buffers.
  268. *:CommandTJumps*
  269. |:CommandTJump| Brings up the Command-T jumplist window.
  270. This works exactly like the standard file window,
  271. except that the selection is limited to files that
  272. you already have in the jumplist. Note that jumps
  273. can persist across Vim sessions (see Vim's |jumplist|
  274. documentation for more info).
  275. *:CommandTTag*
  276. |:CommandTTag| Brings up the Command-T window tags window, which can
  277. be used to select from the tags, if any, returned by
  278. Vim's |taglist()| function. See Vim's |tag| documentation
  279. for general info on tags.
  280. *:CommandTFlush*
  281. |:CommandTFlush|Instructs the plug-in to flush its path cache, causing
  282. the directory to be rescanned for new or deleted paths
  283. the next time the file window is shown (pressing <C-f> when
  284. a match listing is visible flushes the cache immediately; this
  285. mapping is configurable via the |g:CommandTRefreshMap|
  286. setting). In addition, all configuration settings are
  287. re-evaluated, causing any changes made to settings via the
  288. |:let| command to be picked up.
  289. MAPPINGS *command-t-mappings*
  290. By default Command-T comes with only two mappings:
  291. <Leader>t bring up the Command-T file window
  292. <Leader>b bring up the Command-T buffer window
  293. However, Command-T won't overwrite a pre-existing mapping so if you prefer
  294. to define different mappings use lines like these in your ~/.vimrc:
  295. nnoremap <silent> <Leader>t :CommandT<CR>
  296. nnoremap <silent> <Leader>b :CommandTBuffer<CR>
  297. Replacing "<Leader>t" or "<Leader>b" with your mapping of choice.
  298. Note that in the case of MacVim you actually can map to Command-T (written
  299. as <D-t> in Vim) in your ~/.gvimrc file if you first unmap the existing menu
  300. binding of Command-T to "New Tab":
  301. if has("gui_macvim")
  302. macmenu &File.New\ Tab key=<nop>
  303. map <D-t> :CommandT<CR>
  304. endif
  305. When the Command-T window is active a number of other additional mappings
  306. become available for doing things like moving between and selecting matches.
  307. These are fully described above in the USAGE section, and settings for
  308. overriding the mappings are listed below under OPTIONS.
  309. OPTIONS *command-t-options*
  310. A number of options may be set in your ~/.vimrc to influence the behaviour of
  311. the plug-in. To set an option, you include a line like this in your ~/.vimrc:
  312. let g:CommandTMaxFiles=20000
  313. To have Command-T pick up new settings immediately (that is, without having
  314. to restart Vim) you can issue the |:CommandTFlush| command after making
  315. changes via |:let|.
  316. Following is a list of all available options:
  317. *g:CommandTMaxFiles*
  318. |g:CommandTMaxFiles| number (default 30000)
  319. The maximum number of files that will be considered when scanning the
  320. current directory. Upon reaching this number scanning stops. This
  321. limit applies only to file listings and is ignored for buffer
  322. listings.
  323. *g:CommandTMaxDepth*
  324. |g:CommandTMaxDepth| number (default 15)
  325. The maximum depth (levels of recursion) to be explored when scanning the
  326. current directory. Any directories at levels beyond this depth will be
  327. skipped.
  328. *g:CommandTMaxCachedDirectories*
  329. |g:CommandTMaxCachedDirectories| number (default 1)
  330. The maximum number of directories whose contents should be cached when
  331. recursively scanning. With the default value of 1, each time you change
  332. directories the cache will be emptied and Command-T will have to
  333. rescan. Higher values will make Command-T hold more directories in the
  334. cache, bringing performance at the cost of memory usage. If set to 0,
  335. there is no limit on the number of cached directories.
  336. *g:CommandTMaxHeight*
  337. |g:CommandTMaxHeight| number (default: 0)
  338. The maximum height in lines the match window is allowed to expand to.
  339. If set to 0, the window will occupy as much of the available space as
  340. needed to show matching entries.
  341. *g:CommandTInputDebounce*
  342. |g:CommandTInputDebounce| number (default: 50)
  343. The number of milliseconds to wait before updating the match listing
  344. following a key-press. This can be used to avoid wasteful recomputation
  345. when making a rapid series of key-presses in a directory with many tens
  346. (or hundreds) of thousands of files.
  347. *g:CommandTFileScanner*
  348. |g:CommandTFileScanner| string (default: 'ruby')
  349. The underlying scanner implementation that should be used to explore the
  350. filesystem. Possible values are:
  351. - "ruby": uses built-in Ruby and should work everywhere, albeit slowly
  352. on large (many tens of thousands of files) hierarchies.
  353. - "find": uses the command-line tool of the same name, which can be much
  354. faster on large projects because it is written in pure C, but may not
  355. work on systems without the tool or with an incompatible version of
  356. the tool.
  357. - "watchman": uses Watchman (https://github.com/facebook/watchman) if
  358. available; otherwise falls back to "find". Note that this scanner is
  359. intended for use with very large hierarchies (hundreds of thousands of
  360. files) and so the task of deciding which files should be included is
  361. entirely delegated to Watchman; this means that settings which
  362. Command-T would usually consult, such as 'wildignore' and
  363. |g:CommandTScanDotDirectories| are ignored.
  364. *g:CommandTMinHeight*
  365. |g:CommandTMinHeight| number (default: 0)
  366. The minimum height in lines the match window is allowed to shrink to.
  367. If set to 0, will default to a single line. If set above the max height,
  368. will default to |g:CommandTMaxHeight|.
  369. *g:CommandTAlwaysShowDotFiles*
  370. |g:CommandTAlwaysShowDotFiles| boolean (default: 0)
  371. When showing the file listing Command-T will by default show dot-files
  372. only if the entered search string contains a dot that could cause a
  373. dot-file to match. When set to a non-zero value, this setting instructs
  374. Command-T to always include matching dot-files in the match list
  375. regardless of whether the search string contains a dot. See also
  376. |g:CommandTNeverShowDotFiles|. Note that this setting only influences
  377. the file listing; the buffer listing treats dot-files like any other
  378. file.
  379. *g:CommandTNeverShowDotFiles*
  380. |g:CommandTNeverShowDotFiles| boolean (default: 0)
  381. In the file listing, Command-T will by default show dot-files if the
  382. entered search string contains a dot that could cause a dot-file to
  383. match. When set to a non-zero value, this setting instructs Command-T to
  384. never show dot-files under any circumstances. Note that it is
  385. contradictory to set both this setting and
  386. |g:CommandTAlwaysShowDotFiles| to true, and if you do so Vim will suffer
  387. from headaches, nervous twitches, and sudden mood swings. This setting
  388. has no effect in buffer listings, where dot files are treated like any
  389. other file.
  390. *g:CommandTScanDotDirectories*
  391. |g:CommandTScanDotDirectories| boolean (default: 0)
  392. Normally Command-T will not recurse into "dot-directories" (directories
  393. whose names begin with a dot) while performing its initial scan. Set
  394. this setting to a non-zero value to override this behavior and recurse.
  395. Note that this setting is completely independent of the
  396. |g:CommandTAlwaysShowDotFiles| and |g:CommandTNeverShowDotFiles|
  397. settings; those apply only to the selection and display of matches
  398. (after scanning has been performed), whereas
  399. |g:CommandTScanDotDirectories| affects the behaviour at scan-time.
  400. Note also that even with this setting off you can still use Command-T to
  401. open files inside a "dot-directory" such as ~/.vim, but you have to use
  402. the |:cd| command to change into that directory first. For example:
  403. :cd ~/.vim
  404. :CommandT
  405. *g:CommandTMatchWindowAtTop*
  406. |g:CommandTMatchWindowAtTop| boolean (default: 0)
  407. When this setting is off (the default) the match window will appear at
  408. the bottom so as to keep it near to the prompt. Turning it on causes the
  409. match window to appear at the top instead. This may be preferable if you
  410. want the best match (usually the first one) to appear in a fixed location
  411. on the screen rather than moving as the number of matches changes during
  412. typing.
  413. *g:CommandTMatchWindowReverse*
  414. |g:CommandTMatchWindowReverse| boolean (default: 0)
  415. When this setting is off (the default) the matches will appear from
  416. top to bottom with the topmost being selected. Turning it on causes the
  417. matches to be reversed so the best match is at the bottom and the
  418. initially selected match is the bottom most. This may be preferable if
  419. you want the best match to appear in a fixed location on the screen
  420. but still be near the prompt at the bottom.
  421. *g:CommandTTagIncludeFilenames*
  422. |g:CommandTTagIncludeFilenames| boolean (default: 0)
  423. When this setting is off (the default) the matches in the |:CommandTTag|
  424. listing do not include filenames.
  425. *g:CommandTHighlightColor*
  426. |g:CommandTHighlightColor| string (default: 'PmenuSel')
  427. Specifies the highlight color that will be used to show the currently
  428. selected item in the match listing window.
  429. *g:CommandTWildIgnore*
  430. |g:CommandTWildIgnore| string (default: none)
  431. Optionally override Vim's global |'wildignore'| setting during Command-T
  432. searches. If you wish to supplement rather than replace the global
  433. setting, you can use a syntax like:
  434. let g:CommandTWildIgnore=&wildignore . ",**/bower_components/*"
  435. See also |command-t-wildignore|.
  436. As well as the basic options listed above, there are a number of settings that
  437. can be used to override the default key mappings used by Command-T. For
  438. example, to set <C-x> as the mapping for cancelling (dismissing) the Command-T
  439. window, you would add the following to your ~/.vimrc:
  440. let g:CommandTCancelMap='<C-x>'
  441. Multiple, alternative mappings may be specified using list syntax:
  442. let g:CommandTCancelMap=['<C-x>', '<C-c>']
  443. Following is a list of all map settings and their defaults:
  444. Setting Default mapping(s)
  445. *g:CommandTBackspaceMap*
  446. |g:CommandTBackspaceMap| <BS>
  447. *g:CommandTDeleteMap*
  448. |g:CommandTDeleteMap| <Del>
  449. *g:CommandTAcceptSelectionMap*
  450. |g:CommandTAcceptSelectionMap| <CR>
  451. *g:CommandTAcceptSelectionSplitMap*
  452. |g:CommandTAcceptSelectionSplitMap| <C-CR>
  453. <C-s>
  454. *g:CommandTAcceptSelectionTabMap*
  455. |g:CommandTAcceptSelectionTabMap| <C-t>
  456. *g:CommandTAcceptSelectionVSplitMap*
  457. |g:CommandTAcceptSelectionVSplitMap| <C-v>
  458. *g:CommandTToggleFocusMap*
  459. |g:CommandTToggleFocusMap| <Tab>
  460. *g:CommandTCancelMap*
  461. |g:CommandTCancelMap| <C-c>
  462. <Esc> (not on all terminals)
  463. *g:CommandTSelectNextMap*
  464. |g:CommandTSelectNextMap| <C-n>
  465. <C-j>
  466. <Down>
  467. *g:CommandTSelectPrevMap*
  468. |g:CommandTSelectPrevMap| <C-p>
  469. <C-k>
  470. <Up>
  471. *g:CommandTClearMap*
  472. |g:CommandTClearMap| <C-u>
  473. *g:CommandTRefreshMap*
  474. |g:CommandTRefreshMap| <C-f>
  475. *g:CommandTQuickfixMap*
  476. |g:CommandTQuickfixMap| <C-q>
  477. *g:CommandTCursorLeftMap*
  478. |g:CommandTCursorLeftMap| <Left>
  479. <C-h>
  480. *g:CommandTCursorRightMap*
  481. |g:CommandTCursorRightMap| <Right>
  482. <C-l>
  483. *g:CommandTCursorEndMap*
  484. |g:CommandTCursorEndMap| <C-e>
  485. *g:CommandTCursorStartMap*
  486. |g:CommandTCursorStartMap| <C-a>
  487. In addition to the options provided by Command-T itself, some of Vim's own
  488. settings can be used to control behavior:
  489. *command-t-wildignore*
  490. |'wildignore'| string (default: '')
  491. Vim's |'wildignore'| setting is used to determine which files should be
  492. excluded from listings. This is a comma-separated list of glob patterns.
  493. It defaults to the empty string, but common settings include "*.o,*.obj"
  494. (to exclude object files) or ".git,.svn" (to exclude SCM metadata
  495. directories). For example:
  496. :set wildignore+=*.o,*.obj,.git
  497. A pattern such as "vendor/rails/**" would exclude all files and
  498. subdirectories inside the "vendor/rails" directory (relative to
  499. directory Command-T starts in).
  500. See the |'wildignore'| documentation for more information.
  501. If you want to influence Command-T's file exclusion behavior without
  502. changing your global |'wildignore'| setting, you can use the
  503. |g:CommandTWildIgnore| setting to apply an override that takes effect
  504. only during Command-T searches.
  505. FAQ *command-t-faq*
  506. Why does my build fail with "unknown argument -multiply_definedsuppress"? ~
  507. You may see this on OS X Mavericks when building with the Clang compiler
  508. against the system Ruby. This is an unfortunate Apple bug that breaks
  509. compilation of many Ruby gems with native extensions on Mavericks. It has been
  510. worked around in the upstream Ruby version, but won't be fixed in OS X until
  511. Apple updates their supplied version of Ruby (most likely this won't be until
  512. the next major release):
  513. https://bugs.ruby-lang.org/issues/9624
  514. Workarounds include building your own Ruby (and then your own Vim and
  515. Command-T), or more simply, building with the following `ARCHFLAGS` set:
  516. ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future ruby extconf.rb
  517. make
  518. Why can't I open in a split with <C-CR> and <C-s> in the terminal? ~
  519. It's likely that <C-CR> won't work in most terminals, because the keycode that
  520. is sent to processes running inside them is identical to <CR>; when you type
  521. <C-CR>, terminal Vim literally "sees" <CR>. Unfortunately, there is no
  522. workaround for this.
  523. If you find that <C-s> also doesn't work the most likely explanation is that
  524. XON/XOFF flow control is enabled; this is the default in many environments.
  525. This means that when you press <C-s> all input to the terminal is suspended
  526. until you release it by hitting <C-q>. While input is suspended you may think
  527. your terminal has frozen, but it hasn't.
  528. To disable flow control, add the following to your `.zshrc` or
  529. `.bash_profile`:
  530. stty -ixon
  531. See the `stty` man page for more details.
  532. TIPS *command-t-tips*
  533. Working with very large repositories ~
  534. One of the primary motivations for writing Command-T was to get fast, robust
  535. high-quality matches even on large hierarchies. The larger the hierarchy, the
  536. more important having good file navigation becomes. This is why Command-T's
  537. performance-critical sections are written in C. This requires a compilation
  538. step and makes Command-T harder to install than similar plug-ins which are
  539. written in pure Vimscript, and can be a disincentive against use. This is a
  540. conscious trade-off; the goal isn't to have as many users as possible, but
  541. rather to provide the best performance at the highest quality.
  542. The speed of the core is high enough that Command-T can afford to burn a bunch
  543. of extra cycles -- using its recursive matching algorithm -- looking for a
  544. higher-quality, more intuitive ranking of search results. Again, the larger
  545. the hierarchy, the more important the quality of result ranking becomes.
  546. Nevertheless, for extremely large hierarchies (of the order of 500,000 files)
  547. some tuning is required in order to get useful and usable performance levels.
  548. Here are some useful example settings:
  549. let g:CommandTMaxHeight = 30
  550. You want the match listing window to be large enough that you can get useful
  551. feedback about how your search query is going; in large hierarchies there may
  552. be many, many matches for a given query. At the same time, you don't want Vim
  553. wasting valuable cycles repainting a large portion of the screen area,
  554. especially on a large display. Setting the limit to 30 or similar is a
  555. reasonable compromise.
  556. let g:CommandTMaxFiles = 500000
  557. The default limit of 30,000 files prevents Command-T from "seeing" many of the
  558. files in a large directory hierarchy so you need to increase this limit.
  559. let g:CommandTInputDebounce = 200
  560. Wait for 200ms of keyboard inactivity before computing search results. For
  561. example, if you are enter "foobar" quickly (ie. within 1 second), there is
  562. little sense in fetching the results for "f", "fo", "foo", "foob", "fooba" and
  563. finally "foobar". Instead, we can just fetch the results for "foobar". This
  564. setting trades off some immediate responsiveness at the micro level for
  565. better performance (real and perceived) and a better search experience
  566. overall.
  567. let g:CommandTFileScanner = 'watchman'
  568. On a large hierarchy with of the order of 500,000 files, scanning a directory
  569. tree with a tool like the `find` executable may take literally minutes with a
  570. cold cache. Once the cache is warm, the same `find` run may take only a second
  571. or two. Command-T provides a "find" scanner to leverage this performance, but
  572. there is still massive overhead in passing the results through Vim internal
  573. functions that apply 'wildignore' settings and such, so for truly immense
  574. repos the "watchman" scanner is the tool of choice.
  575. This scanner delegates the task of finding files to Facebook's `watchman` tool
  576. (https://github.com/facebook/watchman), which can return results for a 500,000
  577. file hierarchy within about a second.
  578. Note that Watchman has a range of configuration options that can be applied by
  579. files such as `/etc/watchman.json` or per-direcory `.watchmanconfig` files and
  580. which may affect how Command-T works. For example, if your configuration has a
  581. `root_restrict_files` setting that makes Watchman only work with roots that
  582. look like Git or Mercurial repos, then Command-T will fall back to using the
  583. "find" scanner any time you invoke it on a non-repo directory. For
  584. simplicity's sake, it is probably a good idea to use Vim and Command-T
  585. anchored at the root level of your repository in any case.
  586. let g:CommandTMaxCachedDirectories = 10
  587. Command-T will internally cache up to 10 different directories, so even if you
  588. |cd| repeatedly, it should only need to scan each directory once.
  589. It's advisable to keep a long-running Vim instance in place and let it cache
  590. the directory listings rather than repeatedly closing and re-opening Vim in
  591. order to edit every file. On those occasions when you do need to flush the
  592. cache (ie. with |CommandTFlush| or <C-f> in the match listing window), use of
  593. the Watchman scanner should make the delay barely noticeable.
  594. As noted in the introduction, Command-T works best when you adopt a
  595. "path-centric" mentality. This is especially true on very large hierarchies.
  596. For example, if you're looking for a file at:
  597. lib/third-party/adapters/restful-services/foobar/foobar-manager.js
  598. you'll be able to narrow your search results down more narrowly if you search
  599. with a query like "librestfoofooman" than "foobar-manager.js". This evidently
  600. requires that you know where the file you're wanting to open exists, but
  601. again, this is a concious design decision: Command-T is made to enable people
  602. who know what they want to open and where it is to open it as quickly as
  603. possible; other tools such as NERDTree exist for visually exploring an unknown
  604. hierarchy.
  605. Over time, you will get a feel for how economical you can afford to be with
  606. your search queries in a given repo. In the example above, if "foo" is not a
  607. very common pattern in your hierarchy, then you may find that you can find
  608. what you need with a very concise query such as "foomanjs". With time, this
  609. kind of ongoing calibration will come quite naturally.
  610. Finally, it is important to be on a relatively recent version of Command-T to
  611. fully benefit from the available performance enhancements:
  612. - version 1.8 (March 2013) sped up the Watchman file scanner by switching its
  613. communication from the JSON to the binary Watchman protocol
  614. - version 1.7 (February 2014) added the |g:CommandTInputDebounce| and
  615. |g:CommandTFileScanner| settings, along with support for the Watchman file
  616. scanner
  617. - version 1.6 (December 2013) added parallelized search
  618. - version 1.5 (September 2013) added memoization to the matching algorithm,
  619. improving general performance on large hierarchies, but delivering
  620. spectacular gains on hierarchies with "pathological" characteristics that
  621. lead the algorithm to exhibit degenerate behavior
  622. AUTHORS *command-t-authors*
  623. Command-T is written and maintained by Wincent Colaiuta <win@wincent.com>.
  624. Other contributors that have submitted patches include (in alphabetical
  625. order):
  626. Andy Waite Mike Lundy Shlomi Fish
  627. Anthony Panozzo Nadav Samet Steven Moazami
  628. Daniel Hahler Nate Kane Sung Pae
  629. Felix Tjandrawibawa Nicholas Alpi Thomas Pelletier
  630. Gary Bernhardt Noon Silk Victor Hugo Borja
  631. Ivan Ukhov Paul Jolly Vít Ondruch
  632. Jeff Kreeftmeijer Pavel Sergeev Woody Peterson
  633. Lucas de Vries Rainux Luo Yan Pritzker
  634. Marcus Brito Roland Puntaier Yiding Jia
  635. Marian Schubert Scott Bronson Zak Johnson
  636. Matthew Todd Seth Fowler
  637. As this was the first Vim plug-in I had ever written I was heavily influenced
  638. by the design of the LustyExplorer plug-in by Stephen Bach, which I understand
  639. was one of the largest Ruby-based Vim plug-ins at the time.
  640. While the Command-T codebase doesn't contain any code directly copied from
  641. LustyExplorer, I did use it as a reference for answers to basic questions (like
  642. "How do you do 'X' in a Ruby-based Vim plug-in?"), and also copied some basic
  643. architectural decisions (like the division of the code into Prompt, Settings
  644. and MatchWindow classes).
  645. LustyExplorer is available from:
  646. http://www.vim.org/scripts/script.php?script_id=1890
  647. DEVELOPMENT *command-t-development*
  648. Development in progress can be inspected via the project's Git web-based
  649. repository browser at:
  650. https://wincent.com/repos/command-t
  651. the clone URL for which is:
  652. git://git.wincent.com/command-t.git
  653. Mirrors exist on GitHub and Gitorious; these are automatically updated once
  654. per hour from the authoritative repository:
  655. https://github.com/wincent/command-t
  656. https://gitorious.org/command-t/command-t
  657. Patches are welcome via the usual mechanisms (pull requests, email, posting to
  658. the project issue tracker etc).
  659. As many users choose to track Command-T using Pathogen, which often means
  660. running a version later than the last official release, the intention is that
  661. the "master" branch should be kept in a stable and reliable state as much as
  662. possible.
  663. Riskier changes are first cooked on the "next" branch for a period before
  664. being merged into master. You can track this branch if you're feeling wild and
  665. experimental, but note that the "next" branch may periodically be rewound
  666. (force-updated) to keep it in sync with the "master" branch after each
  667. official release.
  668. WEBSITE *command-t-website*
  669. The official website for Command-T is:
  670. https://wincent.com/products/command-t
  671. The latest release will always be available from there.
  672. A copy of each release is also available from the official Vim scripts site
  673. at:
  674. http://www.vim.org/scripts/script.php?script_id=3025
  675. Bug reports should be submitted to the issue tracker at:
  676. https://wincent.com/issues
  677. DONATIONS *command-t-donations*
  678. Command-T itself is free software released under the terms of the BSD license.
  679. If you would like to support further development you can make a donation via
  680. PayPal to win@wincent.com:
  681. https://wincent.com/products/command-t/donations
  682. LICENSE *command-t-license*
  683. Copyright 2010-2014 Wincent Colaiuta. All rights reserved.
  684. Redistribution and use in source and binary forms, with or without
  685. modification, are permitted provided that the following conditions are met:
  686. 1. Redistributions of source code must retain the above copyright notice,
  687. this list of conditions and the following disclaimer.
  688. 2. Redistributions in binary form must reproduce the above copyright notice,
  689. this list of conditions and the following disclaimer in the documentation
  690. and/or other materials provided with the distribution.
  691. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  692. AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  693. IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  694. ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
  695. LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  696. CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  697. SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  698. INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  699. CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  700. ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  701. POSSIBILITY OF SUCH DAMAGE.
  702. HISTORY *command-t-history*
  703. 1.8 (31 March 2014)
  704. - taught Watchman file scanner to use the binary protocol instead of JSON,
  705. roughly doubling its speed
  706. - build changes to accommodate MinGW (patch from Roland Puntaier)
  707. 1.7 (9 March 2014)
  708. - added |g:CommandTInputDebounce|, which can be used to improve responsiveness
  709. in large file hierarchies (based on patch from Yiding Jia)
  710. - added a potentially faster file scanner which uses the `find` executable
  711. (based on patch from Yiding Jia)
  712. - added a file scanner that knows how to talk to Watchman
  713. (https://github.com/facebook/watchman)
  714. - added |g:CommandTFileScanner|, which can be used to switch file scanners
  715. - fix processor count detection on some platforms (patch from Pavel Sergeev)
  716. 1.6.1 (22 December 2013)
  717. - defer processor count detection until runtime (makes it possible to sensibly
  718. build Command-T on one machine and use it on another)
  719. 1.6 (16 December 2013)
  720. - on systems with POSIX threads (such as OS X and Linux), Command-T will use
  721. threads to compute match results in parallel, resulting in a large speed
  722. boost that is especially noticeable when navigating large projects
  723. 1.5.1 (23 September 2013)
  724. - exclude large benchmark fixture file from source exports (patch from Vít
  725. Ondruch)
  726. 1.5 (18 September 2013)
  727. - don't scan "pathological" filesystem structures (ie. circular or
  728. self-referential symlinks; patch from Marcus Brito)
  729. - gracefully handle files starting with "+" (patch from Ivan Ukhov)
  730. - switch default selection highlight color for better readability (suggestion
  731. from André Arko), but make it possible to configure via the
  732. |g:CommandTHighlightColor| setting
  733. - added a mapping to take the current matches and put then in the quickfix
  734. window
  735. - performance improvements, particularly noticeable with large file
  736. hierarchies
  737. - added |g:CommandTWildIgnore| setting (patch from Paul Jolly)
  738. 1.4 (20 June 2012)
  739. - added |:CommandTTag| command (patches from Noon Silk)
  740. - turn off |'colorcolumn'| and |'relativenumber'| in the match window (patch
  741. from Jeff Kreeftmeijer)
  742. - documentation update (patch from Nicholas Alpi)
  743. - added |:CommandTMinHeight| option (patch from Nate Kane)
  744. - highlight (by underlining) matched characters in the match listing (requires
  745. Vim to have been compiled with the +conceal feature, which is available in
  746. Vim 7.3 or later; patch from Steven Moazami)
  747. - added the ability to flush the cache while the match window is open using
  748. <C-f>
  749. 1.3.1 (18 December 2011)
  750. - fix jumplist navigation under Ruby 1.9.x (patch from Woody Peterson)
  751. 1.3 (27 November 2011)
  752. - added the option to maintain multiple caches when changing among
  753. directories; see the accompanying |g:CommandTMaxCachedDirectories| setting
  754. - added the ability to navigate using the Vim jumplist (patch from Marian
  755. Schubert)
  756. 1.2.1 (30 April 2011)
  757. - Remove duplicate copy of the documentation that was causing "Duplicate tag"
  758. errors
  759. - Mitigate issue with distracting blinking cursor in non-GUI versions of Vim
  760. (patch from Steven Moazami)
  761. 1.2 (30 April 2011)
  762. - added |g:CommandTMatchWindowReverse| option, to reverse the order of items
  763. in the match listing (patch from Steven Moazami)
  764. 1.1b2 (26 March 2011)
  765. - fix a glitch in the release process; the plugin itself is unchanged since
  766. 1.1b
  767. 1.1b (26 March 2011)
  768. - add |:CommandTBuffer| command for quickly selecting among open buffers
  769. 1.0.1 (5 January 2011)
  770. - work around bug when mapping |:CommandTFlush|, wherein the default mapping
  771. for |:CommandT| would not be set up
  772. - clean up when leaving the Command-T buffer via unexpected means (such as
  773. with <C-W k> or similar)
  774. 1.0 (26 November 2010)
  775. - make relative path simplification work on Windows
  776. 1.0b (5 November 2010)
  777. - work around platform-specific Vim 7.3 bug seen by some users (wherein
  778. Vim always falsely reports to Ruby that the buffer numbers is 0)
  779. - re-use the buffer that is used to show the match listing, rather than
  780. throwing it away and recreating it each time Command-T is shown; this
  781. stops the buffer numbers from creeping up needlessly
  782. 0.9 (8 October 2010)
  783. - use relative paths when opening files inside the current working directory
  784. in order to keep buffer listings as brief as possible (patch from Matthew
  785. Todd)
  786. 0.8.1 (14 September 2010)
  787. - fix mapping issues for users who have set |'notimeout'| (patch from Sung
  788. Pae)
  789. 0.8 (19 August 2010)
  790. - overrides for the default mappings can now be lists of strings, allowing
  791. multiple mappings to be defined for any given action
  792. - <Leader>t mapping only set up if no other map for |:CommandT| exists
  793. (patch from Scott Bronson)
  794. - prevent folds from appearing in the match listing
  795. - tweaks to avoid the likelihood of "Not enough room" errors when trying to
  796. open files
  797. - watch out for "nil" windows when restoring window dimensions
  798. - optimizations (avoid some repeated downcasing)
  799. - move all Ruby files under the "command-t" subdirectory and avoid polluting
  800. the "Vim" module namespace
  801. 0.8b (11 July 2010)
  802. - large overhaul of the scoring algorithm to make the ordering of returned
  803. results more intuitive; given the scope of the changes and room for
  804. optimization of the new algorithm, this release is labelled as "beta"
  805. 0.7 (10 June 2010)
  806. - handle more |'wildignore'| patterns by delegating to Vim's own |expand()|
  807. function; with this change it is now viable to exclude patterns such as
  808. 'vendor/rails/**' in addition to filename-only patterns like '*.o' and
  809. '.git' (patch from Mike Lundy)
  810. - always sort results alphabetically for empty search strings; this eliminates
  811. filesystem-specific variations (patch from Mike Lundy)
  812. 0.6 (28 April 2010)
  813. - |:CommandT| now accepts an optional parameter to specify the starting
  814. directory, temporarily overriding the usual default of Vim's |:pwd|
  815. - fix truncated paths when operating from root directory
  816. 0.5.1 (11 April 2010)
  817. - fix for Ruby 1.9 compatibility regression introduced in 0.5
  818. - documentation enhancements, specifically targetted at Windows users
  819. 0.5 (3 April 2010)
  820. - |:CommandTFlush| now re-evaluates settings, allowing changes made via |let|
  821. to be picked up without having to restart Vim
  822. - fix premature abort when scanning very deep directory hierarchies
  823. - remove broken |<Esc>| key mapping on vt100 and xterm terminals
  824. - provide settings for overriding default mappings
  825. - minor performance optimization
  826. 0.4 (27 March 2010)
  827. - add |g:CommandTMatchWindowAtTop| setting (patch from Zak Johnson)
  828. - documentation fixes and enhancements
  829. - internal refactoring and simplification
  830. 0.3 (24 March 2010)
  831. - add |g:CommandTMaxHeight| setting for controlling the maximum height of the
  832. match window (patch from Lucas de Vries)
  833. - fix bug where |'list'| setting might be inappropriately set after dismissing
  834. Command-T
  835. - compatibility fix for different behaviour of "autoload" under Ruby 1.9.1
  836. - avoid "highlight group not found" warning when run under a version of Vim
  837. that does not have syntax highlighting support
  838. - open in split when opening normally would fail due to |'hidden'| and
  839. |'modified'| values
  840. 0.2 (23 March 2010)
  841. - compatibility fixes for compilation under Ruby 1.9 series
  842. - compatibility fixes for compilation under Ruby 1.8.5
  843. - compatibility fixes for Windows and other non-UNIX platforms
  844. - suppress "mapping already exists" message if <Leader>t mapping is already
  845. defined when plug-in is loaded
  846. - exclude paths based on |'wildignore'| setting rather than a hardcoded
  847. regular expression
  848. 0.1 (22 March 2010)
  849. - initial public release
  850. ------------------------------------------------------------------------------
  851. vim:tw=78:ft=help: