Code Monkey home page Code Monkey logo

command-t's Introduction

"dotfiles" and system configuration

These dotfiles are affectionately dedicated to the vi editor originally created by Bill Joy, with whom I have spent many pleasant evenings1

— Greg Hurrell, paraphrasing Donald Knuth

Overview

Features

Dotfiles

A set of dotfiles that I've been tweaking and twiddling since the early 2000s (under version control since 2009). Characteristics include:

  • Sane Vim pasting via bracketed paste mode.
  • Write access to local clipboard from local and remote hosts, inside and outside of tmux (via Clipper).
  • Full mouse support (pane/split resizing, scrolling, text selection) in Vim and tmux.
  • Focus/lost events for Vim inside tmux.
  • Cursor shape toggles on entering Vim.
  • Italics in the terminal.
  • Bundles a (not-excessive) number of useful Vim plug-ins.
  • Conservative Vim configuration (very few overrides of core functionality; most changes are unobtrusive enhancements; some additional functionality exposed via <Leader> and <LocalLeader> mappings.
  • Relatively restrained Zsh config, Bash-like but with a few Zsh perks, such as right-side prompt, auto-cd hooks, command elapsed time printing and such.
  • Unified color-handling (across iTerm2 and Vim) via Base16 Shell.
  • Encrypted versioning of files with sensitive content (via git-cipher).
  • Comprehensive Hammerspoon config.

Homebrew

On macOS, the "homebrew" aspect installs a bunch of useful software.

Keyboard customization

On macOS, we use Karabiner-Elements, and on Linux, we use Interception Tools and a few other pieces to make the following changes:

  • Make Caps Lock serve as Backspace (when tapped) and Left Control (when chorded with another key). When held down alone, Caps Lock fires repeated Backspace events.
  • Make Return serve as Return (when tapped) and Right Control (when chorded with another key). When held down alone, Return fires repeated Return events.
  • Toggle Caps Lock on by tapping both Shift keys simultaneously.
  • Makes the function keys on my external Realforce keyboard behave like the "media" keys on Apple's keyboards.

And these only on macOS:

  • Swap Option and Command keys on my external Realforce keyboard.
  • Make the "application" key (extra modifier key on right-hand side) behave as "fn" on Realforce keyboard.
  • Map Control-I to F6 (only in the terminal) so that it can be mapped independently from Tab in Vim2.
  • Make "pause" (at far-right of function key row) behave as "power" (effectively, sleep) on Realforce keyboard.
  • Adds a "SpaceFN" layer that can be activated by holding down Space while hitting other keys; I use this to make the cursor keys available on or near the home row in any app.

Zsh

Functions

  • ag: Transparently wraps the ag executable so as to provide a centralized place to set defaults for that command (seeing as it has no "rc" file).
  • bounce: bounce the macOS Dock icon if the terminal is not in the foreground.
  • color: change terminal and Vim color scheme.
  • fd: "find directory" using fast bfs and sk; automatically cds into the selected directory.
  • fh: "find [in] history"; selecting a history item inserts it into the command line but does not execute it.
  • history: overrides the (tiny) default history count.
  • jump (aliased to j): to jump to hashed directories.
  • regmv: bulk-rename files (eg. regmv '/\.tif$/.tiff/' *).
  • scratch: create a random temporary scratch directory and cd into it.
  • tick: moves an existing time warp (eg. tick +1h); see tw below for a description of time warp.
  • tmux: wrapper that reattches to pre-existing sessions, or creates new ones based on the current directory name; additionally, looks for a .tmux file to set up windows and panes (note that the first time a given .tmux file is encountered the wrapper asks the user whether to trust or skip it).
  • tw ("time warp"): overrides GIT_AUTHOR_DATE and GIT_COMMITTER_DATE (eg. tw -1d).

Prompt

Zsh is configured with the following prompt:

Visible here are:

  • Concise left-hand prompt consisting of:
  • Extended right-hand size prompt which auto-hides when necessary to make room for long commands and contains:
    • Duration of previous command in adaptive units (seconds, minutes, hours, days, depending on duration).
    • Current version control branch name.
    • Current version control worktree status using colors that match those used in git status:
      • Green dot indicates staged changes.
      • Red dot indicates unstaged changes.
      • Blue dot indicates untracked files.
    • Full version of current working directory (again, abbreviating $HOME to ~).

Nested shells are indicated with additional prompt characters. For example, one nested shell:

Two nested shells:

Root shells are indicated with a different color prompt character and the word "root":

Nesting within a root shell is indicated like this:

Two nested shells:

If the last command exited with a non-zero status (usually indicative of an error), a yellow exclamation is shown:

If there are background processes, a yellow asterisk is shown:

Dependencies

  • tmux 3.2 or later.
  • Neovim v0.5.0 or later.
  • Relatively recent Zsh.
  • Relatively recent Git.
  • Clipper for transparent access to the local system clipboard.
  • On macOS, iTerm2 or Kitty. Additionally, only the latest one or two versions of macOS (at the time of writing, that means Sonoma) get actively tested.
  • Ruby.
  • Adobe Source Code Pro or any other fixed-width font that includes the Powerline glyphs.

Platform status

Platform Status
macOS 🥇 Currently the most tested platform, as well as the one with most aspects (because my daily driver is macOS 13 "Sonoma")
Debian(-ish) Linux 🥈 I use this heavily at work, but in the somewhat odd Codespaces VM environment, so there are some weird assumptions at play
Arch Linux 🥉 Less tested, fewer aspects involved, but likely to evolve in the future as I'm using Arch Linux on my "leisure" desktop machine
Red Hat Linux and related (eg. CentOS) 💀 Abandoned, but in the past (2011-2018) this was the distro I used full-time at work

Installation

Clone

Development occurs on the main branch, but to avoid inconvenience for people who previously cloned the repo when the master branch was the main line, the legacy branch is kept up-to-date via a pre-push hook (which updates the local branch) and a post-receive hook (which updates the remote).

macOS

git clone --recursive https://github.com/wincent/wincent.git

Arch Linux

sudo pacman -Syu
sudo pacman -S git ruby tmux vim
git clone --recursive https://github.com/wincent/wincent.git
  • git: In order to clone the repo.
  • ruby: So that git-cipher can run (also used to build Command-T).
  • tmux: Just for comfort (eg. so you can see scrollback).
  • vim: Because the nvim aspect needs Vim (it runs vim to do a :helptags update).

Install

⚠️ WARNING: There are lots of different things that can be installed or configured (see the aspects/ directory). Unless you want your machine to be exactly like mine — which is unlikely — you probably don't want to install everything. Maybe you don't even want everything in the "dotfiles" and "nvim" aspects. Please inspect the contents of each aspect before proceeding to install it; you may even be better off just looking at the configuration files and stealing the bits that you find interesting or useful (everything is in the public domain, unless otherwise indicated).

At the time of writing, these are the aspects, which you can expect to change over time (see the aspects/ directory for an up-to-date listing):

  • On macOS only:
    • automator: Scripts for use with Automator
    • automount: Sets up macOS's automount facility
    • backup: Backup scripts
    • cron: Sets up cron files
    • defaults: Sets up defaults (ie. preferences) on macOS
    • fonts: Installs Source Code Pro font files
    • homebrew: Installs and updates Homebrew
    • iterm: Dynamic profiles for iTerm
    • karabiner: Configures Karabiner-Elements (keyboard customization).
    • launchd: Configures launchd
    • nix: Installs packages via the Nix package manager.
    • node: Installs Node.js
    • ruby: Installs Ruby gems
    • ssh: Manages local SSH config
    • tampermonkey: Sets up UserScripts
  • On Linux only:
    • apt: Installs packages using apt-get.
    • aur: Installs packages from the Arch User Repository.
    • avahi: Manages the Avahi zeroconf ("Bonjour") networking daemon.
    • codespaces: Custom tweaks for GitHub Codespaces environments.
    • interception: Sets up Interceptions Tools (keyboard customization).
    • locale: Sets up /etc/locale.conf
    • pacman: Installs packages via the Pacman package manager
    • sshd: Manages sshd.
    • systemd: Set up services that run from systemd
  • On both macOS and Linux:
    • dotfiles: Creates symlinks in $HOME to the dotfiles in this repo
    • meta: Tests the configuration framework
    • shell: Sets the use shell to zsh
    • terminfo: Sets up terminfo database entries for italics and 256-color support
    • nvim: Configures Neovim and Vim

Examples

./install dotfiles nvim     # Just install "dotfiles" and "nvim" stuff.
./install dotfiles          # Just install "dotfiles".
./install dotfiles --step   # Prompt for confirmation at each step.
./install dotfiles --check  # Do a dry-run, showing what would be changed.
./install                   # Install everything.
./install ^homebrew         # Install everything except for the "homebrew" aspect.
./install --help            # Lists all aspects, descriptions, options.

This sets up a local Node environment using n, and then uses Fig to copy the dotfiles and configure the machine.

Note: Given that ~/.config/git/config is included with these dotfiles, any local modifications or overrides that you apply should be added to ~/.config/git/config.local instead; for example:

git config --file ~/.config/git/config.local user.name "John Doe"
git config --file ~/.config/git/config.local user.email [email protected]

Manual steps

As much as I would love this thing to be entirely automated, there are some manual steps that must typically be performed.

macOS
  • In iTerm, mark the "Wincent" dynamic profile as the default: PreferencesProfilesOther actions...Set as Default
  • Set up full-disk access for iTerm: As described here, System PreferencesSecurity & PrivacyPrivacyFull Disk Access (and make sure that iTerm.app is in the list with the checkbox checked).

Troubleshooting

General troubleshooting

There are a few useful ./install options:

# Run in "check" (dry-run) mode.
./install --check

# Show debugging information during the run.
./install --debug

# Confirm each task before running it (--step), and begin
# execution from a specific task (--start-at-task) in a
# specific aspect ("dotfiles").
./install --step --start='make directories' dotfiles

./install hangs on the first run

If running on a brand new OS install where you have never used sudo before, ./install may appear to hang after requesting your password. This is because sudo may show a "lecture"3 on first run that requires you to respond to a prompt. When running in the context of ./install, you never see this prompt, because sudo is running in a subprocess, which causes the run to hang.

To avoid this, one time only, run sudo -v before running ./install.

License

Unless otherwise noted, the contents of this repo are in the public domain. See the LICENSE for details.

Authors

The repo is written and maintained by Greg Hurrell <[email protected]>. Other contributors that have submitted patches include, in alphabetical order:

  • Anton Kastritskiy
  • Hashem A. Damrah
  • Joe Lencioni
  • Jonathan Wilkins
  • Keng Kiat Lim
  • Mark Stenglein
  • Matthew Byrne
  • Michael Lohmann
  • Stone C. Lasley
  • Victor Igor
  • Zac Collier

This list produced with:

:read !git shortlog -s HEAD | grep -v 'Greg Hurrell' | cut -f 2-3 | sed -e 's/^/- /'

Security

As of commit ec49be762ff3 ("feat(dotfiles): automatically sign commits on personal machines", 2022-06-19) and commit 97143b5d7635 ("feat(dotfiles): sign commits everywhere except codespaces", 2022-06-20), I started signing most commits in this and other repos with GPG keys corresponding to my work and personal email addresses.

GitHub will label such commits with a "Verified" badge. In order to see signature information using the git commandline executable, you would run commands such as git show --show-signature and git log --show-signature. Note that in order to be able to actually verify these signatures you need a copy of the corresponding public keys, otherwise Git will show:

gpg: Signature made Mon 11 Jul 2022 11:50:35 CEST
gpg:                using RSA key B0C9C204D656540BDCDA86229F6B84B5B1E9955E
gpg:                issuer "[email protected]"
gpg: Can't check signature: No public key

You can obtain the public keys with the following:

# Either, download directly given the key fingerprint as shown by Git:
gpg --keyserver pgp.mit.edu --recv-key C7C225A18975180C4485A1E070516DBB88E4F779
gpg --keyserver pgp.mit.edu --recv-key B0C9C204D656540BDCDA86229F6B84B5B1E9955E

# Or, chose from a list of possible matches returned by searching for an email address:
gpg --keyserver https://pgp.mit.edu/ --search-keys [email protected]
gpg --keyserver https://pgp.mit.edu/ --search-keys [email protected]

You can also grab the keys from GitHub, if you trust GitHub:

curl https://github.com/wincent.gpg | gpg --import

Once you have those, Git will instead show:

gpg: Signature made Mon 11 Jul 2022 12:28:32 CEST
gpg:                using RSA key B0C9C204D656540BDCDA86229F6B84B5B1E9955E
gpg:                issuer "[email protected]"
gpg: Good signature from "Greg Hurrell <[email protected]>" [unknown]
gpg: WARNING: This key is not certified with a trusted signature!
gpg:          There is no indication that the signature belongs to the owner.
Primary key fingerprint: 2F44 69E0 C1FA 72AA C0A5  60C9 6210 6B56 923F 3481
     Subkey fingerprint: B0C9 C204 D656 540B DCDA  8622 9F6B 84B5 B1E9 955E

What's going on here, cryptographically speaking?

  • GPG keys consist of public and private parts, often referred to as public keys and private keys (together, a "key pair"). As the names suggest, the owner of the key must keep the private part secret, but the public part can be freely shared.
  • Roughly speaking, "signing" something means using the private key to encrypt a hash of the contents of the document that is being signed (in this case, the "document" is a commit).
  • The public key can be used to decrypt the hash, which can then be compared against the contents to confirm that they match. This is what is happening when we see gpg: Good signature above; it means that the public key for Greg Hurrell <[email protected]> verifies that the signature was indeed created with the corresponding private key belonging to that address.
  • Because only the owner has access to the private key, only the owner can make signatures with it; but conversely, because everybody has access to the public key, anybody can verify those signatures.
  • GPG keys have two additional concepts: "subkeys" are keys associated with a primary key; and "usages" describe what role those keys each play (eg. "signing", "encryption").
  • In practice, the primary key is always a "signing" key, and GPG will create one "encryption" subkey by default. Users can add/remove additional subkeys and assign them usages.
  • I create "signing" subkeys for making signatures and I rotate them once per year (I keep my primary key "offline" so that it can't be hacked if my machine is compromised).

So those are the cryptographic primitives. The signature is "Good" in the cryptographic sense, but why the scary "WARNING"? It's because there's a whole other layer on top of this called the "web of trust". A good signature gives us the mathematical certainty that a particular private key was used to produce a given signature, but that tells us nothing about the human world that exists above and around that crypto. That is, the key was used to make the signature, but was it me who used the key? Am I really the handsome Australian man living in Madrid claiming to be Greg Hurrell, or am I in fact part of a clandestine criminal organization operating from a satellite-connected submarine in the Arctic sea?

The web of trust serves to link your human-level trust relationships to the underlying digital entities. By running gpg --edit-key $KEY and hitting trust, you can explicitly record your level of trust in any given key, and you can do things like going to "key signing parties" and such where you can physically meet people, verify their identity by whatever means you deem appropriate, and then sign one another's public keys. The accrued effect of these actions over time is to establish a web of connections where trust is transitively applied: if you trust A and A trusts B, then you in turn can also trust B. Having said all that, how to actually go about building a useful web of trust is beyond the scope of this README, and in all my long years on the internet, I've never once gone to a key signing event or otherwise engaged in activity that would help me integrate my keys into a useful web of trust.

Footnotes

  1. The evenings were spent with vi derivatives, not with Bill Joy.

  2. This isn't needed on Linux because we can achieve the same via a Kitty configuration.

  3. See man sudoers.

command-t's People

Contributors

abhinav avatar aleksandrs-ledovskis avatar andyw8 avatar arkeet avatar artnez avatar blueyed avatar bmulholland avatar cemeng avatar codybuell avatar davidszotten avatar dbburgess avatar djjcast avatar douglasdrumond avatar etherandrius avatar garybernhardt avatar ivanukhov avatar jpfender avatar lencioni avatar mathstuf avatar matthewtodd avatar mtimkovich avatar novas0x2a avatar panozzaj avatar silky avatar tap349 avatar trotzig avatar vheon avatar voxik avatar wincent avatar zdave avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

command-t's Issues

Never sort current file as most relevant

When I fire up Command-T, I never want to open the file that I am currently editing. I think it might be nicer to either not include it in the list of files to open, or sort it down by a notch. This often happens if I am editing a file that has a similarly named file, like a spec, and I want to go from the component to the spec or vice versa.

Can't compile extension with Xcode 5 / Mavericks

➜  command-t git:(e926704) make
linking shared-object ext.bundle
clang: warning: unknown argument: '-multiply_definedsuppress' [-Wunused-command-line-argument-hard-error-in-future]
clang: note: this will be a hard error (cannot be downgraded to a warning) in the future
clang: warning: argument unused during compilation: '-multiply_definedsuppress'

The compiler in Xcode 5 no longer treats unknown compile flags as warnings. I tried removing the flag from the makefile which fixes the compile but causes vim to segfault on startup.

Warnings when compiling watchman.c

I just compiled the Command-T stuff, and it spit out this when compiling watchman.c:

compiling watchman.c
watchman.c:522:63: warning: format specifies type 'unsigned long' but the argument has
      type 'int' [-Wformat]
  ..."payload size mismatch (%lu)", end - (ptr + payload_size));
                             ~~~    ^~~~~~~~~~~~~~~~~~~~~~~~~~
                             %d
watchman.c:529:70: warning: format specifies type 'unsigned long' but the argument has
      type 'int' [-Wformat]
        rb_raise(rb_eArgError, "payload termination mismatch (%lu)", end - ptr);
                                                              ~~~    ^~~~~~~~~
                                                              %d
2 warnings generated.

Things seem to work for me (I'm not using watchman), but I thought you might like to know.

This is on a Macbook Air with OS X 10.9.3.

-> % ruby --version
ruby 2.0.0p451 (2014-02-24 revision 45167) [universal.x86_64-darwin13]

"command-t.vim could not load the C extension" after installing Yosemite

Just installed Mac OSX Yosemite, and now Command-T can't find the C extension. I've tried updating command-t to latest master and recompiling, but no dice. Here's what I've tried:

$ ruby --version
ruby 2.0.0p481 (2014-05-08 revision 45883) [universal.x86_64-darwin14]

$ ruby extconf.rb
checking for float.h... yes
checking for ruby.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for fcntl.h... yes
checking for stdint.h... yes
checking for sys/errno.h... yes
checking for sys/socket.h... yes
checking for ruby/st.h... yes
checking for st.h... yes
checking for pthread_create() in -lpthread... yes
creating Makefile

$ make
linking shared-object ext.bundle

But Command-T gives this error: command-t.vim could not load the C extension.

Inside vim, ruby reports its version like:

:ruby puts "#{RUBY_VERSION}-p#{RUBY_PATCHLEVEL}"
2.0.0-p481

I'm using the same version of ruby to build the C extension that vim is linked to. I've even tried rebuilding vim with an explicit ruby version, and it's still not working.

Any ideas?

detect command-t installation from command line?

Hi,
I'm trying to write a script that automates installation of the command-t vim plugin. I am wondering if there is a function I can call from a shell script to detect whether command t is installed, or a vimscript I can run from the command line, or something? Ideally this would involve no manual steps at all.

Thanks for your help! I love command-t, use it every day.

Custom prioritisation of file extensions

Is it possible to configure Command-T to prioritise certain file extensions/suffixes over others? (Command-T seems to ignore the vim suffixes variable as far as I can tell, as well as the project .gitignore file.). My use case is editing source-to-source languages like Coffee-script and Stylus: Command-T favours the output/generated files (*.css, .js, etc) over the source files (.styl, *.coffee, etc). Thanks!

^S not working?

Hi,

I've been using Command-T for a couple of days now and it's pretty awesome. However, I'm running it on a normal Ubuntu 14.04 machine, and it seems that ^S is not working when focussing on a path from Command-T. Same goes for ^enter.
Other than that enter and ^V seem to work just fine, so I guess there's a bug somewhere? ;)

Based on the readme I'd say I'm using version 1.8 of Command-T and an up-to-date version of Vim/Ruby. If you have any ideas, that'd be awesome.

Regards,
Jurriaan

Preview file

I've been using this plugin for a while now. It has always annoyed me that I cannot preview a file without closing the command-t window.

Say I want to look around in my controllers/accounts directory. I start :CommandT and type con/acc/. I can currently see all files in the folder. Now, if I want to view each file, will have to choose one, and repeat the procedure.

Would it be possible to implement A) a preview file command or B) a command to open Command-t with the same search as the previous one (in this case, open Command-t with the 'con/acc/' already typed in the prompt.?

Results list not updating on keypress

Hello,

I'm using a 'huge' build of Vim 7.4 built from source today, with the built-in version of Ruby (1.8.7) on Ubuntu 12.04. I've never had any problems with Command-T before, but after running a Vundle :BundleUpdate command I can't get search results to filter actively on each keypress. C-f helps in that the list is regenerated and sorted in match relevance order, but it's frustrating to see such a great plugin hampered to such a degree by something unknown!

I have a feeling that spf13 is once again getting in the way somehow. I'm definitely getting more motivated to start with a nice fresh vimrc once again...

Any suggestions that could help me? Thanks.

clang: error: unknown argument: '-multiply_definedsuppress' on installation, 10.9, macvim

I have MacVim snapshot 72 (https://github.com/b4winckler/macvim/releases), compiled against Ruby 2.0:

:ruby puts "#{RUBY_VERSION}-p#{RUBY_PATCHLEVEL}"
2.0.0-p247 

on a MacBook with 10.9.2. I do not use RVM.

Running

cd ~/.vim/ruby/command-t
ruby extconf.rb

is fine, but make results in:

linking shared-object ext.bundle
clang: error: unknown argument: '-multiply_definedsuppress' [-Wunused-command-line-argument-hard-error-in-future]

Xcode command line tools are installed:

$ pkgutil --pkg-info=com.apple.pkg.CLTools_Executables
package-id: com.apple.pkg.CLTools_Executables
version: 5.1.0.0.1.1396320587
volume: /
location: /
install-time: 1397238511
groups: com.apple.FindSystemFiles.pkg-group com.apple.DevToolsBoth.pkg-group com.apple.DevToolsNonRelocatableShared.pkg-group 

Allow to cancel scanning

It would be helpful, if you could abort the scanner (using Ctrl-C).

It appears the (GNU) find-based scanner behaves better than the (default) ruby one.
Is this the case?

Is this a limitation from Vim?
Would it help to make use of vimproc if it is available?

The usual case where I need to do this when I've accidentally invoked Command-T on a wrong (and huge) directory.

I've noticed in this regard, that there might be Vim errors afterwards (like missing :endif - just from the top of my head, not sure about this), but these are normally fixed when invoking :CommandT again.

I have recently switched back from the (GNU) find-based scanner to the ruby scanner, because the find-based scanner does not exclude/handle g:CommandTWildIgnore during scanning (and I use it to exclude (very) slow directories, like sshfs mounts).

Path cache does not update on subsequent changes of CWD

I use CommandT with setting g:CommandTTraverseSCM = 'pwd' and do not use SCM traversal feature. When I change directory with :cd for the first time, everything works as expected. However, trying to change directory again does not seem to be registered by CommandT (still seeing files from the previous directory when searching). I found a similar bug, which is labeled as fixed. From what I can see, @path is not getting set on subsequent calls in controller.rb at line 61. Inserting @path = nil before line 49 seems to fix the problem for me. I am not familiar with ruby so I don't really understand why this helps, but the code seems to be correct even without adding this line.

Command-T breaks in jruby projects when compiled for ruby

I've been struggling with this for a while so I thought I'd post it here in case I can get any help. I'm using rvm on osx mavericks. I've installed ruby 1.9.3-p545 (latest) and built vim against it. Then I followed the vimball installation instructions (so %, ruby extconf.rb, make). This works fine using vim with ruby 1.9.3. However if I change to a project directory that is on jruby, I get an error on vim startup:
$ vim config/routes.rb
Error detected while processing /Users/stephen/dotfiles/vim/plugin/command-t.vim:
line 194:
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
Press ENTER or type command to continue

I can press 'enter' to get past the error message and the file loads but command-t does not work. It gives the error message:
Error detected while processing function 10_CommandTShowFileFinder:
line 2:
NoMethodError: undefined method `show_file_finder' for nil:NilClass

If I open vim from a non-jruby dir then cd to the jruby dir (:cd inside vim), command-t works fine, and updates the file system tree to the current dir.
I've seen the installation instructions about matching vim, ruby, and command-t ruby libs. However, I was able to accomplish this switching ruby versions fine on a previous machine. I'm not sure what is different at this point. Do I need to somehow install different versions of command-t for each version of Ruby I want or is that possible? Help, I'd really like to have command-t back and working across my system. Let me know if I can provide any further details.

Implement "Go to anything"

Snipping from an email that I received from @lencioni:

One of the things that I used constantly in Sublime was the jump-to-file with fuzzy finding command. Command-T does this. Sublime also had a jump-to-symbol-in-the-current-file command that worked with the same fuzzy finding and it was a great way to bounce around a piece of code. This was actually the primary way I navigated my code.

They happened to implement this as a "go to anything" feature where the @ denotes the beginning of a symbol.

Here's a demo I found of it, probably fastest just to watch this: https://www.youtube.com/watch?v=Q0OtfjgnoLA

They also open the file and go to the symbol as you type or scroll around in the list of options, which is helpful for determining if it is actually the thing you want, but that is a separate feature.

Let me know what you think!

Compatibility with ruby 1.8.5: "rake make" might fail because of `RbConfig::MAKEFILE_CONFIG['DEFS'] += ' -DWATCHMAN_BUILD'`

I have noticed that the line RbConfig::MAKEFILE_CONFIG['DEFS'] += ' -DWATCHMAN_BUILD' in extconf.rb might cause failure when trying to generate the Makefile (source
https://github.com/wincent/Command-T/blob/master/ruby/command-t/extconf.rb#L24).

% ruby 'extconf.rb'
checking for #include <float.h>
... yes
checking for #include <ruby.h>
... yes
checking for #include <stdlib.h>
... yes
checking for #include <string.h>
... yes
checking for fcntl.h... yes
checking for stdint.h... yes
checking for sys/errno.h... yes
checking for sys/socket.h... yes
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers.  Check the mkmf.log file for more
details.  You may need configuration options.

Provided configuration options:
        --with-opt-dir
        --without-opt-dir
        --with-opt-include
        --without-opt-include=${opt-dir}/include
        --with-opt-lib
        --without-opt-lib=${opt-dir}/lib
        --with-make-prog
        --without-make-prog
        --srcdir=.
        --curdir
        --ruby=/usr/bin/ruby

The error is a bit unhelpful, and I don't know what the reason is, apart from
that the system I have tried this on is old (CentOS 5.4).

When I've just tried to reproduce it, it resulted in a more helpful error:

% /usr/bin/ruby extconf.rb
checking for #include <float.h>
... yes
checking for #include <ruby.h>
... yes
checking for #include <stdlib.h>
... yes
checking for #include <string.h>
... yes
checking for fcntl.h... yes
checking for stdint.h... yes
checking for sys/errno.h... yes
checking for sys/socket.h... yes
extconf.rb:24: undefined method `+' for nil:NilClass (NoMethodError)

Vim has Ruby 1.8.5, where RUBY_PATCHLEVEL is not defined, as mentioned in
the docs: :ruby puts "#{RUBY_VERSION}-p#{RUBY_PATCHLEVEL}".

Commenting the line appears to work (it can be compiled using make), but then invoking Command-T fails:

Error detected while processing function commandt#CommandTShowFileFinder:
line    2:
NoMethodError: undefined method `chars' for "":String

Support for "conjunctive search"

I would like the feature where if I hit "app con" it will apply two criteria, "app" and "con" and apply them both rather than taking space as a literal space (of course allowing the key to be configurable).

Currently if I want to search for a file called say "application_controller.rb" and yet all my files are in a subdirectory "application" and many files have the prefix "_controller" then searching for either "app" or "controller" will bring up a large list of files. Yet "ap co" would bring me right to the file I want with less key presses using my proposed scheme.

After using such a system I find it so much faster than what is available.

Choking on non UTF-8 filenames

The project I'm working on a bunch of internationalized filenames. I believe they're properly encoded UTF-8 [see below], but apparently Ruby/Command-T does not:

Error detected while processing function <SNR>13_CommandTShowFileFinder:                                                                                         
line    2:
ArgumentError: invalid byte sequence in UTF-8
Press ENTER or type command to continue

I'd be happy to supply the filename which is causing this problem, but I'm not sure how to get Command-T to produce that info for me.

Command-t ignores git repos?

I have a dev folder with two different git repos in it and an extra folder. When I run Command-t from dev only files from the non tracked folder are listed.

  • dev/
    • repo1/ (git repository 1)
    • repo2/ (git repository 2)
    • 3rd_folder/ (not tracked)

I would expect files from all three directories to be listed. I've tried increasing cache sizes with no luck. Could it have something to do with the different file listing techniques used in tracked/not-tracked directories?

Thanks!

Errorno::EMFILE: Too many open files

I just ran into an interesting problem when refreshing my file list.

-- NO MATCHES --
GoToFile
Error detected while processing function CommandTRefresh:
line    1:
Errno::EMFILE: Too many open files - /Users/joe/agora/app/assets/fonts/agora-icons

screen shot 2014-06-09 at 11 46 12 am

~/agora git:master ❯❯❯ tree app/assets/fonts/agora-icons
app/assets/fonts/agora-icons
├── agora-icons.eot
├── agora-icons.svg
├── agora-icons.ttf
└── agora-icons.woff

Refreshing again does the same thing, and now my file list is empty. Restarting vim seemed to make it work again. I wonder if I mashed some random keys that confused it.

:version
VIM - Vi IMproved 7.4 (2013 Aug 10, compiled May 17 2014 08:34:29)
MacOS X (unix) version
Included patches: 1-273
Compiled by Homebrew
Huge version without GUI.  Features included (+) or not (-):
+acl             -ebcdic          +localmap        +printer         +title
+arabic          +emacs_tags      -lua             +profile         -toolbar
+autocmd         +eval            +menu            +python          +user_commands
-balloon_eval    +ex_extra        +mksession       -python3         +vertsplit
-browse          +extra_search    +modify_fname    +quickfix        +virtualedit
++builtin_terms  +farsi           +mouse           +reltime         +visual
+byte_offset     +file_in_path    -mouseshape      +rightleft       +visualextra
+cindent         +find_in_path    +mouse_dec       +ruby            +viminfo
-clientserver    +float           -mouse_gpm       +scrollbind      +vreplace
+clipboard       +folding         -mouse_jsbterm   +signs           +wildignore
+cmdline_compl   -footer          +mouse_netterm   +smartindent     +wildmenu
+cmdline_hist    +fork()          +mouse_sgr       -sniff           +windows
+cmdline_info    -gettext         -mouse_sysmouse  +startuptime     +writebackup
+comments        -hangul_input    +mouse_urxvt     +statusline      -X11
+conceal         +iconv           +mouse_xterm     -sun_workshop    -xfontset
+cryptv          +insert_expand   +multi_byte      +syntax          -xim
+cscope          +jumplist        +multi_lang      +tag_binary      -xsmp
+cursorbind      +keymap          -mzscheme        +tag_old_static  -xterm_clipboard
+cursorshape     +langmap         +netbeans_intg   -tag_any_white   -xterm_save
+dialog_con      +libcall         +path_extra      -tcl             -xpm
+diff            +linebreak       -perl            +terminfo
+digraphs        +lispindent      +persistent_undo +termresponse
-dnd             +listcmds        +postscript      +textobjects
   system vimrc file: "$VIM/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
      user exrc file: "$HOME/.exrc"
  fall-back for $VIM: "/usr/local/share/vim"
Compilation: /usr/bin/clang -c -I. -Iproto -DHAVE_CONFIG_H   -DMACOS_X_UNIX  -Os -w -p
ipe -march=native -mmacosx-version-min=10.9 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1

Linking: /usr/bin/clang   -L. -L/usr/local/lib -L/usr/local/lib -Wl,-headerpad_max_ins
tall_names -o vim        -lm  -lncurses -liconv -framework Cocoa    -framework Python
  -lruby.2.0.0 -lobjc

OS X 10.9.3.

Exact match should have precedence over fuzzy match

If I search on 'router' the following items appear at the top of the list:

config/routes.rb
app/assets/javascripts/router.js

I would like to see the file that I am actually looking for (router.js) appear as the first item.

`vim -c CommandT` doesn't capture prompt properly

I recently went through a recompile/upgrade of my OS X (10.9.2) workstation, and ran into a frustrating issue.

When I run vim -c CommandT (which is my default vim launcher, when no file is specified on the command line), I can type into the prompt and see my input reflected, but the match window does not update. When I Control-x out and :CommandT again, it works fine. I tried vim -c "sleep 100m | CommandT" out of desperation, with no change.

I tried both the official vim 7.4 tbz, and the mercurial head. I reset to previous versions of Command-T as well (my previous HEAD was 89896bd).

How do I got about debugging this issue? I'd love to help you fix it, but honestly I can't even tell if it's a vim bug or a command-t bug.

Thanks!
—Aiden

Files are listed always from home

I can't find the exact cause, but all files listed are relative to my home folder. This does not happen always but most of the time, and I'm not sure what is triggering this behaviour. :pwd returns the correct folder where I wanted to look for files, and is the same folder from where I opened vim.

Unknown function: CommandTListMatches

Hi,

I reinstalled my machine and trying to reconfigure all the plugins back. But after building the command-t I'm getting the following error. It showing the file list but I can't able to type any letter to select some file.

Error detected while processing CursorHold Auto commands for "<buffer=2>":
E117: Unknown function: CommandTListMatches

Find the attached screenshot also. command-t-error

Is this due any missing libraries or package that's relevant to the vim or command-t ?

Thank you,
Haridas N.

json gem is now required

I couldn't get the latest version working on my mac since command-t now has a dependency on ruby's json gem.
Apparently, vim's embedded ruby environment doesn't contain any gem in its load path. Hence, command-t still failed to load after I installed json using 'ruby install json'.
Currently, in irb, I can do require 'json' fine but if within vim I do :ruby require 'json' then I will get a LoadError.

Any help would be greatly appreciated since I don't know too much about ruby.

Command-T failed to load: `LoadError: cannot load such file -- command-t/stub` (works normally)

For some reason, I've received the following error when calling :CommandT:

Error detected while processing …/vim/neobundles/command-t/autoload/commandt.vim:
line  193:
LoadError: cannot load such file -- command-t/stub
Error detected while processing function commandt#CommandTShowFileFinder:
line    2:
NoMethodError: undefined method `show_file_finder' for nil:NilClass
Error detected while processing function commandt#CommandTShowFileFinder:
line    2:
NoMethodError: undefined method `show_file_finder' for nil:NilClass

Command-T usually works. This just happened, but it works in a new Vim instance.

In the broken Vim instance, :ruby puts $: gives:

usr/local/lib/site_ruby/1.9.1
/usr/local/lib/site_ruby/1.9.1/x86_64-linux
/usr/local/lib/site_ruby
/usr/lib/ruby/vendor_ruby/1.9.1
/usr/lib/ruby/vendor_ruby/1.9.1/x86_64-linux
/usr/lib/ruby/vendor_ruby
/usr/lib/ruby/1.9.1
/usr/lib/ruby/1.9.1/x86_64-linux

The related code in Command-T:
https://github.com/wincent/command-t/blob/master/autoload/commandt.vim#L190

After this, each entering of a buffer causes this error:

Error detected while processing BufEnter Auto commands for "*":
NameError: uninitialized constant CommandT

(see also #91 about an option to delete these autocommands).

After a successful invocation of :CommandT, the bundles path is added to $::

/home/user/.vim/neobundles/command-t//ruby

AcceptSelectionSplit default mapping not working

The default <C-CR> and <C-s> split mappings don't appear to be bound when trying to open a file in a new split from the file list. Remapping the binding to <C-i> works for me, but due to the way Command-T binds keys (<silent> <buffer>) it's difficult to check the currently bound keys. I've checked all my :map's to make sure it's not being overwritten.

I've recently switched to the next branch, but I've seen this behavior on many commits for some time.

Missing pthread lib and missing C extension

Hello,
I just updated command-t finding two problems. Following the instructions I run ruby extconf.rb which creates a Makefile which misses the pthread library flag:

$ make x86_64-pc-linux-gnu-gcc -shared -o ext.so ext.o match.o matcher.o -L. -L/usr/lib64 -Wl,-R/usr/lib64 -L. -Wl,-O1 -Wl,--as-needed -rdynamic -Wl,-export-dynamic -Wl,--no-undefined -Wl,-R -Wl,/usr/lib64 -L/usr/lib64 -lruby18 -lrt -ldl -lcrypt -lm -lc matcher.o: In function CommandTMatcher_sorted_matches_for: matcher.c:(.text+0x3c0): undefined reference to pthread_create matcher.c:(.text+0x450): undefined reference to pthread_join collect2: error: ld returned 1 exit status make: *** [ext.so] Error 1

I add -lpthread to LIBS to solve this:
LIBS = $(LIBRUBYARG_SHARED) -lrt -ldl -lcrypt -lm -lc -lpthread

It compiles fine afterwards, but when I lunch vim it claims the C extension is missing:

command-t.vim could not load the C extension
Please see INSTALLATION and TROUBLE-SHOOTING in the help For more information type: :help command-t

Thank you

Probably wrong ranking of results

Command-T version

66d9f6f

Command-T options
let g:CommandTMaxFiles=1000000
set wildignore+=*.o,*.obj,*.d,*.png,*.svn-base,*.gif,*.jpg,*.pak,*.ninja,*.so,
               \*.a,*.gz,*.swf,*.tmp.*,out/**,out_*/**,**/third_party/**,*.mk
highlight CommandTHighlightColor term=reverse
  \ cterm=bold ctermbg=0* ctermfg=7*
  \ guibg=Grey
let g:CommandTHighlightColor='CommandTHighlightColor'
let g:CommandTMatchWindowReverse=1
let g:CommandTMaxHeight=20
Issue

I noticed today that results ranking looks somehow strange.
For example on "usercc" request, Command-T gives me following results:
usercc
and for "user.cc":
user.cc
The question is why Command-T returns results like "ash/system/user/config.h" or "ui/app_list/search_result.h" in answer to "usercc" request, when I have files like "ash/system/user/tray_user.cc". Among others, "ash/system/user/config.h" doesn't even has second 'c'.

Results list updating really slowly on keypress

I'm using a 'huge' build of Vim 7.4 built from source, with the built-in version of Ruby (1.8.7) on Ubuntu 12.04. I recently ran a Vundle BundleUpdate to update all my installed plugins, which included this one. Since then I've also removed Command-T and reinstalled cleanly with the new Vundle PluginInstall command; after that I had to manually drop into the plugin's ruby path and build the C parts.

When I am entering a search term in the Command-T buffer, results that previously showed up within several hundred milliseconds (almost instantly, in any case) -- for a project tree that has remained relatively constant -- are taking at least 1-2 seconds to appear at all. This delay occurs irrespective of the file scanner option in my .vimrc.local file (I'm using spf13 so it could be something to do with that, however nothing else has changed). I've tried 'ruby', 'find' and even 'watchman' after installing it (although the project in question has well below 4000 files where I open Vim).

Please help if you can, as this is really frustrating and is spoiling my enjoyment of an awesome tool. I've tried a few variations of the input debounce option to no avail.

OS X 10.10 no longer includes Ruby 1.8

Command-T requires Ruby 1.8, but OS X 10.10 no longer includes it, and the vim that ships on the system includes ruby support using ruby 2.0.

/usr/bin/vim provides Ruby version 2.0.0-p451.

Command-T segfaults.

On invoking command-T in vim, a segfault is thrown and vim exits. The latest Command-T commit is 2b69d1b.

The error thrown is:

Vim: Caught deadly signal SEGV
Vim: Finished.
Vim: Finished.
Vim: Caught deadly signal SEGV
Vim: Finished.

Segmentation fault (core dumped)

Any thoughts?

Stack level too deep.

With a clean vimrc, (only with pathogen), and only Command-t in my /bundle directory, I have the following problem:

When jumping to the previous file C-^, about every fourth time, I get:

Error detected while processing BufEnter Auto commands for "*": SystemStackError: /Users/mollerhoj3/.vim/bundle/Command-T/ruby/command-t/mru.rb:17:in touch': stack level too deep`.

I have tried reinstalling several times. I am on mavericks, and MacVim, (using ruby 1.8 to install).

Application Addon for GNOME Software

To give Command-T a bit more visibility and promotion in Fedora, I'd like to provide Application Addon metadata for Gnome Software [1]. According to the AppData specifications, I am going to add following metadata into our package:

$ cat vim-command-t.metainfo.xml 
<?xml version="1.0" encoding="UTF-8"?>
<!-- Copyright 2014 Vít Ondruch <[email protected]> -->
<component type="addon">
<id>vim-command-t</id>
<extends>gvim.desktop</extends>
<name>command-t</name>
<summary>Provides an extremely fast, intuitive mechanism for opening files with a minimal number of keystrokes</summary>
<url type="homepage">https://wincent.com/products/command-t</url>
<metadata_license>CC0-1.0</metadata_license>
<project_license>BSD</project_license>
<updatecontact>[email protected]</updatecontact>
</component>

Would you be willing to accept such file into official sources? That would allow to benefit also other Linux distributions/desktop environments, which are going to use AppData [3]

[1] https://bugzilla.redhat.com/show_bug.cgi?id=1110300
[2] http://blogs.gnome.org/hughsie/2014/06/11/application-addons-in-gnome-software/
[3] http://blogs.gnome.org/hughsie/

cursor keys not working

if i try to use any cursor keys it will exit command-t and insert a A,B,C or D in the text.

also backspace is just moving backwards for me and not deleting any characters

Open in same window when autowrite is set

When the autowriteall option is set, and the current buffer is modified, when the user selects a file with Command-T and presses <CR>, the file is open in a new split window.

The expected behavior would be that the buffer is saved and that the new file is open in the same window, like it would happen with the :e file command.

Open the selected file in a new split window doesn't work

Hello.

Pressing <Ctrl + CR> moves selection to next file, just like if <Ctrl + n> was pressed.
(<Ctrl + s> doesn't work as well, but it is expected, because <Ctrl + s> interpreted as XOFF by my terminal).

Vim version:
VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Mar 18 2014 17:37:53)
Included patches: 1-205

Command-T: revision at 66d9f6f
OS: Ubuntu 12.04
Other installed plugins: syntastic/ ultisnips/ vim-fugitive/ YouCompleteMe/

When Vim's CWD changes, update path cache if `g:CommandTTraverseSCM = 'pwd'`

I just updated to latest Command-T and I noticed that some old behavior is now gone. First, I had to set let g:CommandTTraverseSCM = 'pwd' to stop Command-T from changing my search root dir.

After doing this, I noticed that when I change Vim's current working directory with :cd, Command-T doesn't notice it anymore. It used to flush the path cache and then refresh it. In fact, even if I force the cache refresh with :CommandTFlush, it still uses the old working directory Vim was started with.

I'd like the old behavior back if at all possible: when Vim's CWD changes, update the file cache. If that's not possible, at least make the flush operation use the latest CWD.

Tag search extremely slow

I have a tags file generated by ctags that contains about 60K entries.

When running CommandTTag my CPU goes to 100% for about 30 seconds (on a fast laptop), fans turn on, etc. Then for every key I press it also takes about 30 seconds for each keypress to filter the list.

I do understand that the initial list load might take some time, but I'd expect the plugin to generate some kind of internal lookup index / cache to make sure that subsequent calls are snappy. The cache could be flushed just like for files by running CommandTFlush.

This makes it unusable for me.

Note that file lookup works properly, probably because there are much less entries.

This is with command-t version with the latest master (3a5d9b9) but it was already the case when I first tried this feature many months ago.

Watchman scanner breaks vim after suspend/resume

I think I've stumbled on a rather strange bug: when I invoke :CommandT, exit the menu (by either selecting a file or typing ctrl-c), and background my vim process, when I bring vim back to the foreground, any key I type is echoed back verbatim. I can reproduce this every time.

Any idea what might be going on? If there's anything I can do to help out, let me know.

(BTW, thanks for an awesome plugin!)

Results height

I don't know if this is an issue, just looking for an answer - how do I get it so the height is higher. Right now when I do t, it only starts with 10 results, which I would prefer that it shows a lot more when I start. How would I set this option?

Thank you for your help and sorry if this is wrong place to ask. I went to SO and someone told me that my question should be posted in plugin issue tracker.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.