Git Product home page Git Product logo

vim-vue's Introduction

vim-vue CircleCI

Vim syntax highlighting for Vue components.

This was initially forked from darthmall/vim-vue. I already have an implementation for this but found his code much cleaner. That's why I created a new version instead of a PR.

Warning

This project is currently not actively maintained. We recommend to check the official vuejs/language-tools instead.

Installation

Install with Vundle

Plugin 'posva/vim-vue'

Install with Pathogen

cd ~/.vim/bundle && \
git clone https://github.com/posva/vim-vue.git

Install without a plugin manager (Vim 8)

git clone https://github.com/posva/vim-vue.git ~/.vim/pack/plugins/start/vim-vue

Integration with Syntastic or ALE

Currently only eslint is available. Please make sure eslint and eslint-plugin-vue are installed and properly configured:

npm i -g eslint eslint-plugin-vue

Contributing

If your language is not getting highlighted open an issue or a PR with the fix. You only need to add a line to the syntax/vue.vim file.

Don't forget to write Vader tests for the code you write. You can run the tests by executing make test in the terminal.

FAQ

Where is Jade?

Jade has been renamed to pug. Therefore you have to replace all your jade occurrences with pug. The new plugin for pug can be found on the same repository (the name has already been updated).

How to use commenting functionality with multiple languages in Vue files?

tcomment has some support for Vue files with multiple languages, without any extra configuration.

caw.vim features built-in support for file context through context_filetype.vim. Just install both plugins and context-aware commenting will work in most files. The fenced code is detected by predefined regular expressions.

To use NERDCommenter with Vue files, you can use its "hooks" feature to temporarily change the filetype. Click for an example.
let g:ft = ''
function! NERDCommenter_before()
  if &ft == 'vue'
    let g:ft = 'vue'
    let stack = synstack(line('.'), col('.'))
    if len(stack) > 0
      let syn = synIDattr((stack)[0], 'name')
      if len(syn) > 0
        exe 'setf ' . substitute(tolower(syn), '^vue_', '', '')
      endif
    endif
  endif
endfunction
function! NERDCommenter_after()
  if g:ft == 'vue'
    setf vue
    let g:ft = ''
  endif
endfunction

Vim slows down when using this plugin How can I fix that?

When checking for pre-processor languages, multiple syntax highlighting checks are done, which can slow down vim. You can trim down which pre-processors to use by setting g:vue_pre_processors to a whitelist of languages to support:

let g:vue_pre_processors = ['pug', 'scss']

To disable pre-processor languages altogether (only highlight HTML, JavaScript, and CSS):

let g:vue_pre_processors = []

Available pre-processors are: coffee, haml, handlebars, less, pug, sass, scss, slm, stylus, typescript

When g:vue_pre_processors is set to 'detect_on_enter' instead of a list, vim-vue will detect the pre-processors used when a file is opened, and load only their syntax files.

let g:vue_pre_processors = 'detect_on_enter'

vim-vue's People

Contributors

adriaanzon avatar agirorn avatar alhirzel avatar chaoyuelee avatar clovery avatar darthmall avatar edwardbetts avatar esdras avatar fvictorio avatar glore avatar herrbischoff avatar huangdawei avatar igemnace avatar izumisy avatar j-a-m-l avatar jmerizia avatar kaihendry avatar kesor avatar kikyous avatar knight42 avatar michaelfoss avatar milot-mirdita avatar nimser avatar posva avatar ryym avatar slice avatar w0rp avatar whitelynx avatar woat avatar z1lk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vim-vue's Issues

syntax highlighting stops too often

Using vim-vue for a while now, I've noticing too often that syntax highlighting stops in more complex files
so that parts of the file are not highlighted anymore. It does not behave consistently, it depends where I jump into the file and then from where I am scrolling. I guess that there are probably several sources for the bad behaviour, but in total it reduces the usefulness of vue-vim a lot, thus I'm opening this issue.

I' using stock debian vim with vim-vue and just updated to f6694b4

LANG=C vim --version
VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Nov 17 2016 06:34:13)
Included patches: 1-488, 576
Extra patches: 8.0.0056
Modified by [email protected]

Are there standard hints how to further analyse and report such problems with syntax highlighting rules?

Error opening .vue files

