-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit.vim
More file actions
138 lines (118 loc) · 3.92 KB
/
init.vim
File metadata and controls
138 lines (118 loc) · 3.92 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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
""""""""""""""""""""""""""
" Import all the plugins "
""""""""""""""""""""""""""
call plug#begin('~/.config/nvim/plugged')
" Navigation
Plug 'preservim/nerdtree' " File tree
Plug 'mbbill/undotree' " Undo tree
" Completion
Plug 'alvan/vim-closetag' " Autoclose tags
" Writing
Plug 'myusuf3/numbers.vim' " Relative position
Plug 'matze/vim-move' " Drag lines
Plug 'terryma/vim-expand-region' " Select region
Plug 'tpope/vim-surround' " Change surrounding
Plug 'cohama/lexima.vim' " Manage parentheses
Plug 'godlygeek/tabular' " Align assignments
" Display and color
Plug 'sickill/vim-monokai' " Colorschemes
Plug 'altercation/vim-colors-solarized' " Solarize theme
Plug 'vim-airline/vim-airline' " Bottom bar...
Plug 'vim-airline/vim-airline-themes' " ... and the themes
Plug 'mhinz/vim-startify' " Homepage
Plug 'luochen1990/rainbow' " Symbols coloration
" Programmation
Plug 'dense-analysis/ale' " Check syntax
Plug 'tpope/vim-fugitive' " Git from vim
Plug 'airblade/vim-gitgutter' " Show git modifications
Plug 'Xuyuanp/nerdtree-git-plugin' " Git plugin for nerdtree
Plug 'scrooloose/nerdcommenter' " Easy comments
Plug 'psf/black', { 'branch': 'stable' } " Use black for python
call plug#end()
filetype plugin indent on
syntax on
"""""""""""""""""
" Configuration "
"""""""""""""""""
" Vim comportment
set hidden " Hide buffer
set mouse=a
set clipboard=unnamedplus " Global clipboard
set autoread " Check file change
set novisualbell
set noerrorbells
set ssop=buffers,curdir,options,tabpages,winsize
set backspace=indent,eol,start
set wrap " Return if line too long
set showmatch " Show link btw parentheses
" Indentation
set autoindent
set expandtab
set tabstop=4
set softtabstop=4
set shiftwidth=4
" Display and coloration
set background=dark
colorscheme solarized " or monokai
let g:airline_theme='ravenpower'
set laststatus=2 " Always display vim-airline
set title " Update title
set cursorline
set scrolloff=5 " Display 5 lines around cursor
" Research
set ignorecase " Ignore case...
set smartcase " ... except if contain uppercase
set hlsearch " Highlight the results
set incsearch " ... same while tapping
" Programmation
let g:python_host_prog = expand('~/Software/neovim/py2/bin/python')
let g:python3_host_prog = expand('~/Software/neovim/py3/bin/python')
autocmd FileType python :setlocal colorcolumn=80 " Show column 80
"""""""""""""
" Shortcuts "
"""""""""""""
let mapleader=","
imap ;; <Esc>
map ;; <Esc>
map 0 ^
map <Leader>t :tabnew<CR>
map <Leader>> :tabnext<CR>
map <Leader>< :tabprevious<CR>
map <leader><Right> :bn<CR>
map <leader><Left> :bp<CR>
map <leader>n :NERDTreeToggle<CR>
map <leader>nf :NERDTreeFind<CR>
map <leader>u :UndotreeToggle<CR>
map <silent> <F6> "<Esc>:silent setlocal spell! spelllang=fr<CR>"
map <silent> <F7> "<Esc>:silent setlocal spell! spelllang=en<CR>"
" Stop highlight
nnoremap <leader><space> :nohlsearch<cr>
" Delete blank spaces
nnoremap <silent> <Leader>w :let _s=@/<Bar>:%s/\s\+$//e<Bar>:let @/=_s<Bar>:nohl<CR>
" Keep selection
vnoremap < <gv
vnoremap > >gv
" Reduce between {}
map <leader>- [{zf%<CR>
"""""""""""""""
" Set plugins "
"""""""""""""""
map - <Plug>(expand_region_shrink)
let g:rainbow_active=1
let g:ale_enabled=0
"""""""""""""""""""""""
" Scripts / Functions "
"""""""""""""""""""""""
" Display spaces to end of line
highlight NoSpacesEOL ctermbg=blue ctermfg=white
match NoSpacesEOL / \+$/
" Go back to the same line when reopening
augroup line_return
au!
au BufReadPost *
\ if line("'\"") > 0 && line("'\"") <= line("$") |
\ execute 'normal! g`"zvzz' |
\ endif
augroup END
" Highlight word under cursor
"autocmd CursorMoved * exe printf('match IncSearch /\V\<%s\>/', escape(expand('<cword>'), '/\'))