-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathoptions.vim
147 lines (122 loc) · 5.08 KB
/
options.vim
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
"enable loading the plugin files for specific file types
filetype plugin indent on
"precede each line with its line
set number
"turn on current file name for window title
set title
"make possible to switch buffers without saving
set hidden
"display long lines as one line
set nowrap
"horizontal splits will be below
set splitbelow
"vertical splits will be to the right
set splitright
"Diff vertically instead of horizontally
set diffopt+=vertical
"highlighting of the current line
set cursorline
"add scroll offset while scrolling
set scrolloff=4
"add scroll offset while scrolling horizontally
set sidescrolloff=5
"set languages for spell checking
set spelllang=en_us,ru_yo
"Override the 'ignorecase' option if the search pattern contains upper case characters.
set smartcase
"to visualise tabs, spaces, and line endings
set list listchars=tab:▸·,trail:·
"To ALWAYS use the clipboard for ALL operations (instead of interacting with the '+' and/or '*' registers explicitly)
set clipboard+=unnamedplus
"Maintain undo history between sessions
set undofile
"enable mouse
set mouse+=a
"--<TAB>--
"number of spaces within Tab, default=8
set tabstop=4
"replace virtual tab instead of one symbol with 4 space
set softtabstop=4
"when indenting with `>`, use 2 spaces width
set shiftwidth=4
"on pressing `tab`, insert 4 spaces(from 'tabstop')
set expandtab
"turn on smart indenting
set smartindent
"when shifting lines, round the indentation to the nearest multiple of 'shiftwidth'
set shiftround
"--</TAB>--
"turn off a message about current mode on the last line (actual for status line plugins
set noshowmode
"wrap lines at convenient points, avoid wrapping a line in the middle of a word(only for when wrap is enabled)
"set linebreak
"remove underscore "_" from key words so moving by `w` consider it as delimiter
set iskeyword-=_
"set completion mode to complete longest common string, then each full match
set wildmode=longest,full
"set cursor color in insert-mode and normal-mode(works with kitty term)
set guicursor=n-v-c:block-Cursor/lCursor,i-ci-ve:ver25-Cursor/lCursor,r-cr:hor20,o:hor50
"set cursor's different colors in insert-mode and normal-mode(works with kitty term)
"set guicursor=n-v-c:block-Cursor/lCursor,i-ci-ve:ver25-Cursor/lCursor,r-cr:hor20,o:hor50
"ignore files matching these patterns when opening files based on a glob pattern
set wildignore+=*/dist*/*,*/**.min.*/,*/node_modules/**/*
"The `path` is where Vim searches for files when executing the various search commands.
"By default `path=.,/usr/include,,.`
"Directories that should be searched are separated by commas
"The first . indicates that Vim should include files relative to the current file’s directory.
"`/usr/include/` typically contains headers so it can be useful if you are doing C and C++ programming.
"The final sequence of `,,` instructs Vim to search in the current working directory.
"by default ** only searches 30 directories deep, see :h starstar for more details.
set path=.,,,**
if executable("rg")
"To enable Vim to use ripgrep ( or any other grep program ) as a backend to the grep command
set grepprg=rg\ --smart-case\ --vimgrep\ --hidden
"creates a :SearchProject command, makes it so you don't have to escape strings in ripgrep, will tab compete with directories in path.
command! -nargs=+ -complete=dir -bar SearchProject execute 'silent! grep!'.<q-args>.' | cwindow'
endif
"highlight ColorColumn ctermbg=lightgrey guibg=lightgrey
"disable linebreaks by max width by ftplugins
"set textwidth=0
"shows the absolute number for the current line, and relative numbers for other lines
"set relativenumber
"Next is recommended by nvim-lua/completion-nvim
" Use <Tab> and <S-Tab> to navigate through popup menu
" inoremap <expr> <Tab> pumvisible() ? "\<C-n>" : "\<Tab>"
" inoremap <expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>"
" Set completeopt to have a better completion experience
" set completeopt=menuone,noinsert,noselect
" Avoid showing message extra message when using completion
" set shortmess+=c
"launch thesaurus from vi using ctrl-x ctrl-t
set thesaurus+=$HOME/.config/nvim/dict/mthesaur.txt
"enable relative numbers only in Normal mode, and absolute numbers only in Insert mode
"augroup toggle_relative_number
"autocmd InsertEnter * :setlocal norelativenumber
"autocmd InsertLeave * :setlocal relativenumber
"augroup END
"enable spell only if file type is normal text
let spellable = ['markdown', 'gitcommit', 'txt', 'text']
augroup setSpellCheck
autocmd!
autocmd BufEnter * if index(spellable, &ft) < 0 | set nospell | else | set spell | endif
augroup END
"open help and fugitive in vertical split
augroup verticalHelp
autocmd!
autocmd FileType help,fugitive wincmd L
augroup END
""to compile plugins.lua whenever the file is saved
augroup compilePacker
autocmd!
autocmd BufWritePost plugins.lua PackerCompile
augroup END
augroup ChangeCursorLineOnFocus
au!
au WinEnter * set cursorline
au WinLeave * set nocursorline
augroup END
"To make Vim treat all json files as jsonc - JSON with comments:
augroup JsonToJsonc
autocmd! FileType json set filetype=jsonc
augroup END
"source $HOME/.config/nvim/statusLine.vim