User Tools

Site Tools


vim

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
vim [2021/01/03 16:22] – created - external edit 127.0.0.1vim [2025/10/27 03:31] (current) zhangyk
Line 26: Line 26:
 ===== How to change default font in windows ===== ===== How to change default font in windows =====
   * In C:\Users\<username>\_vimrc: [[https://superuser.com/questions/364792/how-can-i-set-the-default-font-for-gvim-on-windows | ref]]   * In C:\Users\<username>\_vimrc: [[https://superuser.com/questions/364792/how-can-i-set-the-default-font-for-gvim-on-windows | ref]]
 +
 +(The # shall be removed.)
 <code> <code>
 if has("gui_kde") if has("gui_kde")
-    set guifont=Consolas/13/-1/5/50/0/0/0/0/0+    #set guifont=Consolas/13/-1/5/50/0/0/0/0/0
 elseif has("gui_gtk") elseif has("gui_gtk")
-    set guifont=Consolas\ 13+    #set guifont=Consolas\ 13
 elseif has("gui_running") elseif has("gui_running")
     if has("win32") || has("win64")     if has("win32") || has("win64")
-        set guifont=Consolas:h12+        #set guifont=Consolas:h12
     else     else
-        set guifont=-xos4-terminus-medium-r-normal--14-140-72-72-c-80-iso8859-1+        #set guifont=-xos4-terminus-medium-r-normal--14-140-72-72-c-80-iso8859-1
     endif     endif
 endif endif
Line 42: Line 44:
 ===== How to enable ctrl+c/ctrl+v/ctrl+a etc in windows ===== ===== How to enable ctrl+c/ctrl+v/ctrl+a etc in windows =====
   * Add "source $VIMRUNTIME/mswin.vim" into C:\Users\yxue\_vimrc   * Add "source $VIMRUNTIME/mswin.vim" into C:\Users\yxue\_vimrc
 +
 +<markdown>
 +# Tricks
 +
 +## Vertical rulers on a specific column
 +
 +[Setup a Ruler on a Specific Column in Vim | Baeldung on Linux](https://www.baeldung.com/linux/vim-ruler-on-specific-column)
 +
 +In python's [PEP 8](https://peps.python.org/pep-0008/), the maximum line length is limited to 79 (and docstrings/comments to 72). So a vertical indication line is necessary.
 +
 +You can add a vertical ruler by typing:
 +```
 +:set colorcolumn=72,80
 +```
 +The line's color can be adjusted, `ctermbg` for vim called from terminal while `guibg` for vim called from GUI (which is gvim)
 +```
 +:highlight colorcolumn ctermbg=lightgrey guibg=lightgrey
 +```
 +
 +The two lines can be added to `~/.vimrc` for automatic loading. (The # shall be removed.)
 +```
 +#set colorcolumn=72,80
 +highlight colorcolumn ctermbg=lightgrey guibg=lightgrey
 +```
 +</markdown>
 +
 +
 +
  
vim.1609690964.txt.gz · Last modified: 2021/01/03 16:22 by 127.0.0.1