Skip to content

Instantly share code, notes, and snippets.

@yordanoweb
Last active January 13, 2025 19:57
Show Gist options
  • Save yordanoweb/1f6077025213c981230fa23e7a79d221 to your computer and use it in GitHub Desktop.
Save yordanoweb/1f6077025213c981230fa23e7a79d221 to your computer and use it in GitHub Desktop.
Prepare vim as a full IDE

Turn Vim editor into an IDE

Prerequisites

  • Install NodeJS and Npm

Download plug.vim

curl -fLo ~/.vim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim

In ArchCraft distro, the startup vim script is at:

~/.vim_runtime/my_configs.vim

Put in the startup of vim, this

set nocompatible
set encoding=utf-8                                           

call plug#begin('~/.vim/plugged')                            

Plug 'neoclide/coc.nvim', {'branch': 'release'}
Plug 'dense-analysis/ale'
Plug 'rust-lang/rust.vim'
Plug 'arzg/vim-rust-syntax-ext'

let g:rustfmt_autosave = 1
let g:rustfmt_emit_files = 1
let g:rustfmt_fail_silently = 0

inoremap <silent><expr> <TAB>
      \ pumvisible() ? "\<C-n>" :
       \ <SID>check_back_space() ? "\<TAB>" :
       \ coc#refresh()
       inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<C-h>"
inoremap <expr> <cr> coc#pum#visible() ? coc#pum#confirm() : "\<CR>"
        function! s:check_back_space() abort
        let col = col('.') - 1
        return !col || getline('.')[col - 1]  =~# '\s'
         endfunction

        if has('nvim')
        inoremap <silent><expr> <c-space> coc#refresh()
           else
        inoremap <silent><expr> <c-@> coc#refresh()
            endif

call plug#end()

syntax enable
filetype plugin indent on

Open vim and execute PlugInstall

vim
:PlugInstall

Install the completion tools

:CocInstall coc-tsserver coc-eslint coc-json coc-prettier coc-css coc-python

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment