set tabstop=4
set softtabstop=4
set shiftwidth=4
set noexpandtab
set nu
set autoindent
set cindent
set encoding=utf-8
set fileencodings=utf-8,ucs-bom,gb18030,gbk,gb2312,cp936
set termencoding=utf-8
filetype plugin indent on
autocmd Filetype python setlocal expandtab tabstop=4 shiftwidth=4
I added the last two lines into .vimrc but received this error message:
-bash: filetype: command not found
-bash: autocmd: command not found
I haven't used this plugin before and what's the proper way to enable it? My purpose is to avoid the error message when I edit a file with vim on a Linux machine remotely:
TabError: inconsistent use of tabs and spaces in indentation
-bash: filetype: command not found
-bash: autocmd: command not found
These errors seem to be printed by bash,
did you run something like source .vimrc?
Related
i dont know why this dont work, source % works fine but when i type :PluginInstall the error pop up
"Error detected while processing function vundle#installer#new"
and this too "No bundles were selected for operation"
syntax on
set nocompatible
filetype off
set rtp+=~/.vim/bundle/Vundle.vim
set noerrorbells
set tabstop=4 softtabstop=4
set shiftwidth=4
set expandtab
set smartindent
set nu
set nowrap
set smartcase
set noswapfile
set nobackup
set undodir=~/.vim/undodir
set undofile
set incsearch
set colorcolumn=80
highlight ColorColumn ctermbg=0 guibg=lightgrey
call vundle#begin()
Plugin 'gmarik/vundle'
Plugin 'morhetz/gruvbox'
plugin 'jremmen/vim-ripgrep'
Plugin 'tpope/vim-fugitive'
Plugin 'vim-utils/vim-man'
Plugin 'git#github.com:kien/ctrlp.vim.git'
Plugin 'git#github.com:Valloric/YouCompleteMe.git'
Plugin 'mbill/undotree'
call vundle#end()
filetype plugin indent on
You can add the following line to your .vimrc
set shell=/bin/bash
There is a closed issue which describes error similar to yours.
In installation guide you can see that set shell=/bin/bash is recommended to be used in fish shell.
(optional) For those using the fish shell: add set shell=/bin/bash to your .vimrc
You may not be using fish shell but that is solution recommended in the issue.
I'm using :set syntax=javascript whenever I work on TypeScript files for example. I want to set the syntax automatically based on my file type. Now here's the thing, I've done it before by adding:
au BufNewFile,BufRead,BufReadPost *.ts set syntax=javascript
to my ~/.vimrc file, however, it doesn't seem to be working anymore.
Here is the contents of my .vimrc file. Is there a reason why this wouldn't work?
colorscheme atom-dark-256
set number
set autoindent
set guifont=monaco:h12
set expandtab
set tabstop=4 shiftwidth=4 expandtab
au BufNewFile,BufRead,BufReadPost *.ts set syntax=javascript
au BufNewFile,BufRead,BufReadPost *.handlebars set syntax=HTML
au BufNewFile,BufRead,BufReadPost *.twig set syntax=HTML
au BufNewFile,BufRead,BufReadPost *.theme set syntax=PHP
I'm sure it used to work just fine, but it just stopped for some reason. Any ideas? I'm using MacVim if that helps?
Let us set the filetype of *.ts as javascript so that it applies javascript syntax using
au BufEnter,BufRead *.ts set filetype=javascript
I have the following options in my .config/nvim/init.vim:
set tabstop=4
set shiftwidth=4
set expandtab
set ai
set smartindent
filetype on
filetype plugin on
filetype indent on
So, the indentation engine should work on all files, but it does not.
When I edit my config file for example, :set ai returns: autoindent and :set si returns: smartindent.
But when I run the same commands on a php file they return:
noautoindent
nosmartindent
EDIT:
The file that was overriding my config is:
/usr/share/nvim/runtime/indent/php.vim
It's the default php indent file.
so this is what my .vimrc contains, why is my syntax highlighting not working?
set nocompatible " must be the first line
filetype plugin indent on
syntax on
set laststatus=2
set statusline=%<%f\%h%m%r%=%-20.(line=%l\ \ col=%c%V\ \ totlin=%L%)\ \ \%h%m%r%=%-40(bytval=0x%B,%n%Y%)\%P
set nu
set shortmess=I
set nowrap
set tabstop=2
set backspace=indent,eol,start
set shiftwidth=2
set shiftround
set ignorecase
set smarttab
set hlsearch
set incsearch
set undolevels=1000
set pastetoggle=<F2>
set t_Co=256
colorscheme monokai
let g:user_emmet_leader_key = '<c-y>'
execute pathogen#infect()
autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif
autocmd vimenter * NERDTree
My color theme works, but the colors are not showing up properly as syntax highlighting.
Any suggestions?
First, check the output of:
:setlocal syntax?
The correct output (for php files) is:
syntax=php
You can check the php syntax code doing a:
:syntax list
You must see all syntax code with the command above. If you don't get the syntax=php value or don't see any syntax code on :syntax list, probably you don't have a php.vim file in your ~/.vim/ftplugin folder. When you set filetype plugin on and open an php file, what Vim does is to look in your ftplugin folder for a php.vim file and execute it.
php.vim is a system file, and it comes with the default installation. Try to do a :scriptname to see all scripts that are opening with vim. If you can't see a php.vim file, a solution could be install StanAngeloff/php.vim plugin.
If, and only if, you have a php.vim file and see its syntax with :syntax list, then something external is affecting Vim's syntax highlight, and it's probably your terminal.
I have installed zenburn colorscheme to ~/.vim/colors and am trying to enable it by default in the .vimrc file.
I have added colorscheme zenburn to my .vimrc file but the colorscheme is not enabled after vim starts.
If I manually do :colorscheme zenburn it sets the colorscheme.
If I enable a colorscheme that comes with vi ( for eg desert ) in vimrc, its being enabled at vim startup.
This is my vimrc
filetype plugin on
filetype indent on
set nocompatible
set history=500
syntax on
set expandtab
set tabstop=4
set shiftwidth=4
set softtabstop=4
set number
set autoindent
set cindent
set showmatch
set matchtime=5
set ruler
set laststatus=2
set hlsearch
set incsearch
set cursorline
set scrolloff=5
"set nowrap
set foldenable
set foldmarker={,}
set foldmethod=marker
set foldlevel=100
"set mouse=a
"set mouse=r
colorscheme zenburn
What should I do to get zenburn colorscheme enabled at startup ?
In my case when colorscheme was the only command in .vimrc it did not work. I had to add syntax on command at the end to make it work.
$ cat ~/.vimrc
colorscheme zenburn
syntax on
Try to load .vimrc file again after vim is started with :source ~/.vimrc
Did the colorscheme changes?
Also if you use graphical vim, there is second file that can override your settings ~/.gvimrc
I had a similar issue, try putting the command for colorscheme at the bottom of .vimrc
I had the same problem, and I found the following solution: in your .cshrc file (or equivalent in your .bashrc file), add the following line:
alias vi 'vim "+colorscheme my_scheme"'
Pay attention to the quotes and double quotes.
try
set colorscheme zenburn
# or
set color zenburn