-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvimrc
159 lines (120 loc) · 3.41 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
" sets default tabsize to 4
set sw=4
set tabstop=4
set lbr
" autoindent
set ai
set si
set wrap!
set hlsearch
set nocompatible
" replaces tabs with spaces
set expandtab
" turns on the cursor tracker
set ruler
set number
" Enables cool clipboard integration
set clipboard=unnamedplus
set updatetime=500
set modeline
" Enables deleting lines with backspace
set backspace=2
"""""""""""
" Plugins
"""""""""""
" Must install vim-plug for this to work
" initializes vim-plug (plugin manager) and its plugins
call plug#begin('~/.vim/plugged')
Plug 'scrooloose/nerdtree'
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'airblade/vim-gitgutter'
Plug 'TarkanAl-Kazily/vimscry'
Plug 'sirtaj/vim-openscad'
Plug 'justinj/vim-pico8-syntax'
Plug 'fsharp/vim-fsharp', {
\ 'for': 'fsharp',
\ 'do': 'make fsautocomplete',
\}
call plug#end()
let g:airline_powerline_fonts = 1
set laststatus=2
"""""""""""
" Colors
"""""""""""
syntax on
colorscheme tarkan
set ffs=unix,dos,mac
set encoding=utf8
"""""""""""
" File type detection
"""""""""""
autocmd! BufNewFile,BufRead *.ino,*.pde set filetype=cpp
" Requires a qs filetype highlighting file
autocmd! BufNewFile,BufRead *.qs set filetype=qs
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
" Put these in an autocmd group, so that we can delete them easily.
augroup vimrcEx
au!
" For all text files set 'textwidth' to 78 characters.
" autocmd FileType text setlocal textwidth=78
" When editing a file, always jump to the last known cursor position.
" Don't do it when the position is invalid or when inside an event handler
" (happens when dropping a file on gvim).
" Also don't do it when the mark is in the first line, that is the default
" position when opening a file.
autocmd BufReadPost *
\ if line("'\"") > 1 && line("'\"") <= line("$") |
\ exe "normal! g`\"" |
\ endif
augroup END
else
set autoindent " always set autoindenting on
endif " has("autocmd")
""""""""""""
" Custom Commands
""""""""""""
let mapleader = ","
nnoremap <leader>f :NERDTreeToggle<CR>
nnoremap <leader>t :NERDTreeFocus<CR>
autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * if argc() == 1 && isdirectory(argv()[0]) && !exists("s:std_in") | exe 'NERDTree' argv()[0] | wincmd p | ene | exe 'cd '.argv()[0] | endif
""""""""""""
" New Awesome Stuff
""""""""""""
" Search down into subfolders
set path+=**
""""""""""""
" DnD stuff
""""""""""""
" If you have a line wrapping point set, you can auto format highlighted text
" using 'gq'
let boardheader="The Board"
" Sets the print header to match what I want the Board letter headers to be
function BoardPrintHeader()
setlocal printheader=
setlocal printheader+=The\ Board%=Ravnican\ Post
endfunction
function BoardPrintDocument()
setlocal textwidth=80
setlocal filetype=markdown
exe "normal! gggqG"
call BoardPrintHeader()
call PrintToPdf()
exe "normal! u"
endfunction
function PrintToPdf(...)
setlocal printoptions=paper:letter
let _fname = "%:t:r.pdf"
if a:0 > 0
let _fname = a:1
endif
exe "hardcopy > /tmp/printtopdf_tmp.ps"
exe "silent !ps2pdf /tmp/printtopdf_tmp.ps " . _fname
exe "redraw!"
endfunction