Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ALE Plugin only works if I run :PlugInstall in the current vim session #613

Closed
3 of 11 tasks
joaqo opened this issue Apr 1, 2017 · 7 comments
Closed
3 of 11 tasks

Comments

@joaqo
Copy link

joaqo commented Apr 1, 2017

Hi, I've installed several plugins, including the ALE linter on my normal machine. Thats all working fine and I really love vim-plug, but after porting all my setup to a new machine, I've encountered a strange error with vim-plug + ALE linter:

When I open a python file the linter doesn't run. Nevertheless if I run :PlugInstall while on that file, and then close the installer dashboard that pops up telling me everything is already installed, the linter magically starts working in the already open python file

Also, just noticed fugitive doesn't seem to work at all. Though FZF is working fine.


VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Mar 30 2017 19:49:08)
Included patches: 1-313, 315-525
Modified by [email protected]
Compiled by [email protected]
Huge version without GUI.  Features included (+) or not (-):
+acl             +cmdline_hist    -ebcdic          +gettext         +listcmds        +mouse_sgr       +persistent_undo +smartindent     +textobjects     +wildmenu
+arabic          +cmdline_info    +emacs_tags      -hangul_input    +localmap        -mouse_sysmouse  +postscript      +startuptime     +timers          +windows
+autocmd         +comments        +eval            +iconv           -lua             +mouse_urxvt     +printer         +statusline      +title           +writebackup
-balloon_eval    +conceal         +ex_extra        +insert_expand   +menu            +mouse_xterm     +profile         -sun_workshop    -toolbar         -X11
-browse          +cryptv          +extra_search    +job             +mksession       +multi_byte      -python          +syntax          +user_commands   -xfontset
++builtin_terms  +cscope          +farsi           +jumplist        +modify_fname    +multi_lang      -python3         +tag_binary      +vertsplit       -xim
+byte_offset     +cursorbind      +file_in_path    +keymap          +mouse           -mzscheme        +quickfix        +tag_old_static  +virtualedit     -xpm
+channel         +cursorshape     +find_in_path    +lambda          -mouseshape      +netbeans_intg   +reltime         -tag_any_white   +visual          -xsmp
+cindent         +dialog_con      +float           +langmap         +mouse_dec       +num64           +rightleft       -tcl             +visualextra     -xterm_clipboard
-clientserver    +diff            +folding         +libcall         +mouse_gpm       +packages        -ruby            +termguicolors   +viminfo         -xterm_save
-clipboard       +digraphs        -footer          +linebreak       -mouse_jsbterm   +path_extra      +scrollbind      +terminfo        +vreplace
+cmdline_compl   -dnd             +fork()          +lispindent      +mouse_netterm   -perl            +signs           +termresponse    +wildignore
   system vimrc file: "$VIM/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
      user exrc file: "$HOME/.exrc"
       defaults file: "$VIMRUNTIME/defaults.vim"
  fall-back for $VIM: "/usr/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H   -Wdate-time  -g -O2 -fPIE -fstack-protector-strong -Wformat -Werror=format-security -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: gcc   -Wl,-Bsymbolic-functions -fPIE -pie -Wl,-z,relro -Wl,-z,now -Wl,--as-needed -o vim        -lm -ltinfo -lnsl  -lselinux -lacl -lattr -lgpm -ldl
  • Type:
    • Bug
    • Enhancement
    • Feature Request
    • Question
  • OS:
    • All/Other
    • Linux
    • OS X
    • Windows
  • Vim:
    • Terminal Vim
    • GVim
    • Neovim
@junegunn
Copy link
Owner

junegunn commented Apr 2, 2017

Please post your Vim configuration file.

@bencern
Copy link

bencern commented Apr 2, 2017

I got the same problem in GVim, tough the problem might be solved using :so % if Gvim launched by opening a file. It must be :PlugInstall for when I launch GVim blank.

Below is my .gvimrc file content.

set nocompatible

set laststatus=2

" ------------------------------
" gui and fonts
" ------------------------------
set guioptions-=T
set lines=40
set columns=100
set guifont=MesloLGM\ Nerd\ Font

" ------------------------------
" set tabs to space
" ------------------------------
set expandtab
set tabstop=4
set softtabstop=0
set shiftwidth=4

" -----------------------------
" set linespace
" -----------------------------
set linespace=0

" -----------------------------
" set splitting settings
" -----------------------------
set splitbelow
set splitright

" =============================
"         VimPlug-Bundles
" =============================
call plug#begin('~/.vim/plugged')

" Plug 'Valloric/YouCompleteMe'
" Plug 'sirver/ultisnips'
Plug 'sjl/Gundo.vim'

Plug 'vim-airline/vim-airline'
Plug 'morhetz/gruvbox'
Plug 'mhinz/vim-janah'
Plug 'mhinz/vim-startify'
Plug 'mhinz/vim-signify'
Plug 'myusuf3/numbers.vim'

Plug 'scrooloose/syntastic'
Plug 'honza/vim-snippets'
Plug 'tpope/vim-surround'
Plug 'scrooloose/nerdcommenter'
Plug 'lilydjwg/colorizer'
Plug 'Townk/vim-autoclose'
Plug 'vim-scripts/closetag.vim'

Plug 'wakatime/vim-wakatime'

Plug 'tpope/vim-fugitive'
Plug 'scrooloose/nerdtree'
Plug 'ctrlpvim/ctrlp.vim'
Plug 'airblade/vim-gitgutter'
Plug 'Xuyuanp/nerdtree-git-plugin'

Plug 'reedes/vim-pencil'

Plug 'ryanoasis/vim-devicons'

call plug#end()

" ----------------------------
" Syntax highlighting
" ----------------------------
set background=dark
colorscheme gruvbox
set encoding=utf-8 nobomb

" --- performance / buffer ---
set hidden
set lazyredraw
set ttyfast

" --- history / file handling ---
set history=999
set undolevels=999
set autoread

" -- backup and swap files ---
set nobackup
set nowritebackup
set noswapfile

" --- search ---
set hlsearch
set incsearch

" ============================
" Plugin Settings
" ============================

" ----------------------------
"           Airline
" ----------------------------
let g:airline_powerline_fonts=1
let g:airline#extensions#tabline#enabled=1
let g:airline#extensions#ctrlp#show_adjacent_modes=1
let g:airline#extensions#wordcount#enabled=1
let g:airline#extensions#syntastic#enabled=1
let g:airline#extensons#branch#format=1
let g:airline#extensions#tabline#buffer_idx_mode=1

" ----------------------------
"           number
" ----------------------------
let g:numbers_exclude=['tagbar', 'gundo', 'minibufexpl', 'nerdtree']
set number

" ----------------------------
"       nerd-commenter
" ----------------------------
let g:NERDSpaceDelims=1
let g:NERDCommentEmptyLines=1
let g:NERDTrimTrailingWhitespace=1

" ----------------------------
"        indent guides
" ----------------------------
let g:indent_guides_start_level=2

" ----------------------------
"        ultisnips
" ----------------------------
let g:UltiSnipsExpandTrigger="<C-Enter>"
let g:UltiSnipsJumpForwardTrigger="<C-b>"
let g:UltiSnipsJumpBackwardTrigger="<C-l>"
let g:UltiSnipsUsePythonVersion=3
let g:UltiSnipsRemoveSelectModeMappings=0

" ----------------------------
"        NerdTree
" ----------------------------
map <C-e> :NERDTreeToggle<CR>

" ----------------------------
"          Tagbar
" ----------------------------
nmap <F7> :TagbarToggle<CR>

" ----------------------------
"          Gundo
" ----------------------------
nmap <F8> :GundoToggle<CR>

" ----------------------------
"         Vim Pencil
" ----------------------------
let g:pencil#WrapModeDefault='soft'
nmap <leader>sp :SoftPencil<CR>
nmap <leader>hp :HardPencil<CR>

" ----------------------------
"          ctrlp
" ----------------------------
if isdirectory(expand("~/.vim/bundle/ctrlp.vim"))
    let g:ctrlp_working_path_mode='ra'
endif

