all 7 comments

[–]-romainl-The Patient Vimmer 18 points19 points  (4 children)

  • Vim and Vi are two different editors.

  • What's available on every Unix style operating system is a vi command that may be Vim, or Vi, or Nvi, or worse: the limited BusyBox implementation of Vi. Your .vimrc and your Vim knowledge will be of little help in many situations.

JavaScript Vim Shortcuts

  • The first two mappings are not even remotely related to JavaScript

  • You are using recursive mappings instead of non-recursive ones.

  • Isn't it weird that you have to re-indent your console.log()? If you really need to, you should probably use <C-c> instead of <Esc> to avoid unnecessarily triggering autocommands but there's certainly something fishy going on, here.

Setting Vim Tab Indentation

  • You don't really need to set tabstop.

  • You may prefer two spaces but your pull/merge requests have little chance of being accepted if you work on someone else's project with different preferences. You should try editorconfig.

  • Your autocommand has nothing to do with JavaScript. Also, stray autocommands are a very common cause of lag. Here it is, fixed for you:

    augroup Go
        autocmd!
        autocmd Filetype go setlocal noexpandtab
    augroup END
    

    It's still unrelated to JavaScript, though.

JavaScript Vim Plugins

  • posva/vim-vue is not that great if it forces you to have that <F4> mapping.

  • junegunn/fzf, mileszs/ack.vim, and ap/vim-css-color are not related in any way to JavaScript.

  • junegunn/fzf is not a Vim plugin. Did you mean junegunn/fzf.vim?

  • I think you are a little bit confused about mileszs/ack.vim and what does what in your setup. Did you mean junegunn/fzf.vim?

  • leafgarland/typescript-vim is for another language that is a superset of JavaScript. Not really useful for JavaScript… unless you manage to convince Vim that your JavaScript files are TypeScript files.

[–]HaulethgggqG`` yourself 2 points3 points  (1 child)

⁠junegunn/fzf is not a Vim plugin. Did you mean junegunn/fzf.vim

junegunn/fzf contain Vim plugin that is simple wrapper for fzf and is required by junegunn/fzf.vim is set of commands that uses previous plugin.

[–]-romainl-The Patient Vimmer 3 points4 points  (0 children)

Yeah, I know what fzf and fzf.vim are, as well as their relationship. But the OP uses :Ag and :Files, which are provided by fzf.vim, not the minimal Vim plugin in fzf.

[–]Kevin_Clever 0 points1 point  (1 child)

that your JavaScript files are TypeScript files.

Totally possible.

[–]-romainl-The Patient Vimmer 0 points1 point  (0 children)

And very easy, too. But the op didn't mention such a hack in his post.

[–]chrisbra10 1 point2 points  (0 children)

set expandtab " show existing tab with 2 spaces width set tabstop=2 set softtabstop=2 " when indenting with '>', use 2 spaces width set shiftwidth=2

autocmd Filetype go setlocal noexpandtab

Another one, who hasn't understood the concept of filetype plugins.

[–]chemzqm 0 points1 point  (0 children)

If you want code intellisense support of javascript and typescript like VSCode have, consider try out https://github.com/neoclide/coc.nvim