-
Notifications
You must be signed in to change notification settings - Fork 0
/
.vimrc
191 lines (141 loc) · 4.79 KB
/
.vimrc
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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
" Owen Littlejohns, edited from Kristin Rutkowski
" 2020-05-01
" .vimrc
" adapted from:
" vim.wikia.com/wiki/Example_vimrc
" https://github.com/Areustle/dotfiles/blob/master/vim/.vimrc
" Packages in .vim/bundle:
" ale, vim-prettier, vim-tsx
" Packages in .vim/autoload:
" pathogen.vim, plug.vim
" Packages in .vim/plugged:
" vim-prettier
set nocompatible
" ----------------------------------------
" ---- editor display ----
" Attempt to determine the type of a file based on its name and possibly its
" contents. Use this to allow intelligent auto-indenting for each filetype,
" and for plugins that are filetype specific.
filetype indent plugin on
" display syntax highlighting
syntax on
" Enable use of the mouse for all modes
set mouse=a
" display line numbers on the left
set number
" Set colorscheme
set t_Co=256
set background=dark
colorscheme desert
" colorscheme rested
" colorscheme solarized
"
" highlight current line
set cursorline
"hi CursorLine cterm=NONE ctermbg=darkgray guibg=darkgray
" highlight current column
set cursorcolumn
highlight cursorcolumn ctermbg=darkgray guibg=darkgray
" highlight column 80 dark gray instead of pink
set colorcolumn=80
highlight ColorColumn ctermbg=246 guibg=darkgray
" ----------------------------------------
" ---- status line ----
" Show partial commands in the last line of the screen
set showcmd
" Display the cursor position in the status line
set ruler
" Always display the status line, even if only one window is displayed
set laststatus=2
" Set the command window height to 2 lines, to avoid many cases of having to
" "press <Enter> to continue"
set cmdheight=2
" ----------------------------------------
" ---- searching ----
" sets incremental search, to highlight words as you type into search
set incsearch
" highlights all occurrences of string
set hlsearch
" Use case insensitive search, except when using capital letters
set ignorecase
set smartcase
" always keep some lines of context around the cursor
" - helpful when search puts the cursor at the top of the window and I'm
" not sure where I am in the code
set scrolloff=2
" turn off search highlight: mapped to ,<space>.
"nnoremap <Leader><space> :noh<CR>
" turn off highlighting after a search
"map ,, :nohl
" press return to temporarily get out of the highlighted search.
"nnoremap <CR> :nohlsearch<CR><CR>
" Press Space to turn off highlighting and clear any message already
" displayed.
nnoremap <silent> <Space> :nohlsearch<Bar>:echo<CR>
" ----------------------------------------
" ---- misc ----
" instead of failing a command because of unsaved changes, instead
" raise a dialog asking if you wish to save changed files
set confirm
" allow backspace to delete work when editing
set backspace=indent,eol,start
" Enable use of the mouse for all modes
"set mouse=a
" Use <F11> to toggle between 'paste' and 'nopaste'
set pastetoggle=<F11>
" ----------------------------------------
" ---- tabs ----
" set tab size when looking in vi
set tabstop=4
" expand tabs to spaces
"set expandtab
" an indent will correspond to a single tab
set shiftwidth=4
" tab key will go to next level of indentation
set smarttab
" When opening a new line and no filetype-specific indenting is enabled,
" keep the same indent as the line you're currently on.
set autoindent
" if using actual tab character in source code, probably also want:
" - these are actually the defaults, but may want to set them defensively
" set softtabstop=0 noexpandtab
" Uncomment the following to have Vim jump to the last position when
" reopening a file
if has("autocmd")
au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$")
\| exe "normal! g'\"" | endif
endif
" Set indent to two spaces for pug and Javascript files:
autocmd FileType pug setlocal shiftwidth=2 tabstop=2 smarttab
autocmd FileType javascript setlocal shiftwidth=2 tabstop=2
autocmd FileType python setlocal shiftwidth=4 softtabstop=4 expandtab
" Disable bell:
set visualbell
set t_vb=
" Specify a directory for plugins
call plug#begin('~/.vim/plugged')
" Shorthand notation; fetches
Plug 'prettier/vim-prettier', {
\ 'do': 'npm install',
\ 'for': ['javascript', 'typescript', 'css', 'less', 'scss', 'json', 'graphql', 'markdown', 'vue'] }
" Initialize plug system
call plug#end()
execute pathogen#infect()
syntax on
filetype plugin indent on
" Support 256-terminal colours:
let &t_Co=256
" vim-ale settings:
let g:ale_sign_column_always = 1
let g:ale_linters={
\ 'java': [],
\ 'javascript': ['eslint'],
\ 'typescript': ['tsserver', 'tslint']}
let g:ale_fixers = {
\ 'javascript': ['eslint', 'prettier'],
\ 'css': ['prettier'],
\ 'typescript': ['prettier'],
\ 'python': ['remove_trailing_lines', 'trim_whitespace']}
let g:ale_fix_on_save = 1
let g:ale_javascript_prettier_use_local_config = 1
let g:ale_typescript_prettier_use_local_config = 1