Skip to content

pta2002/intellitab.nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 

Repository files navigation

IntelliTab

IntelliTab is a small neovim plugin that fixes an annoying gripe I've had with vim's tab completion implementation for ages: pressing tab on a blank line only indents by a single space, instead of automatically indenting to your specified location.

With IntelliTab, pressing Tab works like it does on editors such as VSCode, by indenting to the same place smartindent would have indented it to if it were a new line.

Installation

Install using your favourite package manager:

Plug 'pta2002/intellitab.nvim'

Now, just rebind <Tab>:

inoremap <Tab> <CMD>lua require("intellitab").indent()<CR>

That's it!

If you are using CoC

CoC wants to have its own binding for Tab, which means it won't be compatible with intellitab by default. A solution to this is to bind Tab to this instead:

inoremap <silent><expr> <TAB>
      \ pumvisible() ? "\<C-n>" :
      \ <SID>check_back_space() ? <CMD>lua require("intellitab").indent()<CR> :
      \ coc#refresh()
inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<C-h>"

If you are using nvim-cmp

On the nvim-cmp setup, add this binding for tab:

['<Tab>'] = function(fallback)
  if cmp.visible() then
    cmp.select_next_item() -- or whatever else you want nvim-cmp to do when you press tab
  else
    require("intellitab").indent()
  end
end

About

A neovim plugin to only press tab once

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages