-
Notifications
You must be signed in to change notification settings - Fork 0
/
vimrc
103 lines (82 loc) · 2.39 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
execute pathogen#infect()
syntax on
filetype plugin indent on
set clipboard=unnamed
set ts=2 " Tabs are 2 spaces
set bs=2 " Backspace over everything in insert mode
set tabstop=2 shiftwidth=2 " Tabs under smart indent
set expandtab " use spaces, not tabs
set smarttab
set ruler " Ruler on
set nu " Line numbers on
set nowrap " Line wrapping off
set timeoutlen=250 " Time to wait after ESC (default causes an annoying delay)
set term=xterm-256color
set mouse=a
:set wrap
:set linebreak
:set nolist " list disables linebreak
" faster!
set lazyredraw
set ttyfast
set path=$PWD/**
set pastetoggle=<f5>
map <F6> :set wrap!<cr>
map <C-n> :NERDTreeToggle<CR>
filetype plugin indent on " required!
"fix issue with tmux
map <Esc>[B <Down>
map <Esc>[A <Up>
map <Esc>[C <Right>
map <Esc>[D <Left>
cmap <Esc>[A <Up>
cmap <Esc>[B <Down>
cmap <Esc>[C <Right>
cmap <Esc>[D <Left>
map! <Esc>[B <Down>
map! <Esc>[A <Up>
map! <Esc>[C <Right>
map! <Esc>[D <Left>
set nocp incsearch
set cinoptions=:0,p0,t0
set cinwords=if,else,while,do,for,switch,case
set formatoptions=tcqr
set cindent
set autoindent
syntax on " Colors in OSX
" TEX files set wrap
:autocmd BufNewFile,BufRead *.tex set wrap
" HTML files set wrap
:autocmd BufNewFile,BufRead *.html set wrap
" TXT files set wrap
:autocmd BufNewFile,BufRead *.txt set wrap
" Go lang
filetype plugin indent off
set runtimepath+=/usr/local/go/misc/vim
let g:go_fmt_command = "goimports"
filetype plugin indent on
syntax on
map <C-w>t :GoTest<CR>
" move through wraped lines
nnoremap k gk
nnoremap j gj
" src: http://vim.wikia.com/wiki/Faster_loading_of_large_files
" file is large from 20mb
let g:LargeFile = 1024 * 1024 * 50
augroup LargeFile
autocmd BufReadPre * let f=getfsize(expand("<afile>")) | if f > g:LargeFile || f == -2 | call LargeFile() | endif
augroup END
function LargeFile()
" no syntax highlighting etc
set eventignore+=FileType
" save memory when other file is viewed
setlocal bufhidden=unload
" is read-only (write with :w new_filename)
setlocal buftype=nowrite
" no undo possible
setlocal undolevels=-1
" display message
autocmd VimEnter * echo "The file is larger than " . (g:LargeFile / 1024 / 1024) . " MB, so some options are changed (see .vimrc for details)."
endfunction
map q <Nop>
" i don't use macros... yet