edkolev / promptline.vim

Generate a fast shell prompt with powerline symbols and airline colors
MIT License
625 stars 54 forks source link

OSX: adding update_terminal_cwd to $prompt_command? #7

Closed mmaz closed 10 years ago

mmaz commented 10 years ago

Hi, first off, thanks for this terrific project, it's by far my favorite airline extension (my coworkers inquire about promptline way more often than airline!).

In OSX (on Mountain Lion), I believe Terminal.app (in bash) preserves the current working directory when opening a new tab or window by setting PROMPT_COMMAND to update_terminal_cwd(). Promptline.vim calls __promptline() to set PROMPT_COMMAND, so I lose my current working directory unless, in my bash_profile, I set PROMPT_COMMAND="update_terminal_cwd; $PROMPT_COMMAND"

Would Promptline.vim break if __promptline()preserves and appends to the existing PROMPT_COMMAND, or is there another generally shell-safe way to preserve the cwd in new tabs from within promptline? Thanks again for such an awesome project!

edkolev commented 10 years ago

Thanks for reporting this!

I'll provide a fix within the next few days. The behavior would be similar to what z does, i.e. append to PROMPT_COMMAND instead of overwriting it.

Glad you like the project :)

edkolev commented 10 years ago

Could you verify this is fixed? I've tested in Terminal.app (but I don't use Terminal.app on a regular basis, I might be missing something). Thanks!

mmaz commented 10 years ago

Hi, thanks again! I'm seeing a missing backtick from bash after updating though; might be a character encoding issue with the newline? If you're unable to triage it in your environment and it's not just local to me, I'd be happy to take a closer look and submit a pull request in the next week or so, after taking a couple of minutes to refresh my bash scripting and encoding :)

-bash: my_promptline.sh: line 183: unexpected EOF while looking for matching `''
-bash: my_promptline.sh: line 184: syntax error: unexpected end of file
edkolev commented 10 years ago

I managed to reproduce it in OSX's built-in bash. Escaping the new line in vimscript seems to have fixed this.

Also, PRs are welcome (I should probably add that in the readme). It's probably simplest to add more slices (details here), or a color theme (example here).

Again, thank you very much for reporting this :)

mmaz commented 10 years ago

I can confirm it's resolved, thank you so much again. Also great to hear you're interested in PRs, I've started customizing my prompt with both slices and a modified theme, and hope to submit it once I've stopped tweaking things.

edkolev commented 10 years ago

Thanks for confirming it's fixed!