Code Monkey home page Code Monkey logo

Comments (8)

raymond-w-ko avatar raymond-w-ko commented on August 15, 2024

Also experienced this issue. My guess is that Vim / the OS doesn't know how to expand the ~. The solution that seemed to work for me is to wrap the s:dir in an expand()

This works for me in Linux and Windows.

diff --git a/plugin/sensible.vim b/plugin/sensible.vim
index 4c5b37b..44b2f30 100644
--- a/plugin/sensible.vim
+++ b/plugin/sensible.vim
@@ -63,13 +63,13 @@ set viminfo^=!
 let s:dir = has('win32') ? '~/Application Data/Vim' : has('mac') ? '~/Library/Vim' : '~/.local/share/vim'
 if isdirectory(expand(s:dir))
   if &directory =~# '^\.,'
-    let &directory = s:dir . '/swap//,' . &directory
+    let &directory = expand(s:dir) . '/swap//,' . &directory
   endif
   if &backupdir =~# '^\.,'
-    let &backupdir = s:dir . '/backup//,' . &backupdir
+    let &backupdir = expand(s:dir) . '/backup//,' . &backupdir
   endif
   if exists('+undodir') && &undodir =~# '^\.\%(,\|$\)'
-    let &undodir = s:dir . '/undo//,' . &undodir
+    let &undodir = expand(s:dir) . '/undo//,' . &undodir
   endif
 endif
 if exists('+undofile')

from vim-sensible.

raymond-w-ko avatar raymond-w-ko commented on August 15, 2024

Strangely enough, it stills has the ~ when I do set undodir?, so I'm not sure what magic is happening

from vim-sensible.

tpope avatar tpope commented on August 15, 2024

I actually worried that this might happen, but then completely half-assed verifying that it worked. Thanks.

from vim-sensible.

deiga avatar deiga commented on August 15, 2024

Strangely my undodir,directory and backupdir aren't assigned correclty at all.
:echo &directory | echo &undodir | echo &swap

.,/Users/timosand/tmp,/var/tmp,/tmp
.
.,/Users/timosand/tmp,/Users/timosand/

This is annoying since it inserts the temp files in the cwd of the file.

I'm on OS X 10.8, vim 7.3

from vim-sensible.

tpope avatar tpope commented on August 15, 2024

You have to create the directories yourself to opt in.

On Tue, Feb 5, 2013 at 5:41 PM, Timo Sand [email protected] wrote:

Strangely my undodir,directory and backupdir aren't assigned correclty at
all.
:echo &directory | echo &undodir | echo &swap

.,/Users/timosand/tmp,/var/tmp,/tmp
.
.,/Users/timosand/tmp,/Users/timosand/

This is annoying since it inserts the temp files in the cwd of the file.

I'm on OS X 10.8, vim 7.3


Reply to this email directly or view it on GitHubhttps://github.com//issues/23#issuecomment-13156424.

from vim-sensible.

deiga avatar deiga commented on August 15, 2024

I have created them
$ ll ~/Library/Vim

total 0
drwxr-xr-x 2 timosand staff 68 Jan 26 21:40 backup/
drwxr-xr-x 2 timosand staff 68 Jan 26 21:40 swap/
drwxr-xr-x 2 timosand staff 68 Jan 26 21:40 undo/

from vim-sensible.

raymond-w-ko avatar raymond-w-ko commented on August 15, 2024

This is just a hunch, but maybe you aren't using MacVim? In the code, it uses has('mac') to check if it is running on the Mac, and according to this post on stackoverflow, the native Vim binary doesn't itself report itself as "having mac". A more convoluted solutions follows, using system(uname) to check if it is Darwin, but that obviously won't work on Windows.

from vim-sensible.

tpope avatar tpope commented on August 15, 2024

Well crap, that's almost certainly it. Open a new bug for it. I'm not sure how I'll solve it yet.

Long term I'm definitely moving this to a separate plugin. It's way too much of a headache to be "sensible".

from vim-sensible.

Related Issues (20)

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.