-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvimrc
More file actions
153 lines (121 loc) · 4.34 KB
/
Copy pathvimrc
File metadata and controls
153 lines (121 loc) · 4.34 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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
set number
colorscheme elflord
syntax enable
set belloff=all
"Create Markdown Hyperlink from URL
let @h = 'ByEi[Ea]()hp'
nnoremap ,h = ByEi[Ea]()hp
" BASIC SETUP:
map <SPACE> <leader>
let maplocalleader = ","
nnoremap <leader>ve :vsplit $MYVIMRC<cr>
nnoremap <leader>vs :w<cr> <bar> :source $MYVIMRC<cr> <bar> :q<cr>
nnoremap <leader>" viw<esc>a"<esc>bi"<esc>lel
" For local replace
nnoremap gr gd[{V%::s/<C-R>///gc<left><left><left>
" For global replace
nnoremap gR gD:%s/<C-R>///gc<left><left><left>
" Map Insert mode completion (:h ins-completion)
"inoremap <C-l> <C-x><C-l>
"inoremap <C-n> <C-x><C-n>
"inoremap <C-i> <C-x><C-i>
"inoremap <C-]> <C-x><C-]>
"inoremap <C-f> <C-x><C-f>
"inoremap <C-o> <C-x><C-o>
" Map escape
:inoremap jk <Esc>
:inoremap kj <Esc>
":inoremap <esc> <nop> DON'T USE! During insert mode; Caused arrow keys to enter OA, OB, OC, OD. Also changed
"backspace entering weird characters
" Auto commands
augroup filetype_javascript
:autocmd!
:autocmd FileType javascript nnoremap <buffer> <localleader>c I//<esc>
:autocmd FileType javascript nnoremap <buffer> <localleader>dw :%s/\\$//g<esc>
:autocmd FileType javascript :iabbrev <buffer> iff if ()<left>
:autocmd FileType javascript setlocal shiftwidth=2 tabstop=2
augroup END
augroup filetype_python
:autocmd!
:autocmd FileType python nnoremap <buffer> <localleader>c I#<esc>
:autocmd FileType python :iabbrev <buffer> iff if:<left>
:autocmd FileType python setlocal expandtab shiftwidth=4 softtabstop=4
augroup END
augroup filetype_html
:autocmd!
:autocmd FileType html nnoremap <buffer> <localleader>c I<!--<esc>g_a--><esc>
:autocmd FileType html setlocal shiftwidth=2 tabstop=2
augroup END
augroup filetype_c
:autocmd!
:autocmd FileType c nnoremap <buffer> <localleader>c I//<esc>
:autocmd FileType c nnoremap <buffer> <localleader>C ^xx<esc>
:autocmd FileType c map <F9> :w<cr>:!clear && gcc -Wall % -o %< <cr>
:autocmd FileType c map <F10> :w<cr>:!clear && gcc -Wall % -o %< && ./%< <cr>
:autocmd FileType c nnoremap <localleader>r :w<cr>:!clear && gcc -Wall % -o %< && ./%< <cr>
:autocmd FileType c nnoremap <localleader>t :w<cr>:!clear && gcc -Wall % -o %< && %< <cr>
:autocmd FileType c nnoremap <localleader>p :!./a.out<cr>
:autocmd FileType c inoremap { {<cr>}<esc>ko
:autocmd FileType c nnoremap <buffer> <localleader>i gg=G<C-o><C-o>
:autocmd FileType c setlocal noexpandtab tabstop=8 shiftwidth=8 softtabstop=8
augroup END
" enter the curent millenium
set nocompatible
filetype plugin on
" FINDING FILES:
" Search down into subfolders
" Proveds tab-completion for all file-related tasks
set path+=**
" Display all matching files when we tab complete
set wildmenu
" Make gf files that start with / relative to project working directory
" https://stackoverflow.com/questions/42625117/make-vim-to-consider-current-folder-the-root
nnoremap <silent> gf :let @/ = substitute(expand('<cfile>'), '^/', '', '')
\ <bar>normal gngf<cr>
" NOW WE CAN:
" - Hit tab to :find by partial match
" - Use * to make it fuzzy
" let g:netrw_browse_split=4 " open in prior window
let g:netrw_altv=1 " open splits to the right
let g:netrw_liststyle=3 " tree view
let g:netrw_banner=0
set title
" INDENTING
set expandtab
set shiftwidth=2
set softtabstop=2
if has("autocmd")
" Enable file type detection.
" Use the default filetype settings, so that mail gets 'tw' set to 72,
" 'cindent' is on in C files, etc.
" Also load indent files, to automatically do language-dependent indenting.
filetype plugin indent on
" ...
endif
if !empty(glob("~/.vim/autoload/plug.vim"))
" Specify a directory for plugins
" - For Neovim: ~/.local/share/nvim/plugged
" - Avoid using standard Vim directory names like 'plugin'
call plug#begin('~/.vim/plugged')
" Make sure you use single quotes
" Shorthand notation; fetches https://github.com/junegunn/vim-easy-align
Plug 'pangloss/vim-javascript'
Plug 'vim-airline/vim-airline'
" Initialize plugin system
call plug#end()
let g:airline_powerline_fonts = 1
endif
function! GotoJump()
jumps
let j = input("Please select your jump: ")
if j != ''
let pattern = '\v\c^\+'
if j =~ pattern
let j = substitute(j, pattern, '', 'g')
execute "normal " . j . "\<c-i>"
else
execute "normal " . j . "\<c-o>"
endif
endif
endfunction
nmap <Leader>j :call GotoJump()<CR>