-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.vimrc
More file actions
116 lines (96 loc) · 3.78 KB
/
.vimrc
File metadata and controls
116 lines (96 loc) · 3.78 KB
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
filetype plugin on
filetype indent on
syntax on
let mapleader = " "
set clipboard=unnamed " Use system clipboard
set colorcolumn=80
set cursorline " Highlight cursor line
set encoding=utf-8
set fileencoding=utf-8
set hlsearch " Highlight search
set incsearch " Incremental search
set ignorecase " Case-insensitive search
set laststatus=2 " Always show status line
set noshowmode " Don't show mode
set number " Line numbers
" set relativenumber " Relative line numbers
set ruler
set shiftwidth=2
set shortmess-=S " Show search match index / count
set showmatch " Highlight matching brackets
set smartcase " Case-sensitive search if search contains uppercase
" characters
set smartindent
set statusline+=%{FugitiveStatusline()}
set tabstop=2
" ale
nnoremap K :ALEHover<CR>
" /ale
" lightline
" update colorscheme when system mode changes
" https://github.com/itchyny/lightline.vim/issues/680#issuecomment-2254283734
autocmd OptionSet background
\ execute 'source' globpath(&rtp, 'autoload/lightline/colorscheme/16color.vim')
\ | call lightline#colorscheme() | call lightline#update()
let g:lightline = {
\ 'colorscheme': '16color',
\ 'active': {
\ 'left': [ [ 'mode', 'paste' ],
\ [ 'gitbranch', 'readonly', 'filename', 'modified' ] ]
\ },
\ 'component_function': {
\ 'gitbranch': 'FugitiveHead'
\ },
\ }
" /lightline
" vim-plug
" https://github.com/junegunn/vim-plug/wiki/tips#automatic-installation
let data_dir = has('nvim') ? stdpath('data') . '/site' : '~/.vim'
if empty(glob(data_dir . '/autoload/plug.vim'))
silent execute '!curl -fLo '.data_dir.'/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
endif
" https://github.com/junegunn/vim-plug/wiki/tips#automatic-installation-of-missing-plugins
if empty(glob('~/.vim/autoload/plug.vim'))
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
endif
" Run PlugInstall if there are missing plugins
autocmd VimEnter * if len(filter(values(g:plugs), '!isdirectory(v:val.dir)'))
\| PlugInstall --sync | source $MYVIMRC
\| endif
call plug#begin()
Plug 'airblade/vim-gitgutter'
Plug 'ap/vim-css-color'
Plug 'dense-analysis/ale'
Plug 'github/copilot.vim'
Plug 'itchyny/lightline.vim'
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
Plug 'junegunn/fzf.vim'
Plug 'preservim/nerdtree'
Plug 'preservim/vim-indent-guides'
Plug 'tpope/vim-commentary'
Plug 'tpope/vim-fugitive'
Plug 'vimpostor/vim-lumen'
call plug#end()
" /vim-plug
" ale
" https://github.com/dense-analysis/ale#completion
let g:ale_completion_enabled = 1
" /ale
" nerdtree
" https://github.com/preservim/nerdtree/blob/7.1.3/README.markdown#how-can-i-map-a-specific-key-or-shortcut-to-open-nerdtree
nnoremap <leader>n :NERDTreeFocus<CR>
nnoremap <C-n> :NERDTree<CR>
nnoremap <C-t> :NERDTreeToggle<CR>
nnoremap <C-f> :NERDTreeFind<CR>
" always show hidden files
let g:NERDTreeShowHidden = 1
" start nerdtree when vim starts with a directory argument
autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * if argc() == 1 && isdirectory(argv()[0]) && !exists('s:std_in') |
\ execute 'NERDTree' argv()[0] | wincmd p | enew | NERDTreeFocus | execute 'cd '.argv()[0] | endif
" exit vim if nerdtree is the only window remaining in the only tab
" https://github.com/preservim/nerdtree/blob/7.1.3/README.markdown#how-can-i-close-vim-or-a-tab-automatically-when-nerdtree-is-the-last-window
autocmd BufEnter * if tabpagenr('$') == 1 && winnr('$') == 1 && exists('b:NERDTree') && b:NERDTree.isTabTree() | call feedkeys(":quit\<CR>:\<BS>") | endif
" /nerdtree