Skip to content

VIM configuration file: used to write Golang, Python, Markdown, etc. with VIM on macOS

Notifications You must be signed in to change notification settings

axiaoxin/my-vimrc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

my-vimrc

中文文档

This repository stores my VIM configuration files. Usually, VIM is mainly used to write Golang, Python and Markdown.

At present, there are two branches. The master branch is the configuration of the old version of vim and is no longer maintained.

The vim-8 branch is the configuration currently being used on macOS with VIM 8.1.

VIM Version

VIM - Vi IMproved 8.1 (2018 May 18, compiled Oct 15 2019 10:20:59)
macOS version

Features

  • Automatically detect and install the vim-plug plugins Manager
  • Correct analysis of Chinese without disorder
  • Cancel backup, do not generate swap file automatically
  • The status bar is beautiful and informative with airline
  • Automatic loading takes effect immediately after configuration modification, and automatically loads opened files after modification
  • Use ALE automatic syntax detection and auto repair
  • Text search supports highlighting and typing instant search and intelligent case ignoring
  • Mouse operation supported
  • Quick switch file line number display
  • Saving a file automatically removes line endings and blank lines at the end of the file
  • Use 4 spaces to fill in the tab, smart indent, backspace and smart delete space
  • Support code collapse by indentation
  • After exiting VIM, the content is displayed on the terminal screen and can be used for viewing and copying
  • Always jump to the last cursor position when opening a file
  • After exiting VIM, you can still undo the last edit
  • With a large number of functions, easy to remember and press key mapping
  • j|k keep the cursor in the middle of the screen when moving the line
  • Copy all the contents of the file to the clipboard in Ctrl + C normal mode, and copy the selected contents to the clipboard in visual mode
  • CTRL + V paste clipboard contents as is
  • Support to view file directory tree
  • Use LeaderF to display a list of functions
  • Run the current Python script with one click and support virtualenv
  • One click Format JSON
  • Spaces can be added between numbers and English
  • Move or resize windows quickly
  • Using leaderf to support file obfuscation
  • One click Add or cancel comment is supported
  • Random theme color matching and one click switching
  • Elegant startup interface
  • Integrated VIM go plug-in, gopher VIM party standard
  • Support bracket pair highlighting
  • Support table mode to quickly edit and format markdown tables
  • Support color value Preview
  • Support asynchronous shell command execution
  • Support to display git diff tag
  • Support multi line editing
  • Support quick modification of wrapping characters at both ends of words
  • Use youcompleteme to support code auto completion
  • Auto pair edit parentheses, quotes
  • Support display screen calendar
  • Support nginx configuration highlighting
  • Support markdown real-time preview

Plugins

use vim-plug manage plugins: the .vimrc will automatic download the vim-plug

Custom key mapping

  • switch buffer: ]b [b
  • switch tab: ]t [t
  • copy (all/selected) content:Ctrl-cCtrl-v
  • write read only file: w!!
  • line number toggle: <F2>
  • nerdtree toggle: <F3>
  • function list: <F4>
  • run python script: <F5>
  • open a new tab: <F6>
  • lint fix: <F8>
  • format current json file: <F9>
  • automatically wrap spaces for English words and numbers in Chinese: <F10>
  • wrap "/' for a word: \w'\w"
  • change surround: csXY dsX
  • case conversion and automatic prefixing _ (for abcDef -> abc_def): !
  • delete the current character and case the following characters (for abc_def -> abcDef): @
  • continue indent text to left or right on select/normal mode: > <
  • switch window: Ctrl-k Ctrl-j Ctrl-h Ctrl-l
  • resize window: Ctrl-Shift-arrows
  • close quickfix window: \q
  • fuzzy search file: \f \m
  • format single json line in a text file: \wj \pj
  • comment/uncomment: \cc \cu
  • markdown table mode: \tm
  • build go file: \gb
  • run go file: \gr
  • run go test: \gT
  • run go test for function: \gt
  • goto symbol/declaration for go file: gd
  • show interface function implement for go file: \i
  • show referrers for go file: \r
  • add json tag for go struct: \t
  • remove tag for go struct: \T
  • fill go struct: \fs
  • add if err check for go: Ctrl-e
  • code complete: Ctrl-z
  • change random colorscheme: `\c
  • copy content to system clipboard: Ctrl-c
  • show git message: \gm
  • markdown file open preview: \p
  • markdown file stop preview: \q
  • leaderf find by filename: \ff
  • leaderf find by mru: \fm
  • leaderf find by rg: \fg

Screenshots

Some screenshots may not be up-to-date, just for reference.

Launch interface

Daily coding

Open a go file

Open a python file and run

Open nginx configuration file

Code complete

File search

Show calendar

Color preview

Markdown preview

Rainbow parentheses

Format single json line in text file

Markdown table mode

Install & Usage

[!] VIM version must be above 8 and python version is 3.x.x

For VIM upgrade, please refer to wiki: https://github.com/axiaoxin/my-vimrc/wiki/Upgrade-VIM-to-8.x

For Python upgrade, please refer to wiki: https://github.com/axiaoxin/my-vimrc/wiki/Upgrade-Python-to-3.x

External dependence

Using this configuration requires the following commands to install some external dependencies:

brew install cmake python mono go nodejs pygments global cppcheck
brew unlink ctags && brew install --HEAD universal-ctags/universal-ctags/universal-ctags
[sudo] pip3 install isort yapf flake8 autopep8 pylint pyright
npm -g install instant-markdown-d prettier markdownlint

Install plugins

  1. Copy the .vimrc file to your $HOME directory, open VIM, execute :PlugInstall, and wait for the plugins installation to complete.
  2. Install vim-go binaries: open a go file then run :GoInstallBinaries
  3. Install vim-go go_fmt_command tool: go get -u github.com/segmentio/golines
  4. Setting the YouCompleteMe: https://github.com/ycm-core/YouCompleteMe#macos
cd ~/.vim/plugged/YouCompleteMe
python3 install.py --all
  1. Install nerdfont: https://www.nerdfonts.com/font-downloads
  2. Install LeaderF C Extension(Optional): :LeaderfInstallCExtension
  3. Install Markdown preview tool: [sudo] npm -g install instant-markdown-d

Stargazers over time

Stargazers over time

About

VIM configuration file: used to write Golang, Python, Markdown, etc. with VIM on macOS

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published