-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.vimrc
160 lines (131 loc) · 5.03 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
syntax enable
"set background=light
"let g:solarized_termcolors=256
"colorscheme solarized
packadd! dracula
colorscheme dracula
" Press Space to turn off highlighting and clear any message already displayed.
:noremap <silent> <Space> :nohlsearch<Bar>:echo<CR>
set mouse=a
set ruler
set wildmenu
set shortmess-=S " TODO: Why is this broken?
" Python
" breakpoint
map <silent> <leader>b oimport pdb; pdb.set_trace()<esc>
map <silent> <leader>B Oimport pdb; pdb.set_trace()<esc>
" terminal commands
command Py vertical botright term ipython3
command Py2 vertical botright term ipython2
"TODO
"autocmd FileType python map <buffer> <S-e> :w<CR>:!/usr/bin/env python %<CR>
" vim-slime
let g:slime_target = "vimterminal"
let g:slime_python_ipython = 1
"map <Enter> <C-n> <C-n>
"nmap <f5> :w<cr>:SlimeSend0 "exec(open('" . expand('%:p') . "').read())\n"<CR>
nmap <f5> :w<cr>:SlimeSend0 "time python3 " . expand('%') . "\n"<CR>
nmap <f6> :w<cr>:SlimeSend0 "python3 -i " . expand('%') . "\n"<CR>
nmap <f7> :w<cr>:SlimeSend0 "python3 -m cProfile " . expand('%') . "\n"<CR>
nmap <f8> :w<cr>:SlimeSend0 "time python2 " . expand('%') . "\n"<CR>
command Term vertical botright term
" Add the current file path to copy buffer.
command Fn :let @+ = expand("%")
command Src :source ~/.vimrc
" Used to change the working directory for a new tab. This way, FZF search is
" done in the correct place.
command Cwd :lcd %:p:h
" fzf
set rtp+=/usr/local/opt/fzf
nmap ; :FZF<CR>
nmap , :Buffers<CR>
nnoremap <Leader>rg :Rg<Space>
"nnoremap <Leader>rgs :Rg . "expand('<cword>')"
nnoremap <Leader>rgs exe(:Rg expand('<cword>') *)
" Don't surface .gitignore files
let $FZF_DEFAULT_COMMAND = 'rg -S --files --hidden'
function! Rg_cword()
execute 'Rg' expand('<cword>')
endfunction
nnoremap <leader>; :call Rg_cword()<CR>
" NERDTree
map <C-n> :NERDTreeToggle<CR>
map <C-m> :NERDTreeFind<CR>
let NERDTreeIgnore=['\.pyc$']
" vim-workspace
let g:workspace_autocreate =1
au BufNewFile,BufRead *.mm set filetype=objcpp
nnoremap gb :ls<CR>:buffer<Space>
" Hide swp files in Explore
let g:netrw_list_hide= '.*\.swp$,\~$,\.orig$'
" vim-plug
" TODO: Add dracula here
call plug#begin('~/.vim/plugged')
Plug '/usr/local/opt/fzf'
Plug 'junegunn/fzf.vim'
Plug 'scrooloose/nerdcommenter'
Plug 'scrooloose/nerdtree'
"Plug 'jupyter-vim/jupyter-vim'
Plug 'jpalardy/vim-slime'
Plug 'tpope/vim-fugitive'
Plug 'tpope/vim-rhubarb'
Plug 'thaerkh/vim-workspace'
call plug#end()
"
" A (not so) minimal vimrc.
" https://github.com/mhinz/vim-galore/blob/master/static/minimal-vimrc.vim
"
" You want Vim, not vi. When Vim finds a vimrc, 'nocompatible' is set anyway.
" We set it explicitely to make our position clear!
set nocompatible
filetype plugin indent on " Load plugins according to detected filetype.
syntax on " Enable syntax highlighting.
set autoindent " Indent according to previous line.
set expandtab " Use spaces instead of tabs.
set softtabstop =4 " Tab key indents by 4 spaces.
set shiftwidth =4 " >> indents by 4 spaces.
set shiftround " >> indents to next multiple of 'shiftwidth'.
set backspace =indent,eol,start " Make backspace work as you would expect.
set hidden " Switch between buffers without having to save first.
set laststatus =2 " Always show statusline.
set display =lastline " Show as much as possible of the last line.
set showmode " Show current mode in command-line.
set showcmd " Show already typed keys when more are expected.
set incsearch " Highlight while searching with / or ?.
set hlsearch " Keep matches highlighted.
set ttyfast " Faster redrawing.
set lazyredraw " Only redraw when necessary.
set splitbelow " Open new windows below the current window.
set splitright " Open new windows right of the current window.
set cursorline " Find the current line quickly.
set wrapscan " Searches wrap around end-of-file.
set report =0 " Always report changed lines.
set synmaxcol =200 " Only highlight the first 200 columns.
set list " Show non-printable characters.
if has('multi_byte') && &encoding ==# 'utf-8'
let &listchars = 'tab:▸ ,extends:❯,precedes:❮,nbsp:±'
else
let &listchars = 'tab:> ,extends:>,precedes:<,nbsp:.'
endif
" Put all temporary files under the same directory.
" https://github.com/mhinz/vim-galore#handling-backup-swap-undo-and-viminfo-files
function! Mkdir(path)
if !isdirectory(a:path)
call mkdir(a:path, "p")
endif
endfunction
call Mkdir($HOME."/.vim/files")
call Mkdir($HOME."/.vim/files/backup")
call Mkdir($HOME."/.vim/files/swap")
call Mkdir($HOME."/.vim/files/undo")
call Mkdir($HOME."/.vim/files/info")
set backup
set backupdir =$HOME/.vim/files/backup/
set backupext =-vimbackup
set backupskip =
set directory =$HOME/.vim/files/swap//
set updatecount =100
set undofile
set undodir =$HOME/.vim/files/undo/
set viminfo ='100,n$HOME/.vim/files/info/viminfo
set belloff=all " no error bell