Search code examples
neovim

Auto tab and copy/cut/paste clipboard in Neovim


I'm new to nvim and I have some questions when I use nvim

  1. I often work with Javascript and I want nvim can tab automatically like VS Code when I press enter. How can I do that?
  2. How can I cut/copy/paste with clipboard in Neovim, Should I use some plugin?

This is some Pluging I'm using:

Plug 'preservim/nerdtree'
Plug 'drewtempelmeyer/palenight.vim'
Plug 'Xuyuanp/nerdtree-git-plugin'
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'pangloss/vim-javascript'
Plug 'w0rp/ale'
Plug 'prettier/vim-prettier', { 'do': 'npm install' }
Plug 'yuezk/vim-js'
Plug 'maxmellon/vim-jsx-pretty'
Plug 'kassio/neoterm'
Plug 'tpope/vim-surround'
Plug 'tpope/vim-fugitive'
Plug 'alvan/vim-closetag'
Plug 'neoclide/coc.nvim', {'branch': 'release'}
Plug 'raimondi/delimitmate'
Plug 'ekalinin/dockerfile.vim'
Plug 'scrooloose/nerdcommenter'

Thanks for any helps.


Solution

  • For auto tab, I suppose you mean auto indentation. You can turn on autoindent and smartindent option.

    set autoindent smartindent
    

    To use clipboard for cut and paste, set clipboard option

    set clipboard+=unnamedplus
    

    See :h clipboard for more info.