1

VIM doesn't conceal text, for example tex. Here's my vimrc:

"commands for vim-plug 
"PlugInstall - installs plugs  
"PlugUpdate - updates plugs 
"PlugClean - remove unused directories 
"PlugUpgrade - upgrades vim-plug itself 
"PlugStatus - status of plugs
"vim-plug installer

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

call plug#begin('~/.vim/plugged')

Plug 'itchyny/lightline.vim' "lightline
Plug 'altercation/vim-colors-solarized' "solarized theme
Plug 'scrooloose/nerdtree' "NERDTree
Plug 'scrooloose/nerdcommenter' "NerdCommenter
Plug 'majutsushi/tagbar' "tagbar
Plug 'lervag/vimtex' "for latex 

call plug#end()

set encoding=utf-8

"settings for lightline 
set laststatus=2 "displays lightline
set noshowmode "vim's mode is not show belove lightline 

"changes colorscheme
let g:lightline = { 
    \ 'colorscheme': 'solarized', 
    \}

"settings for colorscheme 
"after installing
"$ cd vim-colors-solarized/colors
"$ mv solarized.vim ~/.vim/colors/
colorscheme solarized
set background=dark 

"settings for NERDTree
"autocmd vimenter * NERDTree "opening NERDTree with every vim start
nmap <F8> :NERDTreeToggle<CR>
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif "closing NerdTree i

nmap <F9> :TagbarToggle<CR>

let g:tex_flavor='latex'
let g:vimtex_view_method='zathura'
set conceallevel=2
let g:tex_conceal='abdmg'
"-------------------------------------------------------------------------------------------------------------
"                                             no-plug setup 
"-------------------------------------------------------------------------------------------------------------

"split navigation CTRL + H/J/K/L
nnoremap <C-J> <C-W><C-J> 
nnoremap <C-K> <C-W><C-K>
nnoremap <C-L> <C-W><C-L>
nnoremap <C-H> <C-W><C-H>

syntax enable 
set tabstop=4 "number of visual spaces per TAB 
set shiftwidth=4
set softtabstop=4 "number of spaces in TAB when editing 
set expandtab " TABs are spaces 
filetype indent on 
filetype plugin on
autocmd FileType cpp setlocal commentstring=//%s
set showmatch 
set splitbelow
set splitright
set lazyredraw
set wildmenu

set hlsearch
set incsearch
nmap <silent> ,/ :nohlsearch<CR>

" space open/closes folds
nnoremap <space> za

set foldmethod=manual
augroup remember_folds
    autocmd!
    autocmd BufWinLeave * mkview
    autocmd BufWinEnter * silent! loadview
augroup END

"line numbers
set number relativenumber

augroup numbertoggle
autocmd!
autocmd BufEnter,FocusGained,InsertLeave * set relativenumber
autocmd BufLeave,FocusLost,InsertEnter   * set norelativenumber
augroup END

"it's finnaly time to learn hjkl
map <up> <nop>
map <down> <nop>
map <left> <nop>
map <right> <nop>

With khzaw/vim-conceal conceal works in python.

any ideas?

  • Check if you can find +conceal or something like that in $ vim --version command from the shell or :version from the vim instance. This will tell if you have compiled vim with conceal feature or not. On second thought, just post the whole output of :version here. – klaus Mar 26 at 12:18
  • What do you mean with it doesn't conceal text? What have you tried to conceal Tex? Have you read :h ft-syn-tex (or more specifically :h g:tex_conceal?) – Christian Brabandt Mar 26 at 12:27
  • When I see this not so minimal vimrc, you should be made aware of the question How do I debug my vimrc file?. This explains how a problem can be isolated by bisecting the vimrc. This should be one of the first debugging steps before raising a question. – Hotschke Mar 26 at 13:14
  • I cannot reproduce the example given by the OP. Also please note, that you did not provide a minimal working example that reproduces your problem. Just throwing it at the vim issue tracker and make others figure your problem out is not really helpful. If you really think this is a vim bug, please come up with a minimal example. – Christian Brabandt Mar 26 at 14:34
-1

You should remove augroup remember_folds commands

  • 6
    Hi, thanks for contributing. You should however explain, why this is needed. – Christian Brabandt Mar 26 at 12:50
  • I had the same problem once and I tried removing random things from vimrc. I have no idea why it works tho – w0nsh Mar 26 at 14:25
3

The reason removing augroup remember_folds helped was given here: https://github.com/vim/vim/issues/4175. Basically neither mkview nor loadview remember filetype nor syntax. Quick fix to that problem is modyfing those commands. The augroup remember_folds should look like this:

augroup remember_folds
    autocmd!
    autocmd BufWinLeave ?* mkview | filetype detect
    autocmd BufWinEnter ?* silent loadview | filetype detect
augroup END

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.