1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
|
" --- System Integration ---
" What it is: A command that finds and executes a script named 'debian.vim'
" from Vim's runtime path. This file is provided by the Debian/Ubuntu
" package maintainers.
"
" What it does: It loads a set of system-wide default settings to make Vim
" behave in a standard way across the operating system. This can sometimes
" include settings for the mouse, colors, etc. Any settings in this file
" are applied *before* the rest of your .vimrc.
"
" also look at /etc/vim/vimrc
runtime! debian.vim
" --- Core Vim Functionality ---
" What it is: A crucial three-in-one command.
"
" What it does:
" 1. filetype on: Enables detecting the type of file you open (e.g., .go, .py, .md).
" 2. plugin on: Allows Vim to load plugins specific to that filetype.
" 3. indent on: Enables automatic, language-specific indentation rules.
" This line is the foundation for making Vim "smart" about different code files.
filetype plugin indent on
" --- Mouse and Encoding ---
" What it is: Sets the mouse mode. The 'r' stands for Normal and Visual modes.
"
" What it does: This ENABLES the mouse for clicking to move the cursor,
" using the scroll wheel, and selecting text in Normal and Visual modes.
" It will be disabled in Insert and Command-line modes.
" Common values:
" 'a' = all modes
" 'n' = normal mode
" 'r' = normal and visual modes
" '' = disable completely (empty string)
set mouse=r
" What it is: Sets the character encoding for Vim's interface and for files.
"
" What it does: Ensures Vim uses UTF-8, the modern standard for text. This
" allows you to correctly view and edit files containing international
" characters, emojis, and other symbols without corrupting them.
set encoding=utf-8
set fileencoding=utf-8
" --- Editor Experience ---
" What it is: Turns on syntax highlighting.
"
" What it does: Colors your code based on keywords, strings, comments, etc.,
" making it much easier to read. This relies on 'filetype on' to know which
" language's syntax to apply.
syntax on
" What it is: An "autocommand" that runs after a file is read into a buffer.
"
" What it does: This is a great quality-of-life feature. It automatically
" restores your cursor to the exact line and column it was on the last time
" you edited that file. It saves you from having to find your place again.
au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
" What it is: A command to modify a terminal control sequence.
"
" What it does: This is a classic trick to prevent Vim from clearing your
" terminal screen when you quit. This is useful because it leaves the output
" of the previous command visible for you to reference.
"
" NOTE: The leading colon (:) is not necessary in a .vimrc file. You can
" just write 'set t_te='. The commented-out line above it is not needed.
:set t_te=
" --- Session and History ---
" What it is: Configures Vim's "memory" file (`.viminfo`).
"
" What it does: Controls what Vim remembers between sessions.
" '50 - Remember marks for the last 50 files.
" <1000 - Remember the last 1000 lines for each register (copy/paste history).
" s100 - Remember the last 100 search patterns.
" :0 - Remember 0 lines of command-line history (you have this disabled).
" n~/.cache/viminfo - Store the viminfo file in a modern, non-home directory location.
"
" NOTE: The leading colon is not necessary here either.
:set viminfo='50,<1000,s100,:0,n~/.cache/viminfo
" --- Plugin and Formatting Settings (Currently Inactive) ---
" The following lines are commented out, so they are not currently active.
" " Plugins
" " This line looks like it's for a plugin manager like 'vim-plug'.
" " You would typically have a block of these to list the plugins you want to install.
" Plugin 'fatih/vim-go'
" " stuff for vim-go
" " These lines configure the vim-go plugin to use 'gopls' (the Go Language Server),
" " which is the modern standard for Go code completion, navigation, and analysis.
" let g:go_def_mode='gopls'
" let g:go_info_mode='gopls'
" " :set textwidth=80
" " This would set the maximum width of a line of text to 80 characters.
" " Vim would automatically wrap your text as you type if it exceeds this limit.
" " :gq
" " This is not a setting, but a Normal mode command. 'gq' is used to
" " reformat selected text to the current 'textwidth' setting.
|