I installed YouCompleteMe using vundle.
Then installed all plugins and installed YCM using
./install.sh --clang-completer
This is how my vimrc looks:
syntax on
set expandtab
set cindent
set tabstop=4
retab
set shiftwidth=4
set hlsearch
set paste
set ic
set number
colorscheme molokai
set t_Co=256
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()
Plugin 'gmarik/Vundle.vim'
Plugin 'tpope/vim-fugitive'
Plugin 'tpope/vim-repeat'
Plugin 'kien/ctrlp.vim'
Plugin 'sjl/gundo.vim'
Plugin 'Valloric/YouCompleteMe'
Plugin 'scrooloose/syntastic'
Plugin 'Valloric/ListToggle'
call vundle#end() " required
filetype plugin indent on
"options for syntastic"
set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*
let g:syntastic_python_checkers=['pep8', 'pylint', 'python']
let g:syntastic_enable_signs=1
let g:syntastic_auto_loc_list=1
let g:syntastic_check_on_open = 1
let g:syntastic_check_on_wq = 1
let g:syntastic_error_symbol = "X"
let g:syntastic_style_error_symbol = ">"
let g:syntastic_warning_symbol = "!"
let g:syntastic_style_warning_symbol = ">"
let g:syntastic_echo_current_error=1
let g:syntastic_enable_balloons = 1
let g:syntastic_auto_jump=1
"Gundo options"
nnoremap <F5> :GundoToggle<CR>
"CtrlP options"
let g:ctrlp_map = '<c-p>'
let g:ctrlp_cmd = 'CtrlP'
"Powerline stuff"
python from powerline.vim import setup as powerline_setup
python powerline_setup()
python del powerline_setup
set laststatus=2
YCM works but I can't switch between the suggestions using TAB, only using Down and Up arrows and accepting with Enter.
Why is happening this? Is another program using the TAB key?
thanks a lot for the help
By configuring set paste, you're effectively disabling all mappings and abbreviations.
You only need that set when you actually paste text in terminal Vim! It's best to bind this to a key. As mappings cannot be used when the option is set, Vim provides a special option for this:
:set pastetoggle=<F10>
Further commentary
As the ~/.vimrc is sourced at the beginning of Vim startup (when files passed to it haven't yet been loaded), the retab is ineffective; just drop it. If you really want automatic reindenting for opened files, you'd have to employ an :autocmd BufRead * retab for that, but I'd advise against that.
The problem was due to the "set paste" line in my .vimrc
so, I removed it, and when I want to paste large blocks of code in vim, I just write :set paste to enable it or :set nopaste to disable it. This toggle can be also mapped to f10 or any key.
Related
Here's my .vimrc what I expect is expandtab to work on every mentioned
filetype, except make where it is explicitly disabled. et used to work as a non-filetype set command, but detecting the filetype is important.
" vundle Config
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()
Plugin 'VundleVim/Vundle.vim'
Plugin 'vim-airline/vim-airline'
Plugin 'vim-airline/vim-airline-themes'
Plugin 'vim-syntastic/syntastic'
Plugin 'Shougo/vimproc'
" All of your Plugins must be added before the following line
call vundle#end()
filetype on
filetype plugin on
filetype indent on
" Remove whitespace
autocmd BufWritePre * %s/\s\+$//e
autocmd FileType cpp,html,css set et paste tabstop=4 shiftwidth=4 backspace=2 matchpairs+=<:>
autocmd FileType haskell,go,js,erlang,vim,tex set et paste tabstop=4 shiftwidth=4 backspace=2
autocmd FileType make set noexpandtab paste shiftwidth=8 softtabstop=0
syntax on
What I observe is that some options are set, some are not. The expandtab is the one that I can't get to work specifically. Here's the output of :set when opening my .vimrc file (filetype=vim).
backspace=2 filetype=vim keywordprg=:help paste shiftwidth=4 tabstop=4 ttymouse=sgr
commentstring="%s helplang=en laststatus=2 scroll=21 syntax=vim ttyfast
Ah, that's a tricky one. Have a look at :help 'paste':
When the 'paste' option is switched on (also when it was already on):
mapping in Insert mode and Command-line mode is disabled
abbreviations are disabled
'autoindent' is reset
'expandtab' is reset
[...]
Note how the option is introduced:
This is useful if you want to cut or copy some text from one window and paste it in Vim.
This option only is meant to be temporarily enabled when pasting into the terminal. Usually via a key configured in the 'pastetoggle' option. (GVIM doesn't need it; it can detect pastes. If you have X selection and clipboard enabled, you can also use the * and + registers instead.)
additional comments
The three :filetype commands can be condensed into a single filetype plugin indent on.
If you put this around your :autocmds, you'll remove the risk that some plugin clobbers them, and you can also safely reload your ~/.vimrc without defining duplicates:
augroup myCustomizations
autocmd!
autocmd ...
augroup END
Here's what I'm talking about.
On line 2 there is this highlighted block of "syntax=" text. It doesn't belong there and and will appear (seemingly) randomly. If I sweep over it in visual mode it goes away. I suspect that it's something to do with syntastic but I could easily be wrong since I'm only an intermediate when it comes to vim.
Here are the plugins I'm using,
YouCompleteMe
emmet-vim
html5.vim
nerdcommenter
python-mode
syntastic
tmp
vim-airline
vim-colors-solarized
vim-gitgutter
vim-javascript-syntax
vim-jinja
vim-js-indent
and here's my vimrc
execute pathogen#infect()
execute pathogen#helptags()
syntax on
" set [normal],rc open up the vimrc in a new buffer
let mapleader = ","
nmap <leader>rc :tabedit $MYVIMRC <CR>
" Stock Configurations
set laststatus=2
set nu
set t_Co=256
set autoread
set background=dark
set shiftwidth=4
set tabstop=4
set autoindent
set noswapfile
set nocompatible
set nowrap
set syntax
colorscheme solarized
" Autoclose YouCompleteMe Documentation Preivew after inserting
let g:ycm_autoclose_preview_window_after_insertion = 1
" Set the powerline fonts
let g:airline_powerline_fonts = 1
Also! Feel free to critique and make suggestions about my plugins and vimrc. I haven't spent a lot of time tuning things so any input would be rad!
I installed both plugins using Pathogen, but they don't work together as it should be. That is, if I use TAB, I get SuperTab's completion (autocomplete what I have previously written) whereas if I use CTRL + SPACE I get Jedi's completion (everything from libs: classes, modules, etc).
In theory, if both plugins are installed SuperTab should handle Jedi seamlessly, but that's not my case. I found this report of some people experiencing the same behavior, while others saying it works for them. There is no solution provided though.
The plugins I'm using don't override each other:
ls ~/.vim/bundle/
auto-pairs nerdtree syntastic vim-trailing-whitespace
jedi-vim supertab vim-airline
So what else may be causing this behavior?
vimrc:
set nu
set ts=4
set sw=4
set mouse=a
set showmatch
set expandtab
set background=dark
syntax on
filetype plugin indent on
execute pathogen#infect()
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
Found the root of the problem. SuperTab wasn't working in OmniCompletion mode.
let g:SuperTabContextDefaultCompletionType = "<c-x><c-o>"
I used Vundle to install editorconfig-vim plugin. It loads correctly and is listed in :scriptnames. But when I create a new file, say, x.js, indentation settings aren't picked from ~/.editorconfig file (although, no .editorconfig in CWD), and I have 2-space indentation instead of 4-space as I defined in my ~/.editorconfig.
What do I do wrong? Should I invoke a certain command in ~/.vimrc to make EditorConfig config work?
My ~/.editorconfig:
root = true
[*]
end_of_line = lf
insert_final_newline = true
charset = utf-8
indent_style = space
indent_size = 4
[{package.json,.travis.yml,Gruntfile.js,gulpfile.js,webpack.config.js}]
indent_style = space
indent_size = 2
And my ~/.vimrc config:
set nocompatible " be iMproved, required
filetype off " required
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'gmarik/Vundle.vim'
Plugin 'tpope/vim-fugitive'
Plugin 'tomasr/molokai'
Plugin 'moll/vim-node'
Plugin 'jelera/vim-javascript-syntax'
Plugin 'pangloss/vim-javascript'
Plugin 'editorconfig/editorconfig-vim'
call vundle#end() " required
filetype plugin indent on " required
" set tw=80
" set wrap linebreak nolist
let g:jsx_ext_required = 0 " Allow JSX in normal JS files
let g:syntastic_javascript_checkers = ['eslint']
let g:EditorConfig_core_mode = 'external_command'
syntax on
set number
set ruler
colorscheme molokai
You may want to use :verbose set tabstop? to check which plugin set it for you.
If it doesn't say Last set from ..., it uses the default option.
And then, editorconfig doesn't have the corresponding settings, and you may want to check which .editorconfig is used.
It is possible that another plugin is overriding the editorconfig plugin.
This happened to me. I had forgotten about installing https://github.com/Raimondi/YAIFA (Yet Another Indent Finder, Almost). I probably would have found the problem sooner in my case, if the plugin functionality was easier to parse from its name.
It helped for me in init.lua to set:
vim.cmd('filetype plugin on')
vim.cmd('filetype indent off')
Also :verbose set autoindent? gives the actual setting value and the place from where it was loaded. Filetype settings is loaded after global settings. After disabling filetype indentation my editorconfig started to work the way i expected it to work. You can also disable all filetype options by filetype off
Vim-newbie here...
I've been learning vim at work using a Mac.
I added my .vimrc to my github repo and expected Vundle to
download everything and have vim working the same on my home Mint 13 laptop.
I've linked my ~/.vim/.vimrc to ~/.vimrc.
I followed these instructions for building vim 7.4 and having a working vim.
I know that some parts of the .vimrc file are read, b/c my
remapped esc sequence is working.
Nothing else appears to work, not even line numbers.
vim --version
vim --version
VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Feb 25 2015 20:30:46)
Included patches: 1-640
vimrc
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
" let Vundle manage Vundle, required
Plugin 'gmarik/Vundle.vim'
" Keep Plugin commands between vundle#begin/end.
Bundle 'nanotech/jellybeans.vim'
Bundle 'tpope/vim-fugitive'
Bundle 'flazz/vim-colorschemes'
Bundle 'fs111/pydoc.vim'
Bundle 'hdima/python-syntax'
Bundle 'scrooloose/nerdtree'
Bundle 'tmhedberg/SimpylFold'
Bundle 'scrooloose/syntastic'
Bundle 'kien/rainbow_parentheses.vim'
call vundle#end() " required
filetype plugin indent on " required
syntax enable
set foldmethod=indent
set foldlevel=99
setlocal foldmethod=indent
set background=dark
set tabstop=4
set expandtab
set shiftwidth=4
set shiftround
set number
let mapleader=","
set hlsearch
set mouse=a
set nojoinspaces
set smarttab
nnoremap <leader>n :NERDTree<CR>
imap fj <Esc>
colorscheme jellybeans
" rainbow parens
au VimEnter * RainbowParenthesesToggle
au Syntax * RainbowParenthesesLoadRound
au Syntax * RainbowParenthesesLoadSquare
au Syntax * RainbowParenthesesLoadBraces
It would appear, that once again I've been bitten by XFCE.
This link gave me the hint I needed, setting my terminal
colos with:
set t_Co=256
Now more features are working as I expected, except that the color scheme
jellybeans is no longer so great.
Rainbowparens is not working.
EDIT:
Using more colors allows rainbow parens to work...
set t_Co=512