" ----------------------------
"        Translate
" ----------------------------
map <leader>tr :!trans -t id

@joaqo
Copy link
Author

joaqo commented Apr 2, 2017

Hey @junegunn thanks for replying, really big fan of your plugins. Did some more digging today and it turns out that your FZF plug also doesn't work until I run :PlugInstall, so it looks like the problem is more generalized than I initially though. Here goes my vimrc:

call plug#begin('~/.vim/plugged')
Plug 'https://github.com/jeetsukumaran/vim-indentwise.git'
Plug 'https://github.com/tpope/vim-fugitive.git'
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
Plug 'junegunn/fzf.vim'

Plug 'https://github.com/w0rp/ale.git'
let g:ale_statusline_format = ['☀️️ %d', '🕯️ %d', '']
nmap <silent> <C-k> <Plug>(ale_previous_wrap)
nmap <silent> <C-j> <Plug>(ale_next_wrap)
" let g:ale_sign_error = '❌'
" let g:ale_sign_warning = '⭕'

Plug 'https://github.com/JamshedVesuna/vim-markdown-preview.git'
let vim_markdown_preview_github=1
let vim_markdown_preview_toggle=1
let vim_markdown_preview_hotkey='<C-m>'
let vim_markdown_preview_temp_file=1  " <- This may cause crashing on slow browsers

call plug#end()

" Run google/yapf (not really a plugin but whatever)
autocmd FileType python nnoremap <LocalLeader>= :0,$!yapf<CR>

" Ale options
let g:ale_lint_on_save = 0
let g:ale_lint_on_text_changed = 1
let g:ale_sign_column_always = 1

" =================================================================

colorscheme molokai

runtime! debian.vim
set splitbelow "donde aparecen los nuevos splits
set splitright "donde aparecen los nuevos splits

"filetype indent plugin on

" Enable folding
set foldmethod=indent
set foldlevel=99

" Makes buffers behave more like tabs, not having to save when switching
" buffers and keeping undo history when switching buffers.
set hidden

" Modify statusline
set statusline +=%f\  " relative path
set statusline +=%m\  " modified flag
set statusline +=\ %{ALEGetStatusLine()}\ \ 
set statusline +=%=%c\  " line length, right aligned

" Prevent vim from looking in included files when using ctrl+n.
" Dont know why it started doing that. Maybe fzf related?
set complete-=i


" Add recursive folders to path (**)
set path=.,/usr/include,,**

" Enable mouse
set mouse=a
if !has('nvim')
    set ttymouse=xterm2
endif

syntax on

au FileType python setlocal
    \ tabstop=8
    \ softtabstop=4
    \ shiftwidth=4
    \ expandtab
    \ autoindent
    \ fileformat=unix

au BufNewFile,BufRead *.py
    \ match ErrorMsg '\%>100v.\+'

au BufNewFile,BufRead *.js,*.html,*.css
    \ set tabstop=2 |
    \ set softtabstop=2 |
    \ set shiftwidth=2 |

"set textwidth=100
"set wildmenu
set showmatch
set number
set relativenumber
set incsearch
set tabpagemax=400
set ignorecase
map Y y$
set ruler

"" Dont store swap files
set noswapfile

" " For ALE linter plugin
" highlight clear ALEErrorSign
" highlight clear ALEWarningSign
highlight clear SignColumn

" Show filename, always
set ls=2

set lazyredraw  " Don't redraw while executing macros (good performance config)
set ttyfast     " should make scrolling faster

" Remap common typos
command WQ wq
command W w
command Wq wq
command Q q
command Wa wa

" Remap vertical find to more logical command: vsf = vert sf
cnoreabbrev <expr> vsf getcmdtype() == ":" && getcmdline() == 'vsf' ? 'vert sf' : 'vsf'

" Share clipboard with OS, it can destroy your normal yank, wtf!
set clipboard=unnamed

" Git commits format:
autocmd Filetype gitcommit setlocal spell textwidth=72

" Remap H and L (top, bottom of screen to left and right end of line)
nnoremap H ^
nnoremap L $
vnoremap H ^
vnoremap L g_

" Quick replay q macro
nnoremap Q @q