I am not using TypeScript but receive this error when opening any .vue file

Error detected while processing ~/.config/nvim/plugged/vim-vue/syntax/vue.vim:
line   53:
E484: Can't open file syntax/typescript.vim  

Support for more templating languages?

The syntax highlighting isn't very helpful as of now and doesn't seem to have the capabilities of other editor's Vue plugins; this is what I get when trying to use Sass and Handlebars for templates:

screen shot 2017-02-17 at 11 46 31 am

Just not sure why there's no highlighting on any of the tags, save for the content inside quotes for the style tag.

Vim Vue syntax doesn't work.

All other syntaxes are fine. Just in case here is the list of plugins I use

Plugin 'VundleVim/Vundle.vim' " Package Manager

Plugin 'jwalton512/vim-blade' " Blade Syntax Support
Plugin 'posva/vim-vue' " Vue Syntax Support
Plugin 'othree/html5.vim' " Html5 Syntax Support

I php, js syntax work fine.

duplicate syntax highlighting regex statements bogging down vim

I noticed that the syntax highlighting in this plugin slows my editor down immensely, making it unusable. After running syntime on and syntime report, I found that for css, the same regex statements were being executed needlessly. I dug into the problem slightly, and found that removing the lines in syntax/vue.vim, where register_language is called for styling languages, "fixes" the issue. Obviously, this removes support for other styling languages, but it does get rid of the repetition in regex parses. I forked the project and added a conditional statement, so that I could turn off other styling languages in my .vimrc (I only use plain css anyways). However, the issue still persists for those who would like to use scss, less, stylus, etc.

word wrap

.vimrc

set nowrap
Plug 'posva/vim-vue'

set nowrap failure
2017-06-15 4 16 23
2017-06-15 4 16 41

Strange indentation behavior

With the following code:

<template>
  <div id="root">
    <app-display/>
    <app-increment/>
  </div>
</template>

<script>
  import AppDisplay from './display.vue';
  import AppIncrement from './increment.vue';
  import store from './store';

  export default {
    components: {AppDisplay, AppIncrement},
    store
  };
</script>

if I select it all and hit = to reindent, this is what I get:

<template>
  <div id="root">
    <app-display/>
      <app-increment/>
      </div>
    </template>

    <script>
  import AppDisplay from './display.vue';
import AppIncrement from './increment.vue';
import store from './store';

export default {
  components: {AppDisplay, AppIncrement},
    store
};
  </script>

The mess in the <template> tag seems to be due to the self-closing tags. If i close them it behaves correctly:

<template>
  <div id="root">
    <app-display></app-display>
    <app-increment></app-display>
  </div>
</template>

The <script> tag, on the other hand still does not indent correctly:

<script>
  import AppDisplay from './display.vue';
import AppIncrement from './increment.vue';
import store from './store';

export default {
  components: {AppDisplay, AppIncrement},
    store
};
  </script>

EDIT: forgot to mention this is on Vim 8 on Windows 10.

No syntax highligthing at all.

:PluginList

Plugin 'VundleVim/Vundle.vim'
Plugin 'MarcWeber/vim-addon-mw-utils'
Plugin 'tomtom/tlib_vim'
Plugin 'garbas/vim-snipmate'
Plugin 'scrooloose/nerdtree'
Plugin 'mileszs/ack.vim'
Plugin 'kien/ctrlp.vim'
Plugin 'terryma/vim-multiple-cursors'
Plugin 'tpope/vim-fugitive'
Plugin 'bling/vim-airline'
Plugin 'majutsushi/tagbar'
Plugin 'tpope/vim-commentary'
Plugin 'arnaud-lb/vim-php-namespace'
Plugin 'elzr/vim-json'
Plugin 'othree/html5.vim'
Plugin 'hail2u/vim-css3-syntax'
Plugin 'digitaltoad/vim-pug'
Plugin 'posva/vim-vue'
Plugin 'xsbeats/vim-blade'

vim --version

vim --version
VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Apr 29 2016 11:28:12)

After installing the plugin vim said "Done!" and the a valid vue file is not getting highlighted. I did checked the other issues, my file is properly spelled like "profile.vue".

I did also run the following:

source ~/.vim/bundle/vim-vue/syntax/vue.vim
run ~/.vim/bundle/vim-vue/syntax/vue.vim

