tpope / vim-obsession

obsession.vim: continuously updated session files
http://www.vim.org/scripts/script.php?script_id=4472
1.74k stars 68 forks source link

cannot store filenames starting with tilda #38

Open c5c86a opened 6 years ago

c5c86a commented 6 years ago

I do not know if this repo is the root cause of this issue. I use neovim 0.2.2

When opening a file whose path starts with tilda (the home dir) e.g. ~/file1.md on a buffer, closing vim and opening it again, vim opens the buffer as empty complaining that file1.md does not exist. The buffer list at the vim plugin 'bufexplorer' also does not have the tilda after closing and opening vim.

In other words, it seams that the session cannot store filenames starting with tilda.

I am new to vim so here is my vimrc. If I can narrow down the issue and provide something more concrete to identify which plugin is the root cause, let me know.

"""""""""""""""" Avoid having to press two keys (shift-;) to enter a command
nmap ; :

"""""""""""""""" Speedups based on http://jeff560.tripod.com/words7.html
" avoid hh and uu as h is used for navigation u for undo
inoremap jj <Esc>
" in case of multiple windows (which should be avoided) it opens the active buffer into a new tab allowing you to see the buffer in the whole vim window until you close the tab. The buffer remains also in the previous tab.
nnoremap vv :tab split<CR>
nnoremap qq :q<CR>
" specific to vim-bookmarks
nnoremap ww :BookmarkToggle
nnoremap xx :BookmarkShowAll
" available shortcuts that can be done with one hand and are easy to remember
"nnoremap yy :q<CR>
" specific to bufexplorer
nnoremap <silent> ww :BufExplorer<CR>

"""""""""""""""" Manage size of workspace
" for vertical split in HP: set lines=60 columns=101

"""""""""""""""" Manage tab key in insert mode
filetype plugin indent on
set tabstop=2                " show existing tab with 2 spaces width
set shiftwidth=2             " when indenting with '>', use the same number of spaces width
set expandtab                " on pressing tab, insert the same number of spaces

"""""""""""""""" Manage colors and syntax highlighting
color desert                 " has a better color of comments

"""""""""""""""" Customize vim
set nowritebackup " https://github.com/ember-cli/ember-cli/issues/5311#issuecomment-170383075
set number

"""""""""""""""" Customize plugins

" specific to Taboo
hi TabLineFill term=bold cterm=bold ctermbg=0
hi TabLine ctermfg=Yellow
set sessionoptions+=tabpages,globals
cabbrev tr TabooRename

" specific to CtrlP
set wildignore+=*/node_modules/*

" specific to vim-bookmarks
let g:bookmark_no_default_key_mappings = 1
let g:bookmark_save_per_working_dir = 1

" specific to bufexplorer
let g:bufExplorerShowRelativePath=0
let g:bufExplorerShowTabBuffer=1
let g:bufExplorerSortBy='fullpath'

" specific to buffergator
let g:buffergator_suppress_keymaps = 1
nmap <tab> :BuffergatorMruCycleNext<cr>
nmap <s-tab> :BuffergatorMruCyclePrev<cr>
set hidden " https://github.com/neovim/neovim/issues/2368#issuecomment-323680533
let g:buffergator_viewport_split_policy = 'n'
let g:buffergator_autoupdate = 1
let g:buffergator_sort_regime = 'filepath'

" specific to prosession
let g:prosession_per_branch = 1

"""""""""""""""" Customize neovim if any and install plugin manager
if has("nvim")
  tnoremap jj <C-\><C-n>
  " switch between terminal splits
  tnoremap <A-h> <C-\><C-n><C-w>h
  tnoremap <A-j> <C-\><C-n><C-w>j
  tnoremap <A-k> <C-\><C-n><C-w>k
  tnoremap <A-l> <C-\><C-n><C-w>l
  " switch between non-terminal splits
  nnoremap <A-h> <C-w>h
  nnoremap <A-j> <C-w>j
  nnoremap <A-k> <C-w>k
  nnoremap <A-l> <C-w>l
  " More natural splits
  set splitbelow          " Horizontal split below current.
  set splitright          " Vertical split to right of current.

  if empty(glob('~/.local/share/nvim/site/autoload/plug.vim')) " installs plugins-manager if not installed
    silent !curl -fLo ~/.local/share/nvim/site/autoload/plug.vim --create-dirs \
      https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
    autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
  endif
else
  if empty(glob('~/.vim/autoload/plug.vim'))
    silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs \
      https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
    autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
  endif
endif

"""""""""""""""" Manage plugins
call plug#begin()

" for text editing
Plug 'gcmt/taboo.vim'
Plug 'ctrlpvim/ctrlp.vim'

Plug 'jlanzarotta/bufexplorer'
Plug 'jeetsukumaran/vim-buffergator'

Plug 'tpope/vim-obsession'         " needed for the next
Plug 'dhruvasagar/vim-prosession'  " loads obsession on vim startup

if has('nvim')
  Plug 'mklabs/split-term.vim'
endif

" for programming
Plug 'tpope/vim-projectionist'     " :A moves to the alternate file stated at .projections.json of the repo
Plug 'MattesGroeger/vim-bookmarks'
Plug 'AndrewRadev/ember_tools.vim' " Pressing gf on a specific line will open the corresponding file

call plug#end()
c5c86a commented 6 years ago

I will try to reproduce it by listing buffers with :ls and reply by the end of this month.

The author of bufexplorer replies to session issues with I personally do not use sessions so I just deleted that plugin and I am trying again:

https://github.com/jlanzarotta/bufexplorer/issues/46#issuecomment-224705330 https://github.com/jlanzarotta/bufexplorer/issues/8#issuecomment-61592951

tpope commented 6 years ago

I can tell you that back in the day, bufexplorer caused all sorts of little issues like this, and seems like a likely culprit.