I can't seem to make any xml.vim plugin work for my vim setup. I have tried two (https://www.vim.org/scripts/script.php?script_id=1397 and its predecessor https://www.vim.org/scripts/script.php?script_id=301). They seem totally nonfunctional. I have tried to view their documentation from within vim (:help xml C-d), and nothing appears except the default xml syntax help.
I have been installing them using pathogen, the standard way (e.g. git clone https://github.com/sukima/xmledit.git ~/.vim/bundle/xmledit). After installation, I have tried opening a test.xml file to load helptext, with no results.
I saw the other question posted here with no resolution, and it didn't help: turn on xml.vim ftplugin in vim
So, does anyone know why this is going wrong? This is running on Ubuntu through Windows Subsystem for Linux, but I have other working plugins (tslime and vim-slime).
Edit: After looking at this some more, I tried :scriptnames and the plugin (currently xmledit) doesn't appear to be in it, although the bundle/xmledit directory is in the runtimepath. Here are the contents of bundle/xmledit:
xmledit/
├── build.vim
├── doc
│ └── xml-plugin.txt
├── ftplugin
│ ├── html.vim
│ ├── php.vim
│ ├── xhtml.vim
│ └── xml.vim
├── Makefile
├── README.mkd
└── tests
├── Gemfile
├── Gemfile.lock
├── Rakefile
├── README.md
└── spec
├── spec_helper.rb
└── xmledit_spec.rb
vim version: 7.4. included patches: 1-1689, extra patches: 8.0.0056
.vimrc:
" mapleader definition has to be on top:
let mapleader="," " leader is comma
" necessary for pathogen:
execute pathogen#infect()
" the good settings:
set background=dark " obvious
set tabstop=4 " number of visual spaces per tab
set shiftwidth=4 " similar
set softtabstop=4 " number of spaces added/removed while editing
set expandtab " tabs become spaces
set smartindent " do smart indenting when starting a new line
set autoindent " copies previous indent when starting a newline
filetype indent on " makes filetype-based indenting work
set number " show line numbers
set wildmenu " cyclical menu for autocompletion
set showmatch " highlight matching bracket
set incsearch " search as you type
set hlsearch " highlight search results
" turn off search highlight
noremap <leader><space> :nohlsearch<CR>
" move vertically by visual line (don't skip over wrapped lines)
nnoremap j gj
nnoremap k gk
" highlight last inserted text - doesn't work??
" nnoremap gV `[v`]
" edit vimrc with ev
nnoremap <leader>ev :vsp ~/.vimrc<CR>
" load vimrc with sv
nnoremap <leader>sv :source ~/.vimrc<CR>
" save session (reopen with vim -S)
nnoremap <leader>s :mksession<CR>
" set html indentation lower:
autocmd FileType html setlocal softtabstop=2 shiftwidth=2 tabstop=2
" for scheme/lisp:
let g:tslime_ensure_trailing_newlines = 1
" don't use, but useful to have documented:
" set cursorline " highlight current line
" idk:
"highlight Normal ctermbg=LightGray
"syntax enable " enables syntax highlighting; not sure why this is disabled but it works anyway?
" FROM good vimrc
" CtrlP settings
"let g:ctrlp_match_window = 'bottom,order:ttb'
"let g:ctrlp_switch_buffer = 0
"let g:ctrlp_working_path_mode = 0
"let g:ctrlp_user_command = 'ag %s -l --nocolor --hidden -g ""'
" --- NOTES ---
" C-[ is escape.... ugh...
" also, somehow M-; is still getting through???
" mapleader is ,
" useful page: https://dougblack.io/words/a-good-vimrc.html
" most keybindings are from here
" RETURN TO:
" silver searcher? see good vimrc ^ for it
" also ctrl-p. I should get both of these
Ok it finally started working. I solved it by trying a few things that I thought were not necessary for Vim 7.4:
I added a filetype plugin on line after execute pathogen#infect().
I added a filetype off line to .vimrc before execute pathogen#infect().
I also used the :helptags command (which I thought Pathogen did on its own).
I don't have the patience to spend more hours identifying exactly which configuration is necessary to fix the issue, but hopefully this is sufficient for similar problems. My guess is that turning filetype plugins on is the primary culprit.
Related
When I open vim, I have to press the esc key before working w/ what is in the file because it assumes a 'c' was pressed.
It hasn't always been like this but I am unsure how to troubleshoot it.
When I run vim -u NONE or vim --noplugin, it doesn't assume 'c' has been pressed, but when I comment out the last two plugins that I installed (typescript-vim and ag.vim), it does assume 'c' was pressed.
Can anyone see any other setting that might be the culprit?
set t_Co=16
set nocompatible
filetype off
set rtp+=~/.vim/bundle/vundle.vim
call vundle#begin()
Bundle 'gmarik/vundle.vim'
" vim-snipmate dependencies
Plugin 'MarcWeber/vim-addon-mw-utils'
Plugin 'vim-scripts/tlib'
Plugin 'ToadJamb/vim_test_runner'
Plugin 'garbas/vim-snipmate'
Plugin 'tpope/vim-surround'
Plugin 'tpope/vim-rake'
Plugin 'tpope/vim-endwise'
Plugin 'kien/ctrlp.vim'
Plugin 'vim-scripts/DeleteTrailingWhitespace'
Plugin 'altercation/vim-colors-solarized'
Plugin 'ervandew/supertab'
Plugin 'kchmck/vim-coffee-script'
Plugin 'slim-template/vim-slim'
Plugin 'tpope/vim-rails'
Plugin 'tpope/vim-markdown'
Plugin 'vim-scripts/Align'
Plugin 'ToadJamb/vim_alternate_file'
Plugin 'ToadJamb/vim_tab_number'
Plugin 'Keithbsmiley/swift.vim'
Plugin 'vim-multiple-cursors'
Plugin 'leafgarland/typescript-vim'
Plugin 'rking/ag.vim'
call vundle#end()
filetype plugin indent on
" Plugin settings
let g:instant_markdown_autostart = 0
autocmd BufNewFile,BufRead Capfile setf ruby
autocmd BufNewFile,BufRead Gemfile setf ruby
" System-level settings
set noswapfile " Turn off the use of swap files - seems to use them anyway
"set dir='' " Really turn off the use of swap files
" Behavior
set expandtab " Expand tabs to spaces
set tabstop=2 " Set tabs to two spaces (No conversion - just display)
set shiftwidth=2 " Use 2 spaces when shifting with '>' or '<'
set ignorecase " Ignore case in patterns.
set smartcase " Case-sensitive matching for patterns with an uppercase letter
set backspace=2 " Make backspace/delete work in insert mode.
set showcmd " Show current command
" Presentation - always visible
syntax on " Syntax highlighting
set number " Show line numbers in margin
set cursorline " Highlight the line the cursor is on
set fillchars=stl:-,vert:\| " Set the characters used to fill borders
let &stl='%t %([%R%M]%) %L %l,%c ' " Status line format
" Presentation - conditional
set nowrap " Do not wrap text
set hlsearch " Highligh search text
set laststatus=2 " Always show the status bar
set listchars=trail::,tab:-> " How trailing spaces & tabs should be represented (tabstop matters for tab)
set list " Required in order for listchars to work
set colorcolumn=80 " Right margin at 80 characters
" Performance - Primarily for Ruby - Any file around 200 lines has a problem.
" Solution found here:
" http://stackoverflow.com/questions/16902317/vim-slow-with-ruby-syntax-highlighting
"set ttyfast " When playing with these 3 options, this one seemed to have no effect.
"set re=1 " Use the old regex engine (default is 0).
set lazyredraw " Don't redraw the screen for every little thing.
" Features
set foldmethod=indent " Enable folding based on language syntax
set nofoldenable " Open files with all folds expanded
" Toggle folding using the space bar.
nnoremap <silent> <Space> #=(foldlevel('.')?'za':"\<Space>")<CR>
vnoremap <Space> zf
:let mapleader = ","
" Toggle buffers using leader
map <leader><leader> :b#<cr>
" Enter clears highlighting
nnoremap <cr> :nohlsearch<cr>
" Open alternate files
command AF :execute OpenAlternateFile()
map <silent> <leader>s :call OpenAlternateFile() <CR>
" Run tests
map <silent> <leader>t :call TriggerTest()<CR>
map <silent> <leader>r :call TriggerPreviousTest()<CR>
" Binding for Ag
map <leader>/ :Ag<space>
" Quickfix bindings
map <ENTER> :cn<CR>
" *** No Color Scheme ***
"hi! String ctermfg=00
"hi! LineNr ctermfg=04
"hi! CursorLine ctermfg=none ctermbg=07 cterm=none
" *** Miscellaneous ***
"let g:solarized_termcolors=16 " Local
"let g:solarized_termcolors=256 " Remote
"set background=light
color solarized
I'm using Vim with Syntastic and JSHint, and there are a few bits of glitchy behavior that I'd like to fix.
Whenever I modify the last character on a line of text and save (:w), I momentarily see "^M" flash after the text before (sometimes) vanishing. Sometimes it sticks around and I have to manually delete it. What's the deal with this and how do I prevent it?
When there is an error in the quickfix view, how do I toggle focus between the quickfix view and the Vim editor window?
Vim crashes maybe once per minute, and I haven't the slightest clue as to why, but it's extremely annoying. The error typically reads "Vim: Caught deadly signal ABRT Vim: Finished. [1]6099 abort vi gulpfile.js" How do I prevent this?
Here is my .vimrc file:
set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')
" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'
" The following are examples of different formats supported.
" Keep Plugin commands between vundle#begin/end.
" plugin on GitHub repo
Plugin 'tpope/vim-fugitive'
" plugin from http://vim-scripts.org/vim/scripts.html
"Plugin 'L9'
" Git plugin not hosted on GitHub
Plugin 'git://git.wincent.com/command-t.git'
" git repos on your local machine (i.e. when working on your own plugin)
"Plugin 'file:///home/gmarik/path/to/plugin'
" The sparkup vim script is in a subdirectory of this repo called vim.
" Pass the path to set the runtimepath properly.
Plugin 'rstacruz/sparkup', {'rtp': 'vim/'}
" Avoid a name conflict with L9
"Plugin 'user/L9', {'name': 'newL9'}
" All of your Plugins must be added before the following line
call vundle#end() " required
filetype plugin indent on " required
" To ignore plugin indent changes, instead use:
"filetype plugin on
"
" Brief help
" :PluginList - lists configured plugins
" :PluginInstall - installs plugins; append `!` to update or just :PluginUpdate
" :PluginSearch foo - searches for foo; append `!` to refresh local cache
" :PluginClean - confirms removal of unused plugins; append `!` to auto-approve removal
"
" see :h vundle for more details or wiki for FAQ
" Put your non-Plugin stuff after this line
" React.js/JSX syntax highlighting
"Plugin 'mxw/vim-jsx'
"
"JSHint
Plugin 'wookiehangover/jshint.vim'
"Syntastic
Plugin 'scrooloose/syntastic'
"Syntastic configuration
set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*
let g:syntastic_always_populate_loc_list = 1
let g:syntastic_auto_loc_list = 1
let g:syntastic_check_on_open = 1
let g:syntastic_check_on_wq = 0
let g:syntastic_html_tidy_exec = 'tidy5'
let g:syntastic_javascript_checkers = ['jshint']
let g:JSHintHighlightErrorLine = 0
syntax on
set t_Co=256
set ai
set shiftwidth=4
set tabstop=4
set number
"colorscheme monokai
colorscheme skittles_berry
Thanks for any help you can provide.
I have no idea where your ^M issue and your crashing issue come from but you don't need such a huge plugin for such a simple task.
Create ~/.vim/after/ftplugin/javascript.vim if it doesn't exist and paste the lines below:
errorformat for jshint
setlocal errorformat=%f:\ line\ %l\\,\ col\ %c\\,\ %m,%-G%.%#
tell Vim to use jshint for the :make command
setlocal makeprg=jshint
add an autocommand to run :make on the current file upon write, the | silent wincmd p at the end switches the focus back to the editing window once the quickfix window is opened
autocmd! BufWritePost <buffer> silent make % | silent redraw! | silent wincmd p
I've never experienced a single crash with that simple setup, or that ^M issue.
With that in place you should get something like that after :w:
To move the focus from/to the quickfix window, use <C-w>p.
To jump to the previous/next error without using the quickfix window, use :cprevious/:cnext.
Reference:
:help 'errorformat'
:help 'makeprg'
:help autocmd
:help bufwritepost
:help :silent
:help :redraw
:help :wincmd
:help quickfix
Also, check out this great post: The Power of Vim
I want to synchronize the vim settings across my Mac and remote linux Ubuntu server. I am using NeoBundle for package management. I did the following:
On the Mac I installed NeoBundle and created a vimrc file in ~/.vim/. See below for the .vimrc file.
On the Mac I symlinked to this vimrc file using ln -s ~/.vim/vimrc ~/.vimrc
I entered .vim directory and made it into a git repository adding everything to the repository except .netrwhist and *.swp
Then I pushed this repository to bitbucket.
I logged into the server. Deleted .vim and .vimrc. Created a symlink ln -s ~/.vim/vimrc ~/.vimrc.
Then I created .vim on the server and ran git clone of the pushed repository. I see all the files on the server that I see on my mac.
The bundles are all in .vim/bundles. So they are available.
The Vim versions are different. Is that the problem?
On Mac it says:
VIM - Vi IMproved 7.3 (2010 Aug 15, compiled Dec 19 2013 15:19:49)
whereas on the server it says:
VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Jan 2 2014 19:39:32)
Problem: Vim works great on the Mac. But on the server when I run vim I get the following error:
Error detected while processing /home/admin/.vimrc:
line 16:
E117: Unknown function: neobundle#begin
line 20:
E492: Not an editor command: NeoBundleFetch 'Shougo/neobundle.vim'
line 26:
E117: Unknown function: neobundle#end
line 33:
E492: Not an editor command: NeoBundleCheck
line 38:
E492: Not an editor command: NeoBundle 'scrooloose/nerdtree'
line 39:
E492: Not an editor command: NeoBundle 'terryma/vim-multiple-cursors'
line 40:
E492: Not an editor command: NeoBundle 'tomasr/molokai'
line 41:
E492: Not an editor command: NeoBundle '29decibel/codeschool-vim-theme'
line 42:
E492: Not an editor command: NeoBundle 'Lokaltog/vim-easymotion'
line 43:
E492: Not an editor command: NeoBundle 'jnurmine/Zenburn'
line 64:
E185: Cannot find color scheme 'zenburn'
The .vimrc contains:
"================================================================================
" NeoBundle settings (copied from NeoBundle github page)
"================================================================================
" Note: Skip initialization for vim-tiny or vim-small.
if !1 | finish | endif
if has('vim_starting')
set nocompatible " Be iMproved
" Required:
set runtimepath+=~/.vim/bundle/neobundle.vim/
endif
" Required:
call neobundle#begin(expand('~/.vim/bundle/'))
" Let NeoBundle manage NeoBundle
" Required:
NeoBundleFetch 'Shougo/neobundle.vim'
" My Bundles here:
" Refer to |:NeoBundle-examples|.
" Note: You don't set neobundle setting in .gvimrc!
call neobundle#end()
" Required:
filetype plugin indent on
" If there are uninstalled bundles found on startup,
" this will conveniently prompt you to install them.
NeoBundleCheck
"================================================================================
" Install these packages
NeoBundle 'scrooloose/nerdtree'
NeoBundle 'terryma/vim-multiple-cursors'
NeoBundle 'tomasr/molokai'
NeoBundle '29decibel/codeschool-vim-theme'
NeoBundle 'Lokaltog/vim-easymotion'
NeoBundle 'jnurmine/Zenburn'
"================================================================================
" Editor view settings
"================================================================================
syntax on
set number
" size of a hard tabstop
set tabstop=4
" size of an indent
set shiftwidth=4
" always use spaces instead of tab characters
set expandtab
set guifont=Monaco:h16
if has("gui_running")
colorscheme codeschool
else
colorscheme zenburn
endif
"=================================================================================
" Other settings
"=================================================================================
" Use Ctrl-s to save a file in insert mode.
inoremap <C-s> <C-c>:w<ENTER>
" make working directory same as the file being edited
" may interfere with some plugins (see here: http://vim.wikia.com/wiki/Set_working_directory_to_the_current_file)
set autochdir
Even though this post is aging, as there is still no answers, I figured I might give my take on this issue. As I'm synchronizing my configuration directories across computers mixing OSX and Linux, I thought I'd share the way I've done it, for future reference, if you did solve your question.
First of all, I split my vim configuration in two directories:
~/.vim/ that contains the vimrc configuration file and neobundle, meant to be shared across all computers
~/.local/vim that contains the bundles, swap files and undo files.
Here's a tree of the first ~/.vim/:
$HOME/.vim
├── README.md
├── neobundle.vim
│ ├── LICENSE-MIT.txt
│ ├── Makefile
│ └── […] (all neobundle contents)
└── vimrc
First let's set up undofiles in the ~/.vim/vimrc file:
" undo file
set undofile
set undodir=~/.local/vim/undofiles
set undolevels=2000
set history=200
and swapfiles:
" swap files
set directory=~/.local/vim/swapfiles
so that they're not synchronized between computers and mess up with each others. No, you don't want the undo of computer A on computer B, and even worst, you don't want all your standard unix /home/foo/* mixed with the non-standard /Users/foo/*…
Then, in my ~/.vim/vimrc, I setup neobundle the following way:
" NeoBundle setup {{{
filetype off
set runtimepath+=~/.vim/neobundle.vim/
call neobundle#begin(expand('~/.local/vim/bundle'))
NeoBundleFetch 'Shougo/neobundle.vim'
" }}}
that's where the trick is: you set up the runtimepath to add the neobundle.vim addon bundle "manually" to the runtimepath of vim within ~/.vim, then you start neobundle by telling him where to find/install bundles. Following that in the vimrc file, you setup all your favorite bundles, and finally you end it with:
" NeoBundle Prologue {{{
call neobundle#end()
filetype plugin indent on " required!
NeoBundleCheck
" }}}
So, now, when I'm deploying vim on a new computer, all I have to do, is:
git clone https://github.com/guyzmo/vimrc ~/.vimrc
mkdir -p ~/.local/vim/bundle
mkdir ~/.local/vim/undofiles
mkdir ~/.local/vim/swapfiles
vim +NeoBundleInstall +qall
Finally, if that solution answers your question is that you keep in sync only the necessary static stuff (what plugins and what configuration), and generate all the dynamic stuff locally to each computer. So, you leave Neobundle do its job, cloning git repositories, compiling and installing files. For example, look at youcompleteme setup, where it is defined how to install it depending on the host you're running your vim on. And also, you'll never have any more git issues.
HTH
I have pathogen set up in my vim installation and various plugins installed.
"Call pathogen to set up various plugins
"filetype off
call pathogen#infect()
call pathogen#incubate()
call pathogen#helptags()
When I write my .vimrc in vim, the following command is supposed to reload the file (and it does seem to work).
" Source the vimrc file after saving it
if has("autocmd")
autocmd bufwritepost .vimrc source $MYVIMRC
endif
After writing .vimrc, however, pathogen does not reload.
Here is the output of :set rtp? after starting vim:
runtimepath=~/.vim,~/.vim/bundle/Jellybeans,~/.vim/bundle/TwitVim,~/.vim/bundl
e/badwolf,~/.vim/bundle/calendar,~/.vim/bundle/tagbar,~/.vim/bundle/vim-airline,
~/.vim/bundle/vim-colors-solarized,~/.vim/bundle/vim-colorschemes,~/.vim/bundle/
vizardry,/var/lib/vim/addons,/usr/share/vim/vimfiles,/usr/share/vim/vim74,/usr/s
hare/vim/vimfiles/after,/var/lib/vim/addons/after,~/.vim/after
and after :w in .vimrc it returns to the default.
runtimepath=~/.vim,/var/lib/vim/addons,/usr/share/vim/vimfiles,/usr/share/vim/
vim74,/usr/share/vim/vimfiles/after,/var/lib/vim/addons/after,~/.vim/after
I tried adding the following modification to no avail...
if has("autocmd")
autocmd bufwritepost .vimrc source $MYVIMRC
autocmd bufwritepost .vimrc call pathogen#incubate()
endif
I've been looking around and can't seem to find a solution other than just restarting vim every time I modify my .vimrc, which is fairly disruptive. Any help would be appreciated.
edit: output of tree -d -L 2...
.
├── autoload
└── bundle
├── badwolf
├── calendar
├── color~
├── Jellybeans
├── tagbar
├── TwitVim
├── vim-airline
├── vim-colorschemes
├── vim-colors-solarized
└── vizardry
The problem may be the following lines on your .vimrc:
" This line should not be removed as it ensures that various options are
" properly set to work with the Vim-related packages available in Debian.
runtime! debian.vim
On $VIMRUNTIME/debian.vim there is a line that reset the runtime path:
" Debian system-wide default configuration Vim
set runtimepath=~/.vim,/var/lib/vim/addons,/usr/share/vim/vimfiles,/usr/share/vim/vim74,/usr/share/vim/vimfiles/after,/var/lib/vim/addons/after,~/.vim/after
The problem doesn't happens when the .vimrc is loaded on startup because these lines are executed before call pathogen#infect(). When you reload your .vimrc you are overwriting your &rtp, but pathogen doesn't set it again (possible because s:done_bundles is already set).
Hi I have been trying to configure vim on ubuntu.
All the packages seem to install fine. However if installing a colorscheme via vundle and then using colorscheme name it doesn't appear to find the scheme.
I have attempted to install railscasts, solarized and desert-warm but all have failed to load.
This is my .vimrc am I doing something wrong?
set nocompatible " be iMproved
filetype off " required!
colorscheme desert-warm
" next tab
map <F7> :tabn
" previous tab
map <F8> :tabp
" Close Tab abd save
map <F9> ZZ
" open and edit file
map <F6> :tabedit
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()
" let Vundle manage Vundle
" required!
Bundle 'gmarik/vundle'
" My Bundles here:
"
" original repos on github
Bundle 'tpope/vim-fugitive'
Bundle 'Lokaltog/vim-easymotion'
Bundle 'rstacruz/sparkup', {'rtp': 'vim/'}
Bundle 'tpope/vim-rails.git'
Bundle 'desert-warm-256'
" vim-scripts repos
Bundle 'L9'
Bundle 'FuzzyFinder'
" non github repos
Bundle 'git://git.wincent.com/command-t.git'
Bundle 'https://github.com/vim-scripts/perl-support.vim.git'
Bundle 'https://github.com/Raimondi/delimitMate.git'
Bundle 'https://github.com/altercation/vim-colors-solarized.git'
Bundle 'https://github.com/jpo/vim-railscasts-theme.git'
" ...
filetype plugin indent on " required!
"
" Brief help
" :BundleList - list configured bundles
" :BundleInstall(!) - install(update) bundles
" :BundleSearch(!) foo - search(or refresh cache first) for foo
" :BundleClean(!) - confirm(or auto-approve) removal of unused bundles
"
" see :h vundle for more details or wiki for FAQ
" NOTE: comments after Bundle command are not allowed..
Try moving the colorscheme call to the end of the file.
Also, the color scheme name from your example doesn't work for me—it should be colorscheme desert-warm-256. To see a list of color schemes currently installed, try entering :colorscheme <TAB> interactively.
I think the answer to this question is that there is no call vundle#end() or syntax on in the original poster's .vimrc.
Adding these two lines and for example the colorscheme solarized line anywhere after the call vundle#end() would have solved the issue.
colorscheme desert-warm must come after Bundle 'desert-warm-256' since it is the Bundle command that adds things to the path:
Bundle 'desert-warm-256'
colorscheme desert-warm
Source: same question on GitHub issue.
Note: Vundle has recently (2014-03-18) swapped to using Plugin instead of Bundle, so after you git pull it will be:
Plugin 'desert-warm-256'
colorscheme desert-warm
You should write your "colorsheme desert bla bla" line AFTER the Plugin line. Because Vundle first needs to install this color plugin, and after than it can use it. Sorry my tiresome English.