This guide explains how to configure your Vim editor for Python development using the provided .vimrc configuration.
vim-plug is a minimalist Vim plugin manager. Install it by running the following command in your terminal:
curl -fLo ~/.vim/autoload/plug.vim --create-dirs \
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
Copy the project's .vimrc file to your home directory:
cp resource.config/.vimrc ~/.vimrc
Open Vim and run the following command to install the plugins defined in your .vimrc:
:PlugInstall
This setup uses coc.nvim for language server protocol (LSP) support. To get Python support, you need to install coc-pyright. In Vim, run:
:CocInstall coc-pyright
Here is the content of the .vimrc file for your reference:
" Initialize plugin system
call plug#begin('~/.vim/plugged')
" LSP and autocompletion
Plug 'neoclide/coc.nvim', {'branch': 'release'}
" Git integration
Plug 'tpope/vim-fugitive'
" File explorer
Plug 'preservim/nerdtree'
" Fuzzy finder
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
Plug 'junegunn/fzf.vim'
" Python syntax and indentation
Plug 'vim-python/python-syntax'
" Status bar
Plug 'vim-airline/vim-airline'
" Commenting
Plug 'tpope/vim-commentary'
call plug#end()
" Basic settings
syntax on
set number
set relativenumber
set tabstop=4
set shiftwidth=4
set expandtab
filetype plugin indent on
" Coc.nvim settings
set hidden
set nobackup
set nowritebackup
set updatetime=300
set signcolumn=yes
" Use <Tab> for trigger completion and navigate
inoremap <silent><expr> <TAB> pumvisible() ? "\<C-n>" : "\<TAB>"
inoremap <silent><expr> <S-TAB> pumvisible() ? "\<C-p>" : "\<C-h>"
" Coc extensions (run :CocInstall coc-pyright for Python)