" Always show at least X lines above/below cursor
set scrolloff=2

" Same when moving up and down
nnoremap <C-u> <C-u>zz
nnoremap <C-d> <C-d>zz
nnoremap <C-f> <C-f>zz
nnoremap <C-b> <C-b>zz
vnoremap <C-u> <C-u>zz
vnoremap <C-d> <C-d>zz
vnoremap <C-f> <C-f>zz
vnoremap <C-b> <C-b>zz

" Highlight current line, leader+l to highlight, :match to unhighlight
nnoremap <silent> <Leader>l ml:execute 'match Search /\%'.line('.').'l/'<CR>

" Error times, from tim pope
set ttimeout
set ttimeoutlen=100

" Fix backspace
set backspace=indent,eol,start
"set backspace=2 " make backspace work like most other apps

" This enables "visual" wrapping
set nowrap

" Uncomment the following to have Vim jump to the last position when reopening a file
if has("autocmd")
  au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
endif

" FZF
nnoremap <C-b> :Buffers<CR>
nnoremap <C-g>g :Ag<CR>
nnoremap <C-g>c :Commands<CR>
nnoremap <C-g>h :History<CR>  "Not sure which one to use
nnoremap <C-n> :History<CR>   "Not sure which one to use
nnoremap <C-f>l :BLines<CR>
nnoremap <C-p> :Files<CR>

" Emoji stuff I havent actually tested lol
if !has('nvim')     " does not work on neovim
  set emoji         " treat emojis 😄  as full width characters
  set termguicolors " enable true colors - uses gui colors - disable `set -g default-terminal "screen-256color"` from .tmux.conf!
  let &t_8f = "\<Esc>[38;2;%lu;%lu;%lum"
  let &t_8b = "\<Esc>[48;2;%lu;%lu;%lum"
end

" This fixes problem with background being bright on lines with text and black
" on lines without text, when using vim inside tmux, and with true color
set t_ut=
" https://github.com/mhartington/oceanic-next/issues/40
" https://github.com/vim/vim/issues/804
" http://stackoverflow.com/questions/6427650/vim-in-tmux-background-color-changes-when-paging/15095377#15095377

" :w!! 
" write the file when you accidentally opened it without the right (root) privileges
cmap w!! w !sudo tee % > /dev/null

@junegunn
Copy link
Owner

junegunn commented Apr 3, 2017

@bencern You have to put plug block in .vimrc not .gvimrc, see #540 (comment)

@junegunn
Copy link
Owner

junegunn commented Apr 3, 2017

@joaqo A common mistake is not having plug#end() in the right place, but your configuration looks fine. I actually copy-pasted a few relevant lines from your configuration and everything works as expected.

call plug#begin('~/.vim/plugged2')
Plug 'https://github.com/jeetsukumaran/vim-indentwise.git'
Plug 'https://github.com/tpope/vim-fugitive.git'

Plug 'https://github.com/w0rp/ale.git'
let g:ale_statusline_format = ['☀️️ %d', '🕯️ %d', '']
nmap <silent> <C-k> <Plug>(ale_previous_wrap)
nmap <silent> <C-j> <Plug>(ale_next_wrap)
" let g:ale_sign_error = '❌'
" let g:ale_sign_warning = '⭕'

Plug 'https://github.com/JamshedVesuna/vim-markdown-preview.git'
let vim_markdown_preview_github=1
let vim_markdown_preview_toggle=1
let vim_markdown_preview_hotkey='<C-m>'
let vim_markdown_preview_temp_file=1  " <- This may cause crashing on slow browsers

call plug#end()

So I believe the problem's caused by some other configuration you have below (runtime! debian.vim looks suspicious). You can add finish just after call plug#end() line, and see if the problem still persists.

@bencern
Copy link

bencern commented Apr 3, 2017

Thanks @junegunn , everything work fine after moving those settings into .vimrc

@joaqo
Copy link
Author

joaqo commented Apr 9, 2017

@junegunn hey you were absolutely right, removing that debian runtime line fixed the problem. Thanks a lot!

@joaqo joaqo closed this as completed Apr 9, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants