| Sep | OCT | Nov |
| 28 | ||
| 2020 | 2021 | 2022 |
COLLECTED BY
Collection: Common Crawl
Full Stack Python
All topics |
Blog |
Supporter's Edition |
@fullstackpython |
Facebook |
What's new?
" enable syntax highlighting
syntax enable
" show line numbers
set number
" set tabs to have 4 spaces
set ts=4
" indent when moving to the next line while writing code
set autoindent
" expand tabs into spaces
set expandtab
" when using the >> or << commands, shift lines by 4 spaces
set shiftwidth=4
" show a visual line under the cursor's current line
set cursorline
" show the matching part of the pair for [] {} and ()
set showmatch
" enable all Python syntax highlighting features
let python_highlight_all = 1
Here is how these configuration options look with a dark background on
Mac OS X while editing the markdown for this webpage (how meta!).
Take a look at another example using these configuration options, this time
with a light background and editing Python code from my
Choose Your Own Adventures Presentations
project.
The Vimrc file lives under the home directory of the user account running
Vim. For example, when my user account is 'matt', on Mac OS X my Vimrc
file is found at /Users/matt/.vimrc. On Ubuntu Linux my .vimrc file
can be found within the /home/matt/ directory.
If a Vimrc file does not already exist, just create it within the user's
home directory and it will be picked up by Vim the next time you open the
editor.
The following are a few resources for learning what to put in, and how to
structure a .vimrc file. I recommend adding configuration options one
at a time to test them individually instead of going whole hog with a Vimrc
you are unfamiliar with.
A Good Vimrc is a fantastic,
detailed overview and opinionated guide to configuring Vim. Highly
recommended for new and experienced Vim users.
5 lines for a blank .vimrc
shows settings for case insensitive search, highlighting as you search,
disabling swap, and a couple more "must have" enhancements to the
default configuration.
Vim and Python shows
and explains many Python-specific .vimrc options.
Vim as a Python IDE
shows a slew of plugins and configuration options for coding with Python
in Vim.
This
repository's folder with Vimrc files
has example configurations that are well commented and easy to learn from.
For people who are having trouble getting started with Vim, check out this
blog post on the
two simple steps that helped this author learn Vim.
$ moves to the end of a line.
When $ is preceded by dthen everything to the end of the line is
deleted. Over time the simple commands become intuitive and the
combinations become more powerful than having distinct commands such as
a drop-down menu with a specific option to delete all text until the end
of the line.
Vim as a Language
explains the language syntax and how you can build up over time to master
the editor.
How to install and use Vim on a cloud server
along with How to use Vim for advanced editing of code on a VPS
are two detailed Digital Ocean guides for getting up and running with Vim,
regardless of whether you're using it locally or on a cloud server.
PacVim: a commandline game to learn Vim commands
takes the PacMan theme and teaches you how to use Vim by forcing you
to move around and use Vim commands while gaming.
Ten years of Vim
provides an insightful retrospective on one experienced developer's
journey with using Vim as a primary text editor and development
environment. I found the part about going overboard with plugins before
switching back to a simpler configuration fascinating because it is
the same path I've found myself taking as I approach my own ten year
mark with Vim.
At least one Vim trick you might not know about
is a collection of non-obvious keyboard shortcuts, many of which are
infrequently used but still useful.
Vim Adventures is a cute, fun browser-based
game that helps you learn Vim commands by playing through the adventure.
Things About Vim I Wish I Knew Earlier
explores the lessons one developer learned while exclusively using Vim
for several years. The author includes using relative instead of absolute
line numbering, setting numerous configuration options and fuzzy finding
to quickly open files in other directories rather than expanding the
whole path.
Seven habits of effective text editing
explains moving around efficiently, fixing errors quickly and forming good
habits.
sudo apt-get install vim.
If you're using PyCharm as your IDE you won't need to install Vim as a
separate text editor - instead use the
IdeaVim PyCharm plugin to get
Vim keybindings, visual/insert mode, configuration with ~/.ideavimrc and
other Vim emulation features.
The most accurate speech-to-text API. Built for Python developers.