But I didn't get any output, not even errors.

Any ideas?

Screen bugs...

I have some unexpected selection when working with *.vue files.
If I type :colorscheme default or :colorscheme solarized, the selection disappears.

2017-03-01_13-15-29

How to fix that so I won't have the unwanted selection when opening *.vue files?

Issue saving a .vue file

The first time I try to save/modify a .vue file I get the following error:

Error detected while processing function <SNR>46_BufWritePostHook[3]..<SNR>46_UpdateErrors[13]..<SNR>46_CacheErrors[26]..64[2]..SyntaxCheckers_vue_eslint_IsAvailable:
line    8:
E716: Key not present in Dictionary: getVersion(), [0, 1])
E116: Invalid arguments for function syntastic#util#versionIsAtLeast(self.getVersion(), [0, 1])
E15: Invalid expression: g:syntastic_vue_eslint_generic || syntastic#util#versionIsAtLeast(self.getVersion(), [0, 1])

This is using vim8 installed via vundle.

Any thoughts?

Configure highlighting

Is there any way to configure what javascript syntax highlighting is being used?

I for one have configured my vim to use jelera/vim-javascript-syntax for javascript insted of the default javascript and I'd like to use the same inside of vue.

<style lang="..."> looses highlight

First of all, thank you for the awesome plugin!

I noticed that syntax highlighting is lost if I set language attribute:

image

I can reproduce it on NeoVim 0.1.1

Does not support using nested template tags.

When using the template tag within a component's root template, the syntax formatting stops at the first inner . I know this is just a regex issue, but I'm not very good with regex.

Setting commentstring to something else

I've been trying to change the commentstring for Vue syntax (since I usually want to comment/uncomment JS and not HTML). I can't seem to get it to work. I assume it's because of the load order, but I may be wrong. Any ideas?

Indent does not work

HI,

This plugin is pretty great.
But indent can not work on my OSX.

Do you have any solution?

Thank you

No such variable: "b:current_syntax"

Using Pathogen to load, on commit 4adfb9b, when opening a .vue file, I get the following error in vim:

Error detected while processing /path/to/.vim/bundle/vim-vue/syntax/vue.vim:
line   72:
E108: No such variable: "b:current_syntax"

The syntax highlighting still appears to work (although, this is my first time with vue, so I'm not 100% what I'm looking at).

Pathogen support

Be good to support Pathogen too since I am not sure about install vundle.

Thank you,

Syntax highlighting won't work using split

If you open a .vue file using vim foo.vue, the syntax highlighting works just fine.
However, if you split your vim using vsplit bar.vue or split bar.vue, the 2nd file won't get any highlighting at all.
Am I the only one experiencing this problem?

screenshots help

image
Uploading image.png…

vimrc config

`
Plugin 'posva/vim-vue'
"molokai 配色
let g:molokai_original = 1
let g:rehash256 = 1
" react jsx
let g:jsx_ext_required = 0

let g:ycm_key_list_select_completion = ['', '']
let g:ycm_key_list_previous_completion = ['', '']
let g:SuperTabDefaultCompletionType = ''

let g:ycm_error_symbol = '>>'
let g:ycm_warning_symbol = '>>'
"let g:ycm_use_ultisnips_completer = 1
"
"SirVer/ultisnips and vim-snippets
" Trigger configuration. Do not use if you use https://github.com/Valloric/YouCompleteMe.
"
"let g:UltiSnipsUsePythonVersion = 2
let g:UltiSnipsSnippetDirectories=["UltiSnips"]
"let g:UltiSnipsEnableSnipMate=0
let g:UltiSnipsExpandTrigger=""
let g:UltiSnipsJumpForwardTrigger="" "跳到下一个光标点
let g:UltiSnipsJumpBackwardTrigger=""
""let g:UltiSnipsExpandTrigger="k" "supperTab继承
"" If you want :UltiSnipsEdit to split your window.
let g:UltiSnipsEditSplit="vertical"

" tern_for_vim
let tern_show_signature_in_pum = 1

" make YCM compatible with UltiSnips (using supertab)
"let g:ycm_semantic_triggers = {
"\ 'c' : ['->', '.'],
"\ 'objc' : ['->', '.'],
"\ 'ocaml' : ['.', '#'],
"\ 'cpp,objcpp' : ['->', '.', '::'],
"\ 'perl' : ['->'],
"\ 'php' : ['->', '::'],
"\ 'cs,java,javascript,d,python,perl6,scala,vb,elixir,go' : ['.'],
"\ 'vim' : ['re![a-zA-Z]+[\w]*.'],
"\ 'ruby' : ['.', '::'],
"\ 'lua' : ['.', ':'],
"\ 'erlang' : [':'],
"\ }

"javascript
au FileType html,javascript let g:javascript_enable_domhtmlcss = 1

" 打开javascript折叠
let b:javascript_fold=1
" 打开javascript对dom、html和css的支持
let javascript_enable_domhtmlcss=1

"powerline相对比较麻烦还要安装特殊字休
"参见https://github.com/Lokaltog/vim-powerline/tree/develop/fontpatcher
"let g:Powerline_symbols = 'fancy'

""markdown
let g:markdown_fenced_languages = ['html', 'python', 'bash=sh']
autocmd BufNewFile,BufReadPost *.md set filetype=markdown

""设置语言缩进
autocmd FileType scss,css setlocal expandtab shiftwidth=2 tabstop=2 softtabstop=2
autocmd FileType javascript setlocal expandtab shiftwidth=4 tabstop=4 softtabstop=4 textwidth=80
autocmd FileType html setlocal expandtab shiftwidth=4 tabstop=4 softtabstop=4

" 将指定文件的换行符转换成 UNIX 格式
autocmd FileType php,javascript,html,css,python,vim,vimwiki set ff=unix

" Vue syntax highligting
autocmd FileType vue syntax sync fromstart
" autocmd BufRead,BufNewFile *.vue setlocal filetype=vue.html.javascript.css

"vim-javascript-syntax 语法高亮有bug
"au FileType javascript call JavaScriptFold()

"set modifiable
"" ZenCoding
let g:user_emmet_expandabbr_key=''
"let g:user_emmet_mode='n' "only enable normal mode funcs.
"let g:user_emmet_mode='inv' "enable all funcs, which is equal to
let g:user_emmet_mode='a' "enable all func in all mode.
"let g:use_zen_complete_tag = 1
let g:user_emmet_install_global = 0
autocmd FileType html,css,javascript,vue EmmetInstall
""日历
map ca :Calendar
`

Vue syntax highlighting slows down Vim a lot

When loading a vue file vim sets the ft to vue.html.javascript.css, which slows down Vim massively, including cursor movement. When setting the ft to html.javascript.css it doesn't slow down, so it must be the vue type's fault.

Here's a list of all the Plugins I have installed (not all are loaded)

  • SimpylFold: OK (not loaded)
  • fzf: OK
  • vim-devicons: OK
    x vim-polyglot:
    Invalid tag: v2.15.1 (expected: ). Try PlugUpdate.
  • indentLine: OK (not loaded)
  • rainbow_parentheses.vim: OK (not loaded)
  • vim-rsi: OK
  • vim-nerdtree-syntax-highlight: OK (not loaded)
  • incsearch-fuzzy.vim: OK (not loaded)
  • nginx-vim-syntax: OK
  • vim-autoformat: OK (not loaded)
  • vim-better-default: OK
  • tagbar: OK (not loaded)
  • vim-easy-align: OK (not loaded)
  • vim-cpp-enhanced-highlight: OK (not loaded)
  • YouCompleteMe: OK (not loaded)
  • asyncrun.vim: OK (not loaded)
  • vim-closetag: OK
  • vim-move: OK (not loaded)
  • gv.vim: OK (not loaded)
  • vim-template: OK
  • ack.vim: OK
  • vim-airline-themes: OK
  • gruvbox: OK
  • vim-gitgutter: OK
  • unite.vim: OK
  • incsearch.vim: OK (not loaded)
  • vim-airline: OK
  • vim-clang-format: OK (not loaded)
  • editorconfig-vim: OK (not loaded)
  • vim-choosewin: OK
  • YCM-Generator: OK (not loaded)
  • fzf-filemru: OK (not loaded)
  • nerdtree: OK (not loaded)
  • nerdtree-git-plugin: OK (not loaded)
  • vim-fugitive: OK
  • rename.vim: OK (not loaded)
  • vim-indent-guides: OK (not loaded)
  • tabular: OK (not loaded)
  • vim-better-whitespace: OK (not loaded)
  • ale: OK
  • html5.vim: OK (not loaded)
  • fzf.vim: OK
  • vim-tmux-navigator: OK
  • vim-jsx: OK (not loaded)
  • space-vim-dark: OK
  • vim-swoop: OK
  • PKGBUILD.vim: OK
  • python-mode: OK (not loaded)
  • rainbow: OK
  • emmet-vim: OK
  • vim-surround: OK
  • vim-multiple-cursors: OK
  • auto-pairs: OK
  • vim-javascript: OK (not loaded)
  • nerdcommenter: OK (not loaded)

This issue occurs on both Vim and NeoVim, both on pretty much the newest versions since I'm running Arch.

I'll be happy to provide more needed information, just tell me what.

Syntax highlighting breaks

When editing vue files with this plugin activated I repeatedly see the highlighting break. Since I started using vim just a few weeks ago I have not yet tried making sense of your vimscripts, sorry. I can reproduce this issue reliably using the below steps.

Steps to reproduce:

First run:

$ rm ~/.viminfo
$ wget https://raw.githubusercontent.com/monterail/vue-multiselect/2.0/src/Multiselect.vue
$ vim Multiselect.vue

Then SHIFT+G to get to the end of the file. Now the css code is not highlighted at all. Scroll up to see the entire file in strange highlighting.

Here is a video showing the issue reproduced.

System details

Operating system: Gentoo GNU/Linux ~amd64, but the same issue arises on Manjaro i3 and Windows 7.

$ vim --version
VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Jun 16 2017 16:51:21)
Included patches: 1-386
Modified by Gentoo-8.0.0386
Compiled by portage@kalle-laptop
Huge version without GUI.  Features included (+) or not (-):
+acl             +file_in_path    +mouse_sgr       +tag_old_static
+arabic          +find_in_path    -mouse_sysmouse  -tag_any_white
+autocmd         +float           +mouse_urxvt     -tcl
-balloon_eval    +folding         +mouse_xterm     +termguicolors
-browse          -footer          +multi_byte      +terminfo
++builtin_terms  +fork()          +multi_lang      +termresponse
+byte_offset     -gettext         -mzscheme        +textobjects
+channel         -hangul_input    +netbeans_intg   +timers
+cindent         +iconv           +num64           +title
+clientserver    +insert_expand   +packages        -toolbar
+clipboard       +job             +path_extra      +user_commands
+cmdline_compl   +jumplist        -perl            +vertsplit
+cmdline_hist    +keymap          +persistent_undo +virtualedit
+cmdline_info    +lambda          +postscript      +visual
+comments        +langmap         +printer         +visualextra
+conceal         +libcall         +profile         +viminfo
+cryptv          +linebreak       -python          +vreplace
-cscope          +lispindent      -python3         +wildignore
+cursorbind      +listcmds        +quickfix        +wildmenu
+cursorshape     +localmap        +reltime         +windows
+dialog_con      -lua             +rightleft       +writebackup
+diff            +menu            -ruby            +X11
+digraphs        +mksession       +scrollbind      +xfontset
-dnd             +modify_fname    +signs           -xim
-ebcdic          +mouse           +smartindent     -xpm
+emacs_tags      -mouseshape      +startuptime     +xsmp_interact
+eval            +mouse_dec       +statusline      +xterm_clipboard
+ex_extra        -mouse_gpm       -sun_workshop    -xterm_save
+extra_search    -mouse_jsbterm   +syntax          
+farsi           +mouse_netterm   +tag_binary      
   system vimrc file: "/etc/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: x86_64-pc-linux-gnu-gcc -c -I. -Iproto -DHAVE_CONFIG_H     -O2 -fomit-frame-pointer -pipe -fno-stack-protector -march=core2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1       
Linking: x86_64-pc-linux-gnu-gcc   -Wl,-O1 -L/usr/local/lib -Wl,--as-needed -o vim    -lSM -lICE -lXpm -lXt -lX11 -lXdmcp -lSM -lICE  -lm -lncurses -lelf -lnsl  -ldl
$ cat ~/.vimrc 
let mapleader = ","

"" Initialize pathogen
execute pathogen#infect()
syntax on
filetype plugin indent on

"" Workaround the bug that WindowSwap's autoload is not autoloaded.
source ~/.vim/bundle/windowswap/autoload/WindowSwap.vim

"" https://github.com/flazz/vim-colorschemes 
colorscheme 256-grayvim

"" Enable line numbering
set number

"" Tabs are four spaces and nothing else.
set tabstop=4
set shiftwidth=4
set expandtab
set smarttab

set textwidth=72
set colorcolumn=+1

"" Show whitespaces to not create horrible coding.
set listchars=eol:$,tab:>-,trail:~,extends:>,precedes:<
set list

"class" inside a pug template is parsed as JS

I don't know if it's a vim-vue specific problem, but I'm having problems with this interaction:

image

Basically, inside pug, class is detected as a JS class. I also suffer from reindenting when {{ }} are typed.

EDIT: Interestingly enough, it only happens when I use tags with hyphens. On regular tags this doesn't happen. This may be a shared bug with vim-pug.

Load time is a bit long

5874758c-bbae-40ec-a549-6f514e4df7d1

Loading time accounts for a third. How to shorten the?

276d5877-1a36-45af-836d-c84158ac5746

Hope the method name also support highlighted.

Stylus syntax doesn't work properly

I have installed vim-syntax and vim-vue and syntax seems to work. However, compared to open a file named *.stylus, syntax highlight of opening file named *.vue is a bit different. Can you tell me how to debug it?

unexpected token '<' at line 1, col 1. (errors) [css/csslint]

<template>
  <div id="app">
    <img src="./assets/logo.png">
    <router-view></router-view>
  </div>
</template>

<script>
export default {
  name: 'app'
}
</script>

<style>
#app {
  font-family: 'Avenir', Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
  margin-top: 60px;
}
</style>

hi,I use Syntastic with csslint and htmltidy, but when I open a vue file, I get this error, anyone can help, thks.

Syntax highlighting

Really tried to figure out what is wrong before posting this, so sorry in advance.

I started from scratch a new Vim configuration but now the .vue files are not being highlighted. Thought it could be a plugin incompatibility and tried removing/adding all syntax related plugins with not success. Also :syntax sync fromstart didn't work.

I'm using VIM - Vi IMproved 7.4 and this is my .vimrc conf:

 ---------------------- USABILITY CONFIGURATION ----------------------
"  Basic and pretty much needed settings to provide a solid base for
"  source code editting

" don't make vim compatible with vi
set nocompatible

" turn on syntax highlighting
syntax on

" and show line numbers
set number

" make vim try to detect file types and load plugins for them
filetype on
filetype plugin on
filetype indent on

" reload files changed outside vim
set autoread

" encoding is utf 8
set encoding=utf-8
set fileencoding=utf-8

" enable matchit plugin which ships with vim and greatly enhances '%'
runtime macros/matchit.vim

" by default, in insert mode backspace won't delete over line breaks, or
" automatically-inserted indentation, let's change that
set backspace=indent,eol,start

" dont't unload buffers when they are abandoned, instead stay in the
" background
set hidden

" set unix line endings
set fileformat=unix
" when reading files try unix line endings then dos, also use unix for new
" buffers
set fileformats=unix,dos

" save up to 100 marks, enable capital marks
set viminfo='100,f1

" screen will not be redrawn while running macros, registers or other
" non-typed comments
set lazyredraw

" ---------------------- CUSTOMIZATION ----------------------
" set , as mapleader
" let mapleader = ","

" save with ctrl+s
nmap <c-s> :w<CR>
imap <c-s> <Esc>:w<CR>a

" hide unnecessary gui in gVim
if has("gui_running")
    set guioptions-=m  " remove menu bar
    set guioptions-=T  " remove toolbar
    set guioptions-=r  " remove right-hand scroll bar
    set guioptions-=L  " remove left-hand scroll bar
end

" allow Tab and Shift+Tab to
" tab  selection in visual mode
vmap <Tab> >gv
vmap <S-Tab> <gv

" suggestion for normal mode commands
set wildmode=list:longest

" keep the cursor visible within 3 lines when scrolling
set scrolloff=3

" indentation
set expandtab       " use spaces instead of tabs
set autoindent      " autoindent based on line above, works most of the time
set smartindent     " smarter indent for C-like languages
set shiftwidth=2    " when reading, tabs are 4 spaces
set softtabstop=2   " in insert mode, tabs are 4 spaces

" ---------------------- PLUGIN CONFIGURATION ----------------------
" initiate Vundle
let &runtimepath.=',$HOME/.vim/bundle/Vundle.vim'
call vundle#begin()
" let Vundle manage Vundle, required
Plugin 'gmarik/Vundle.vim'

" start plugin defintion
Plugin 'pangloss/vim-javascript'
Bundle 'jelera/vim-javascript-syntax'
Plugin 'othree/yajs.vim'
Plugin 'othree/es.next.syntax.vim'
Plugin 'mxw/vim-jsx'
Plugin 'elzr/vim-json'
Plugin 'isRuslan/vim-es6'
Plugin 'posva/vim-vue'
Plugin 'scrooloose/nerdtree'
Plugin 'vim-scripts/L9'
Plugin 'tpope/vim-fugitive'
Plugin 'git://git.wincent.com/command-t.git'
Plugin 'rstacruz/sparkup', {'rtp': 'vim/'}
Plugin 'vim-scripts/FuzzyFinder'
Plugin 'itchyny/lightline.vim'
Plugin 'Lokaltog/vim-easymotion'
Plugin 'tpope/vim-surround'
Plugin 'Shutnik/jshint2.vim'
Plugin 'skammer/vim-css-color'
Plugin 'hail2u/vim-css3-syntax'
Plugin 'scrooloose/syntastic'
Bundle 'kien/ctrlp.vim'
Bundle "tpope/vim-rails.git"
Bundle 'altercation/vim-colors-solarized'
Bundle "bling/vim-airline.git"
Bundle "vim-scripts/TagHighlight.git"
Bundle "jtratner/vim-flavored-markdown.git"
Bundle "nelstrom/vim-markdown-preview"
Bundle "skwp/vim-conque"
Plugin 'reewr/vim-monokai-phoenix'
Plugin 'sheerun/vim-polyglot'

" end plugin definition
call vundle#end()

" Color theme
colorscheme monokai-phoenix

" start NERDTree on start-up and focus active window
autocmd VimEnter * NERDTree
autocmd VimEnter * wincmd p

" map FuzzyFinder
noremap <leader>b :FufBuffer<cr>
noremap <leader>f :FufFile<cr>

" run JSHint when a file with .js extension is saved
" this requires the jsHint2 plugin
autocmd BufWritePost *.js silent :JSHint

Please let me know if you see something weird so I can try. Thanks!

Standard linting rules break indentation

Hi, Everyone!

I'm using standard rules for linting. I use no semicolon, and my indentation is like this:

    filters: {
      clock (time) {
        const minutes = parseInt(time / 60)
          const seconds = parseInt(time % 60)
            return `${minutes}:${seconds}`
      }
    }

But if I use semicolons, everything goes ok:

    filters: {
      clock (time) {
        const minutes = parseInt(time / 60);
        const seconds = parseInt(time % 60);
        return `${minutes}:${seconds}`;
      }
    }

What could be happening?

Thanks for this awesome plugin!

Error when opening .vue files, HTML syntax highlighting broken

Hi,

I just installed this plugin and opened the App.vue file generated by vue-cli, and I see this error:

"src/App.vue" 23L, 387C
Error detected while processing /Users/tarun/.vim/bundle/vim-vue/syntax/vue.vim:
line   34:
E65: Illegal back reference
E475: Invalid argument: html keepend start=/^<template\( lang=\("\|'\)[^\1]*html[^\1]*\1\)\?>/ end=/^<\/template>/ contains=@HTML 
fold

The syntax highlighting of the HTML part of the .vue file isn't working at all.

How do I address this? I'm new to Vim, so this is all a bit new to me.

Thanks!

Indentation rules?

I gave vue components a shot for the first time yesterday, and while the syntax highlighting for different regions seems to be working fine, I don't get any indentation rules. In my set up at least, I get no auto-indentation whatsoever, which is pretty annoying. (I'm using filetype indent settings with filetype plugin indent on.)

Is there any possibility of getting vim to adjust indentation settings to match the syntax regions this sets up?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.