{"action":"created","issue":{"url":"https://api.github.com/repos/junegunn/fzf/issues/133","labels_url":"https://api.github.com/repos/junegunn/fzf/issues/133/labels{/name}","comments_url":"https://api.github.com/repos/junegunn/fzf/issues/133/comments","events_url":"https://api.github.com/repos/junegunn/fzf/issues/133/events","html_url":"https://github.com/junegunn/fzf/pull/133","id":59300148,"number":133,"title":"fix bug with __fcd /path/to/dir","user":{"login":"acornejo","id":83786,"avatar_url":"https://avatars.githubusercontent.com/u/83786?v=3","gravatar_id":"","url":"https://api.github.com/users/acornejo","html_url":"https://github.com/acornejo","followers_url":"https://api.github.com/users/acornejo/followers","following_url":"https://api.github.com/users/acornejo/following{/other_user}","gists_url":"https://api.github.com/users/acornejo/gists{/gist_id}","starred_url":"https://api.github.com/users/acornejo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/acornejo/subscriptions","organizations_url":"https://api.github.com/users/acornejo/orgs","repos_url":"https://api.github.com/users/acornejo/repos","events_url":"https://api.github.com/users/acornejo/events{/privacy}","received_events_url":"https://api.github.com/users/acornejo/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-02-27T21:56:03Z","updated_at":"2015-02-28T01:36:57Z","closed_at":"2015-02-28T01:23:22Z","pull_request":{"url":"https://api.github.com/repos/junegunn/fzf/pulls/133","html_url":"https://github.com/junegunn/fzf/pull/133","diff_url":"https://github.com/junegunn/fzf/pull/133.diff","patch_url":"https://github.com/junegunn/fzf/pull/133.patch"},"body":"There is a bug in the way `__fcd` is currently implemented.\r\n\r\nTo observe the problem, simply run on your shell `$(__fcd $HOME)`.\r\n\r\n*Expected behavior:* You are displayed a list of directories inside `$HOME` and can use `fzf` to select one of them.\r\n*Observed behavior:* You get a truncated list of directories, and on selection `fzf` fails to change folder (since the paths are truncated).\r\n\r\nThis bug was caused due to a naive use of cut to remove the \"./\" prefix from folders. However, this prefix is absent if using absolute paths.\r\n\r\nI replaced the use of cut by `sed`, this also has the side benefit of require less pipes, since `sed` was already being used to remove the first line (and `sed` allows you to chain several operations in the same call).\r\n\r\nIn this commit I also made allowed other `fzf` commands, such as `__fsel`, receive the starting path as a parameter (as `__fcd` already did) using the current directory as the default when nothing else is specified.\r\n\r\nAnother change which I was tempted to make, was to add a global variable `FZF_DEFAULT_STARTPATH` that allows the users to specify in which directory they want to start fcd or fsel by default, allowing them to specify something else other than the current directory (aka \".\"). For instance, in my own use case I have the default be $HOME/src, since I rarely want to use fzf outside that. I thought I should get some feedback before creating that pull-request."},"comment":{"url":"https://api.github.com/repos/junegunn/fzf/issues/comments/76502815","html_url":"https://github.com/junegunn/fzf/pull/133#issuecomment-76502815","issue_url":"https://api.github.com/repos/junegunn/fzf/issues/133","id":76502815,"user":{"login":"junegunn","id":700826,"avatar_url":"https://avatars.githubusercontent.com/u/700826?v=3","gravatar_id":"","url":"https://api.github.com/users/junegunn","html_url":"https://github.com/junegunn","followers_url":"https://api.github.com/users/junegunn/followers","following_url":"https://api.github.com/users/junegunn/following{/other_user}","gists_url":"https://api.github.com/users/junegunn/gists{/gist_id}","starred_url":"https://api.github.com/users/junegunn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/junegunn/subscriptions","organizations_url":"https://api.github.com/users/junegunn/orgs","repos_url":"https://api.github.com/users/junegunn/repos","events_url":"https://api.github.com/users/junegunn/events{/privacy}","received_events_url":"https://api.github.com/users/junegunn/received_events","type":"User","site_admin":false},"created_at":"2015-02-28T01:36:57Z","updated_at":"2015-02-28T01:36:57Z","body":"By the way, I'm trying to refrain from updating those key binding codes until #83 is done. It has been really annoying to test all three shells after every update."}}