Closed mechanicles closed 4 years ago
Works for me, I doubt it's an issue of eleline.vim as it has been stable for quite a while, no changes about the feature of showing git branch in the past few months. Provide a minimal vimrc and your detailed local environment if you can reproduce.
I tried to create/set a minimal vimrc but It was not working properly and sorry for that.
This is my .vimrc
file:
" IMPORTANT FOR CANCELLING/ABORTING GIT COMMIT
" ALWAYS USE `:cq`.
" IMPORTANT FOR WRAPPING THE TEXT IN MARKDWON
" ALWAYS USE `gq`.
if has('vim_starting')
set nocompatible " Be iMproved
endif
" VIM-PLUG
call plug#begin('~/.vim/plugged')
" PRODUCTIVITY {{
Plug 'Yggdroot/indentLine'
Plug 'scrooloose/nerdtree'
Plug 'Xuyuanp/nerdtree-git-plugin'
Plug 'majutsushi/tagbar', { 'on': 'TagbarToggle' }
Plug 'easymotion/vim-easymotion'
Plug 'szw/vim-maximizer'
Plug 'junegunn/vim-easy-align'
Plug 'mileszs/ack.vim', { 'on': 'Ack' }
Plug 'maxbrunsfeld/vim-yankstack'
Plug 'rhysd/clever-f.vim'
Plug 'terryma/vim-multiple-cursors'
Plug 'wellle/targets.vim'
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
Plug 'junegunn/fzf.vim'
Plug 'mbbill/undotree'
Plug 'rhysd/committia.vim'
Plug 'AndrewRadev/tagalong.vim'
Plug 'liuchengxu/vim-clap'
Plug 'AaronLasseigne/yank-code'
Plug 'rhysd/vim-grammarous'
Plug 'rizzatti/dash.vim'
Plug 'janko-m/vim-test'
Plug 'dense-analysis/ale'
" }}
" Method lookup/snippets {{
Plug 'honza/vim-snippets'
Plug 'neoclide/coc.nvim', {'branch': 'release'}
" }}
" RUBY {{
Plug 'sunaku/vim-ruby-minitest'
Plug 'thoughtbot/vim-rspec'
" }}
" ELIXIR {{
Plug 'elixir-editors/vim-elixir'
Plug 'slashmili/alchemist.vim'
" }}
" TPOPE's must have plugins {{
Plug 'tpope/vim-repeat'
Plug 'tpope/vim-surround'
Plug 'tpope/vim-endwise'
Plug 'tpope/vim-unimpaired'
Plug 'tpope/vim-commentary'
Plug 'tpope/vim-git'
Plug 'tpope/vim-fugitive'
Plug 'tpope/vim-bundler'
Plug 'tpope/vim-rake'
Plug 'tpope/vim-rails'
Plug 'tpope/vim-dispatch'
Plug 'tpope/vim-sleuth'
Plug 'tpope/vim-dadbod'
" }}
" More git plugins dependent on 'tpope/vim-fugitive' {{
Plug 'junegunn/gv.vim'
" }}
" JAVASCRIPT {{
Plug 'pangloss/vim-javascript'
Plug 'leafoftree/vim-vue-plugin'
Plug 'kchmck/vim-coffee-script'
Plug 'prettier/vim-prettier', {
\ 'do': 'yarn install',
\ 'for': ['javascript', 'typescript', 'css', 'less', 'scss', 'json', 'graphql', 'markdown', 'vue', 'yaml', 'html'] }
" }}
" TEMPLATES {{
Plug 'slim-template/vim-slim'
" }}
" COLORSCHEME {{
Plug 'w0ng/vim-hybrid'
Plug 'nanotech/jellybeans.vim'
Plug 'tomasr/molokai'
Plug 'joshdick/onedark.vim'
Plug 'chriskempson/base16-vim'
Plug 'morhetz/gruvbox'
Plug 'danilo-augusto/vim-afterglow'
Plug 'kreeger/benlight' " Twilight kind of theme
Plug 'cocopon/iceberg.vim'
Plug 'liuchengxu/space-vim-dark'
" }}
" ENHANCEMENT {{
if v:version >= 703
Plug 'mhinz/vim-signify'
endif
Plug 'pechorin/any-jump.vim'
Plug 'airblade/vim-rooter'
Plug 'wincent/terminus'
if !has('nvim')
Plug 'rhysd/vim-healthcheck'
endif
Plug 'JamshedVesuna/vim-markdown-preview'
Plug 'thinca/vim-quickrun' " Ruby code runnner
Plug 'liuchengxu/eleline.vim'
Plug 'kristijanhusak/vim-dadbod-ui' " depend on tpope/vim-dadbod
" }}
" EXTRA {{
Plug 'lifepillar/vim-cheat40'
Plug 'chrisbra/csv.vim'
" Plug 'elzr/vim-json'
Plug 'AndrewRadev/quickpeek.vim'
Plug 'wakatime/vim-wakatime'
" }}
" FUN {{
" Plug 'chrisbra/unicode.vim', { 'on': ['<plug>(UnicodeComplete)', '<plug>(UnicodeGA)', 'UnicodeTable'] }
" }}
call plug#end()
" Time limit of each task in seconds for vim-plug
let g:plug_timeout = 100
let g:make = 'gmake'
if exists('make')
let g:make = 'make'
endif
if has('nvim')
runtime! macros/matchit.vim
else
" VIM HAS ITS VERY OWN'S 'ADD-PACKAGE' FEATURE:
" This plugin makes the '%' command jump to matching HTML tags, if/else/endif in Vim scripts, etc.
packadd! matchit
endif
let no_buffers_menu = 1
" COLORSHEME SETTINGS
if has('gui_running')
if has("gui_macvim")
set macligatures
set guifont=JetBrains\ Mono:h15
" let g:onedark_terminal_italics = 1 " I love italic for comments
" space-vim-dark {{
let g:space_vim_dark_background = 234
colorscheme space-vim-dark
" }}
endif
else
set termguicolors
colorscheme hybrid
if $COLORTERM == 'gnome-terminal'
set term=gnome-256color
else
if $TERM == 'xterm'
set term=xterm-256color
endif
endif
endif
" Basic setup
syntax enable
set clipboard=unnamed
set number " show line numbers
set ruler " show the cursor position all the time
set title " show file in titlebar
set encoding=utf-8 " set default encoding to UTF-8
set history=50 " keep 50 lines of command line history
if !has('nvim')
set ttymouse=xterm2
endif
set mouse=a " automatically enable mouse usage in normal mode.
set mousehide " hide the mouse cursor while typing
set textwidth=120
set showcmd " display incomplete commands
set wildmenu " visual autocomplete for command menu
set ttyfast " faster redrawing.
set lazyredraw " don't redraw while executing macros (good performance config)
set showmatch " show matching brackets
set showmode " show current mode in command-line.
set matchtime=2 " show matching bracket for 0.2 seconds
set autoindent " always set auto indenting on
set smartindent
set display=lastline " show as much as possible of the last line.
set scrolloff=1 " minimum lines to keep above and below cursor
set hidden " switch between buffers without having to save first.
set foldenable " auto fold code
set pastetoggle=<F2>
set confirm " get a dialog when :q, :w, or :wq fails
set cursorline " find the current line quickly.
set wrapscan " searches wrap around end-of-file
set bomb
set binary
set synmaxcol=256 " This helps to avoid very slow redrawing for long lines
set updatetime=100 " delay time. Useful for showing git signs
set undodir=~/.vim/undodir
set undofile
" Whitespace
set nowrap " don't wrap text
set tabstop=2 " tab spacing
set expandtab " use spaces instead of tabs
set softtabstop=2 " unify
set shiftwidth=2 " indent/outdent by 2 columns
set smarttab " use tabs at the start of a line, spaces elsewhere
set backspace=indent,eol,start " backspace through everything in insert mode
set list " show invisible characters
set nojoinspaces " Use only 1 space after "." when joining lines, not 2
" Don't give |ins-completion-menu| messages.
set shortmess+=c
" Disable swap files; systems don't crash that often these days
set updatecount=0
set showbreak=↪\
" Searching
set hlsearch " highlight matches
set incsearch " incremental searching
set ignorecase " searches are case insensitive...
set smartcase " unless they contain at least one capital letter
set gdefault " have :s///g flag by default on
" Time out on key codes but not mappings. basically this makes terminal vim work sanely.
set notimeout
set ttimeout
set ttimeoutlen=100
" Tab completion
set wildmode=list:longest,list:full
" Disable output and vcs files
set wildignore+=*.o,*.out,*.obj,.git,*.rbc,*.rbo,*.class,.svn,*.gem,tags,.fugitiveblame
" Disable archive files
set wildignore+=*.zip,*.tar.gz,*.tar.bz2,*.rar,*.tar.xz
" Ignore bundler and sass cache
set wildignore+=*/vendor/gems/*,*/vendor/cache/*,*/.bundle/*,*/.sass-cache/*
" Ignore rails temporary asset caches
set wildignore+=*/tmp/*,*/solr/*,*/coverage/*,*/features/*,*/public/uploads/*
" Disable temp and backup files
set wildignore+=*.swp,*~,._*,tags
" Backup and swap files
set nobackup " turn backup off, since most stuff is in SVN, Git etc anyway...
set nowb " no writebackup
set noswapfile
" Better display for messages.
set cmdheight=2
set fileformats=unix,dos,mac
" Open new split panes to right and bottom, which feels more natural
set splitright
set splitbelow
" Mac's option key for yankring
if has('gui_running')
set macmeta
endif
" Autocomplete with dictionary words when spell check is on
set complete+=kspell
" Always use vertical diffs
set diffopt+=vertical
" IndentLine {{
let g:indentLine_char = '┊'
" }}
" vim-markdown-preview {{
let vim_markdown_preview_github=1
" }}
" clever-f.vim plugin {{
let g:clever_f_ignore_case = 1
" }}
" For leafoftree/vim-vue-plugin {{
let g:vim_vue_plugin_load_full_syntax = 1
" }}
" For AndrewRadev/tagalong.vim
let g:tagalong_mappings = [{'c': '<leader>c'}, {'C': '<leader>C'}, 'v', 'i', 'a']
" make test commands execute using dispatch.vim
let test#strategy = "iterm"
" Setting for AndrewRadev/quickpeek.vim
let g:quickpeek_auto = v:true
" TENDERLOVE'S SETTINGS
if has("terminal")
map <Leader>tt :terminal ++close<cr>
tnoremap <Esc> <C-W>N
endif
set tags+=.git/tags
" INDICATOR CHARS
if has('multi_byte') && &encoding ==# 'utf-8'
let &listchars = 'tab:▸ ,extends:❯,precedes:❮,nbsp:±'
else
let &listchars = 'tab:> ,extends:>,precedes:<,nbsp:.'
endif
if has("statusline") && !&cp
set laststatus=2 " always show the status bar
" Use it when we don't want to use statusline framework {{
" set statusline=%f\ %m\ %r " filename, modified, readonly
" set statusline+=%= " switch to the right side
" set statusline+=\ %l/%L[%p%%] " current line/total lines
" set statusline+=\ %3v " current column
" set statusline+=\ %Y\ %{FugitiveStatusline()}
" }}
endif
" The silver searcher (Faster than the ack)
" Invoke ag using ack.vim
if executable("ag")
" Use Ag over grep
set grepprg=ag\ --nogroup\ --nocolor
let g:ackprg = 'ag --vimgrep'
let g:agprg="ag --column"
endif
let g:mapleader = ","
" TREAT <li> AND <p> TAGS LIKE THE BLOCK TAGS THEY ARE
let g:html_indent_tags = 'li\|p'
" Exclude Javascript files in :Rtags via rails.vim due to warnings when parsing
let g:Tlist_Ctags_Cmd="ctags --exclude='*.js'"
" Better key bindings for UltiSnipsExpandTrigger {{
" let g:UltiSnipsExpandTrigger = "<nop>"
" let g:UltiSnipsJumpForwardTrigger="<c-b>"
" let g:UltiSnipsJumpBackwardTrigger="<c-z>"
" let g:UltiSnipsEditSplit="vertical"
" }}
" Every time you open a git object using fugitive it creates a new buffer.
" This means that your buffer listing can quickly become swamped with
" fugitive buffers. This prevents this from becomming an issue:
autocmd BufReadPost fugitive://* set bufhidden=delete
let g:github_enterprise_urls = ['https://github.com']
" vim-multiple-cursors plugin {{
" Turn off default key mappings
let g:multi_cursor_use_default_mapping=0
" Ctrl-n, Ctrl-p, Ctrl-x, and <Esc> are mapped in the special multicursor
" mode once you've added at least one virtual cursor to the buffer
let g:multi_cursor_next_key='<C-n>'
let g:multi_cursor_prev_key='<C-p>'
let g:multi_cursor_skip_key='<C-x>'
let g:multi_cursor_quit_key='<Esc>'
" }}
" RSpec.vim mappings {{
map <Leader>t :call RunCurrentSpecFile()<CR>
map <Leader>s :call RunNearestSpec()<CR>
map <Leader>l :call RunLastSpec()<CR>
map <Leader>a :call RunAllSpecs()<CR>
let g:rspec_command = "bundle exec rspec {spec}"
let g:rspec_runner = "os_x_iterm2"
" }}
" ale plugin {{
let g:ale_linters = {
\ 'ruby': ['rubocop', 'standardrb'],
\ 'javascript': ['eslint'],
\}
let g:ale_fixers = {
\ 'ruby': ['rubocop'],
\}
" }}
let g:ale_fix_on_save = 1
let g:ale_echo_msg_error_str = 'E'
let g:ale_echo_msg_warning_str = 'W'
let g:ale_echo_msg_format = '[%linter%] %s [%severity%]'
nmap <silent> <C-k> <Plug>(ale_previous_wrap)
nmap <silent> <C-j> <Plug>(ale_next_wrap)
" rename current file (thanks Gary Bernhardt)
function! RenameFile()
let old_name = expand('%')
let new_name = input('New file name: ', expand('%'), 'file')
if new_name != '' && new_name != old_name
exec ':saveas ' . new_name
exec ':silent !rm ' . old_name
redraw!
endif
endfunction
command! RENAME call RenameFile()
" Tagbar {{
let g:tagbar_type_ruby = {
\ 'kinds' : [
\ 'm:modules',
\ 'c:classes',
\ 'd:describes',
\ 'C:contexts',
\ 'f:methods',
\ 'F:singleton methods'
\ ]
\ }
" }}
"Highlight column for 119 characters.
if exists('+colorcolumn')
set colorcolumn=+1
else
au BufWinEnter * let w:m2=matchadd('ErrorMsg', '\%>80.\+', -1)
endif
" Quicker window movement
nnoremap <C-j> <C-w>j
nnoremap <C-k> <C-w>k
nnoremap <C-h> <C-w>h
nnoremap <C-l> <C-w>l
" Show next matched string at the center of screen
nnoremap n nzz
nnoremap N Nzz
" FZF mappings {{
nnoremap <c-b> :Buffers<cr>
nnoremap <c-p> :GFiles<cr>
" }}
" Puts the calller (Thanks to @tenderlove)
nnoremap <leader>wtf oputs "#" * 90<c-m>puts caller<c-m>puts "#" * 90<esc>
nnoremap \ :Ack<SPACE>
" Disable 'Entering Ex mode'
map Q <Nop>
map gs <Nop>
" MOVEMENT
nnoremap j gj
nnoremap k gk
vnoremap j gj
vnoremap k gk
nnoremap gj j
nnoremap gk k
vnoremap gj j
vnoremap gk k
" highlight last inserted text
nnoremap gV `[v`]
" Ruby hash syntax conversion
nnoremap <F12> :%s/:\([^ ]*\)\(\s*\)=>/\1:/g<return>
" EASY COPY AND PASTE
" yank to system clipboard
map <leader>y "*y
" paste lines from unnamed register and fix indentation
nmap <leader>p pV`]=
nmap <leader>P PV`]=
" Index ctags from any project, including those outside Rails
map <Leader>ct :!ctags --tag-relative=yes --extras=+f -Rf.git/tags --exclude=.git --exclude=pkg --exclude=.ext --languages=-javascript,sql<cr><cr>
" NERDTree {{
let g:NERDTreeHijackNetrw=1
let NERDTreeMinimalUI=1
let g:NERDTreeChDirMode=2
let g:NERDTreeIgnore=['\.rbc$', '\~$', '\.pyc$', '\.db$', '\.sqlite$', '__pycache__']
let g:NERDTreeShowBookmarks=1
let g:NERDTreeMapOpenInTabSilent = '<RightMouse>'
map <Leader>n :NERDTreeToggle<CR>
" }}
map <c-a> ggVG
" format the entire file
nmap <leader>fef ggVG=
" upper/lower word
nmap <leader>u mQviwU`Q
nmap <leader>l mQviwu`Q
" upper/lower first char of word
nmap <leader>U mQgewvU`Q
nmap <leader>L mQgewvu`Q
" find Git merge conflict markers
nmap <silent> <leader>fc <ESC>/\v^[<=>]{7}( .*\|$)<CR>
" Toggle hlsearch with <leader>hs
nmap <leader>hs :set hlsearch! hlsearch?<CR>
" EasyAlign {{
" Start interactive EasyAlign in visual mode (e.g. vipga)
xmap ga <Plug>(EasyAlign)
" Start interactive EasyAlign for a motion/text object (e.g. gaip)
nmap ga <Plug>(EasyAlign)
" }}
" Adjust viewports to the same size
map <Leader>= <C-w>=
" vim-maximizer (Zoom) {{
noremap <Leader>zw :MaximizerToggle<CR>
vnoremap <Leader>zw :MaximizerToggle<CR>gv
inoremap <Leader>zw <C-o>:MaximizerToggle<CR>
" }}
" TagbarToggle {{
nnoremap <Leader>rt :TagbarToggle<CR>
let g:tagbar_autofocus = 1
" }}
" disable cursor keys in normal mode
map <Left> :echoe "Use h"<cr>
map <Right> :echoe "Use l"<cr>
map <Up> :echoe "Use k"<cr>
map <Down> :echoe "Use j"<cr>
"Make shift-insert work like in Xterm
map <S-Insert> <MiddleMouse>
map! <S-Insert> <MiddleMouse>
" In command-line mode, C-a jumps to beginning (to match C-e)
cnoremap <C-a> <Home>
" Exit insert mode without using Esc
inoremap jj <Esc>
" Easy edit/open commands
command! EditVim :edit ~/.vimrc
command! EditBash :edit ~/.bashrc
function! s:setWrapping()
set wrap
set wrapmargin=2
set textwidth=80
endfunction
if has("autocmd")
" In Makefiles, use real tabs, not tabs expanded to spaces
au FileType {make,gitconfig} set noexpandtab
" Make sure all markdown files have the correct filetype set and setup wrapping
au BufRead,BufNewFile *.{md,markdown,mdown,mkd,mkdn,txt} setf markdown | call s:setWrapping()
" Treat JSON files like JavaScript
au BufNewFile,BufRead *.json setf javascript
" Better commit message
au Filetype gitcommit setlocal spell textwidth=72
" For all text files set 'textwidth' to 80 characters.
au Filetype text setlocal textwidth=80
" Enable spellchecking for Markdown
au FileType markdown setlocal spell
" Opnes NERDTree automatically when vim starts up if no files were specified
autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif
au FileType javascript set formatprg=prettier\ --stdin
endif
" Coc.nvim settings {{
let g:coc_global_extensions = [
\ 'coc-pairs',
\ 'coc-emoji',
\ 'coc-snippets',
\ 'coc-solargraph',
\ 'coc-json',
\ 'coc-css',
\ 'coc-explorer',
\ ]
" space + g + d => definition
" space + g + r => references
nmap <silent> gd <Plug>(coc-definition)
nmap <silent> gr <Plug>(coc-references)
nnoremap <silent> K :call <SID>show_documentation()<CR>
function! s:show_documentation()
if (index(['vim','help'], &filetype) >= 0)
execute 'h '.expand('<cword>')
else
call CocAction('doHover')
endif
endfunction
" use <tab> for trigger completion and navigate to the next complete item
function! s:check_back_space() abort
let col = col('.') - 1
return !col || getline('.')[col - 1] =~ '\s'
endfunction
inoremap <silent><expr> <Tab>
\ pumvisible() ? "\<C-n>" :
\ <SID>check_back_space() ? "\<Tab>" :
\ coc#refresh()
" use <c-space>for trigger completion
inoremap <silent><expr> <c-space> coc#refresh()
" use <Tab> and <S-Tab> to navigate the completion list:
inoremap <expr> <Tab> pumvisible() ? "\<C-n>" : "\<Tab>"
inoremap <expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>"
" use <cr> to confirm completion
inoremap <expr> <cr> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>"
" }}
" tpope/vim-endwise {{
" This is added so that coc.nvim's confirm conpletion will work
" on clicking <cr> (enter) key
let g:endwise_no_mappings = 1
" }}
" any-jump.vim {{
let g:any_jump_search_prefered_engine = 'ag'
let g:any_jump_preview_lines_count = 10
let g:any_jump_ignored_files = ['*.tmp', '*.temp', '*.log']
" }}
" space-vim-dark {{
hi Normal ctermbg=NONE guibg=NONE
hi LineNr ctermbg=NONE guibg=NONE
hi SignColumn ctermbg=NONE guibg=NONE
hi Comment guifg=#5C6370 ctermfg=59
" }}
" coc-explorer {{
" nmap <space>e :CocCommand explorer<CR>
" nmap <Leader>n :CocCommand explorer<CR>
" }}
" coc-yank {{
nnoremap <silent> <space>y :<C-u>CocList -A --normal yank<cr>
" }}
source ~/.local_vimrc
" FIX CONSTANT SPELLING MISTAKES
" Copy content from https://raw.githubusercontent.com/moshahmed/vim/master/thesaurus/thesaurii.txt
" and in this file /Users/yanis/thesaurus/words.txt
set thesaurus+=/Users/yanis/thesaurus/words.txt
iab Acheive Achieve
iab acheive achieve
iab Alos Also
iab alos also
iab Aslo Also
iab aslo also
iab Becuase Because
iab becuase because
iab Bianries Binaries
iab Charcter Character
iab charcter character
iab Charcters Characters
iab charcters characters
iab Seperate Separate
iab seperate separate
iab biding binding
iab binging binding
iab biging binding
iab bindng binding
iab bindging binding
iab bindgin binding
iab gindin binding
iab bindin binding
iab bindign binding
iab attachemnts attachments
iab attachemnt attachment
iab udpate update
See if the latest commit works for you.
@liuchengxu Great, it worked. Thanks for your quick fix. 😀
Hi,
I have been using this plugin from last few months. Initially, it was showing me a proper git branch name in the statusline but now not sure why it is not showing for now.
I am using these git plugins 'tpope/vim-git', 'tpope/vim-fugitive', and 'mhinz/vim-signify'. I use MacVim and not nvim.