Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Fix filepath caching when cwd changes (Fix #179) #189

Closed
wants to merge 2 commits into from

2 participants

pydave Kim Silkebækken
pydave

Fixes #179: Update the filepath when the cwd changes

Issue #179 occurred because powerline never recalculated the cached filepath (but 'relative' requires it to be recalculated when the cwd changes). Sometimes, you'd see the filepath change when switching from cwd to another dir because the filepath wasn't cached when the file is in the cwd.

This pull clears the cached filepath when cwd changes (so it will be recalculated) and caches the filepath when the file is in the cwd. (So we're only recalculating when something actually changes.)

added some commits August 04, 2012
pydave Cache the current filepath when cwd == .
When editing a file in the current working directory, cache the filepath
just like when outside the cwd. (If b:Powerline_filepath isn't set, the
filepath isn't cached and vim recalculate everytime it draws the
statusline.)

Still doesn't cache when the filepath is empty.
0259703
pydave Fix #179: Update the filepath when the cwd changes
The g:Powerline_stl_path_style == 'relative' option requires the
filepath to be updated everytime the cwd changes.

Store the cwd and if the stored value's different from the current,
clear the cached filepath.
f2ed221
Kim Silkebækken Lokaltog referenced this pull request from a commit August 04, 2012
pydave Cache the current filepath when cwd == .
When editing a file in the current working directory, cache the filepath
just like when outside the cwd. (If b:Powerline_filepath isn't set, the
filepath isn't cached and vim recalculate everytime it draws the
statusline.)

Still doesn't cache when the filepath is empty.

Refs #179.
Refs #189.
f929a34
Kim Silkebækken Lokaltog referenced this pull request from a commit August 04, 2012
pydave Update the filepath when the cwd changes
The g:Powerline_stl_path_style == 'relative' option requires the
filepath to be updated everytime the cwd changes.

Store the cwd and if the stored value's different from the current,
clear the cached filepath.

Closes #179.
Refs #189.
ac420bb
Kim Silkebækken Lokaltog closed this August 07, 2012
neersighted referenced this pull request from a commit August 04, 2012
pydave Cache the current filepath when cwd == .
When editing a file in the current working directory, cache the filepath
just like when outside the cwd. (If b:Powerline_filepath isn't set, the
filepath isn't cached and vim recalculate everytime it draws the
statusline.)

Still doesn't cache when the filepath is empty.

Refs #179.
Refs #189.
ad73598
neersighted referenced this pull request from a commit August 04, 2012
pydave Update the filepath when the cwd changes
The g:Powerline_stl_path_style == 'relative' option requires the
filepath to be updated everytime the cwd changes.

Store the cwd and if the stored value's different from the current,
clear the cached filepath.

Closes #179.
Refs #189.
cef3b44
pydave pydave deleted the branch January 26, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 2 unique commits by 1 author.

Aug 04, 2012
pydave Cache the current filepath when cwd == .
When editing a file in the current working directory, cache the filepath
just like when outside the cwd. (If b:Powerline_filepath isn't set, the
filepath isn't cached and vim recalculate everytime it draws the
statusline.)

Still doesn't cache when the filepath is empty.
0259703
pydave Fix #179: Update the filepath when the cwd changes
The g:Powerline_stl_path_style == 'relative' option requires the
filepath to be updated everytime the cwd changes.

Store the cwd and if the stored value's different from the current,
clear the cached filepath.
f2ed221
This page is out of date. Refresh to see the latest.

Showing 1 changed file with 8 additions and 1 deletion. Show diff stats Hide diff stats

  1. 9  autoload/Powerline/Functions.vim
9  autoload/Powerline/Functions.vim
@@ -2,6 +2,13 @@
2 2
 autocmd CursorHold,BufWritePost,InsertLeave * unlet! b:statusline_trailing_space_warning
3 3
 
4 4
 function! Powerline#Functions#GetFilepath() " {{{
  5
+	" Recalculate the filepath when cwd changes.
  6
+	let cwd = getcwd()
  7
+	if exists("b:Powerline_cwd") && cwd != b:Powerline_cwd
  8
+		unlet! b:Powerline_filepath
  9
+	endif
  10
+	let b:Powerline_cwd = cwd
  11
+
5 12
 	if exists('b:Powerline_filepath')
6 13
 		return b:Powerline_filepath
7 14
 	endif
@@ -36,7 +43,7 @@ function! Powerline#Functions#GetFilepath() " {{{
36 43
 	endif
37 44
 
38 45
 	if ret == ('.' . dirsep)
39  
-		return ''
  46
+		let ret = ''
40 47
 	endif
41 48
 
42 49
 	let b:Powerline_filepath = ret
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.