Skip to content
Permalink
Browse files

somewhat sane settings for working with fold, conceals, and cursor po…

…sition in Vim
  • Loading branch information...
ipatch committed Jan 26, 2019
1 parent ce048dd commit 587873d29b058277d2ae7ae8f2bb6fc7faef7f57
@@ -745,7 +745,7 @@ curl https://raw.githubusercontent.com/ipatch/dotfiles/master/install.sh | /bin/

### Neovim

- [ ] Vim Sesssions, ~~Folds,~~ and Conceals will be the death of me 💀
- [x] ~~Vim Sesssions, Folds, and Conceals will be the death of me~~ 💀

<a id="contact"></a>

@@ -22,7 +22,7 @@ let g:indentLine_bufNameExclude=['']
if has('nvim') && !has('nvim-0.2.2')
" Older versions of Neovim set the runtime path incorrectly, causing problems
" with JSON.
let g:indentLine_fileTypeExclude=['help', 'json', 'reason', '1', '3', '5', '6', '7', '8']
let g:indentLine_fileTypeExclude=['help', 'json', 'reason', '1', '3', '5', '6', '7', '8', 'markdown']
else
let g:indentLine_fileTypeExclude=['help', 'reason', '1', '3', '5', '6', '7', '8']
let g:indentLine_fileTypeExclude=['help', 'reason', '1', '3', '5', '6', '7', '8', 'markdown']
endif
@@ -1,4 +1,5 @@
if has('autocmd')

"""""""""""""""""""""""""""""
" autocommand - update buffer if file has changed on window focus
""
@@ -8,18 +9,15 @@ if has('autocmd')
augroup END

""""""""""""""""""""""""""""""
" autocommand - `line_return`
" NOTE: return to the line number when reopening a buffer / file
" NOTE: buffer does not need saving to remember position 👍
" NOTE: the line position is written to `~/.viminfo`
" autocommand > `line_return`
" NOTE: return to the line number when reopening a buffer / file & no save required, position is saved to `~/.viminfo`
""
augroup line_return
autocmd BufReadPost *
\ if line("'\"") > 1 && line("'\"") <= line("$") |
\ execute "normal! g`\"" |
\ endif
augroup resCur
autocmd!
autocmd BufReadPost * call setpos(".", getpos("'\""))
augroup END


""""""""""""""""""""""""""""""
" autocommand - `conceal_return`
" NOTE: a simple command / function to resume conceal settings when reopening a
@@ -32,4 +30,3 @@ if has('autocmd')
" buffer
""
endif

@@ -95,18 +95,20 @@ set smarttab " <tab>/<BS> indent/dedent in leading whitespace
set scrolloff=3 " start scrolling 3 lines before edge of viewport

"""""""""""""""""""""""""""""
" Settings - Visual Tabs
" Settings > Visual Tabs
""
" NOTE: tabs AREN"T buffers, always try and use buffers when possible.
set showtabline=0 " only show if 2 or more tabs.

""""""""""""""""""""""""""""""
" settings - sessions
" settings > sessions
""
set sessionoptions=buffers,folds,winsize,blank,slash,unix,conceal
" NOTE: `localoptions` appears to save conceal settings used with `indentLine`
" 🚨 NOTE: `localoptions` BREAKS return cursor position
set sessionoptions=buffers,folds,winsize,blank,slash,unix,localoptions

""""""""""""""""""""""""""""""
" settings - views - folds, etc etc
" settings > gutter
""
set foldcolumn=2 " width of gutter outlining folds

@@ -130,7 +132,7 @@ if v:version > 703 || v:version == 703 && has('patch541')
endif

""""""""""""""""""""""""""""""
" backups - settings
" settings > backups
""
if exists('$SUDO_USER') " setup backup files for Vim & Neovim
set nobackup " don't create backup files for root
@@ -143,7 +145,7 @@ else
endif

""""""""""""""""""""""""""""""
" swap - settings
" settings > swap files
""
if exists('$SUDO_USER') " setup swap files for Vim & Neovim
set noswapfile " don't create root owned swap files
@@ -155,7 +157,7 @@ else
endif

""""""""""""""""""""""""""""""
" folding - settings
" settings > folds
""
if has('folding')
if has('windows')
@@ -184,7 +186,7 @@ endif
" set textwidth=80 " automatically hard wrap at 80 columns - NO THANKYOU!

""""""""""""""""""""""""""""""
" undo - settings
" settings > undo files
""
if has('persistent_undo')
if exists('$SUDO_USER')
@@ -199,26 +201,28 @@ if has('persistent_undo')
endif

""""""""""""""""""""""""""""""
" session - settings
" settings > sessions
""

""""""""""""""""""""""""""""""
" view - settings
" NOTE: `~/.vim/tmp/views` is the default directory to save folds
" settings > views
" NOTE: `~/.vim/tmp/views` is the default dir to save folds
""
" `== 2` checks for an exact match of `mkview`
if exists(':mkview') == 2
" echom 'making views is a thing'
if exists('$SUDO_USER')
" no view file
" no view file(s) for super users
set viewdir=
else
set viewdir=~/.vim/tmp/views
au BufWinLeave *.* silent! mkview
au BufWinEnter *.* silent! loadview
" Save fold settings.
" Don't save options.
set viewoptions-=options
" set viewoptions-=options
" set viewoptions=options,folds
" set viewoptions=folds
endif
endif

@@ -113,7 +113,7 @@ endfunction
nnoremap <silent> ` :call ToggleConcealLevel()<CR>

" set default conceal level
" set conceallevel=0 " DO NOT conceal any text
set conceallevel=0 " DO NOT conceal any text

"""""""""""""""""""""""""""""
" netrw - file explorer

0 comments on commit 587873d

Please sign in to comment.
You can’t perform that action at this time.