-
Notifications
You must be signed in to change notification settings - Fork 0
/
vimrc
140 lines (122 loc) · 3.05 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
" Another .vimrc
" Suckless
" Author : Martin Lee
set nocompatible " You must set this first :)
" General
set autoread
set backspace=indent,eol,start
set nobackup
set nowritebackup
set noswapfile
set nowrap
set bs=2
set completeopt=longest,menuone
set expandtab
set history=50
set hlsearch
set ignorecase
set incsearch
set number
set ruler
set scrolloff=4
set shiftwidth=2
set showcmd
set showmatch
set showmode
set colorcolumn=80
set shell=/bin/bash
set smartcase
set smartindent
set smarttab
set tabstop=2
set title
set virtualedit=all
set wildmenu
set wildmode=list:longest,full
filetype plugin indent on
syntax on
" set the window title in screen
if $STY != ""
set t_ts=k
set t_fs=\
endif
" utf-8
if has("multi_byte")
if &termencoding == ""
let &termencoding = &encoding
endif
set encoding=utf-8
setglobal fileencoding=utf-8
set fileencodings=ucs-bom,utf-8,latin1
endif
" fold
if has ('folding')
set foldenable
set foldmethod=marker
set foldmarker={{{,}}}
set foldcolumn=0
endif
" Terminal
if &t_Co >= 256
colorscheme neverland-darker
endif
if &t_Co > 2
" switch syntax highlighting on, when the terminal has colors
syntax on
endif
" GUI
if has("gui_running")
set guifont=LucidaConsole\ 8
set antialias
set background=dark
colorscheme neverland-darker
set selectmode=mouse,key,cmd
set guioptions-=m
set guioptions-=r
nnoremap <silent> <F2> :set nu!<cr> " Toggle line numbers
nnoremap <silent> <F1> :if &go=~#'T'<Bar>set go-=T<Bar>else<Bar>set go+=T<Bar>endif<CR>
endif
" Python stuff
autocmd FileType python let python_highlight_all = 1
autocmd FileType python let python_slow_sync = 1
autocmd FileType python set expandtab shiftwidth=4 softtabstop=4
autocmd FileType python set completeopt=preview
" PKGBUILD stuff
autocmd FileType PKGBUILD set expandtab shiftwidth=2 softtabstop=4
" sh stuff
autocmd FileType sh set expandtab shiftwidth=2 softtabstop=4
" autocommands
au BufWritePost ~/.Xresources !xrdb ~/.Xresources
au BufRead * call SetStatusLine()
au BufReadPost * call RestoreCursorPos()
au BufWinEnter * call OpenFoldOnRestore()
au BufEnter * let &titlestring = "vim: " . substitute(expand("%:p"), $HOME, "~", '')
au BufEnter * let &titleold = substitute(getcwd(), $HOME, "~", '')
function! RestoreCursorPos()
if expand("<afile>:p:h") !=? $TEMP
if line("'\"") > 1 && line("'\"") <= line("$")
let line_num = line("'\"")
let b:doopenfold = 1
if (foldlevel(line_num) > foldlevel(line_num - 1))
let line_num = line_num - 1
let b:doopenfold = 2
endif
execute line_num
endif
endif
endfunction
function! OpenFoldOnRestore()
if exists("b:doopenfold")
execute "normal zv"
if(b:doopenfold > 1)
execute "+".1
endif
unlet b:doopenfold
endif
endfunction
function! SetStatusLine()
let l:s1="%3.3n\\ %f\\ %h%m%r%w"
let l:s2="[%{strlen(&filetype)?&filetype:'?'},\\ %{&encoding},\\ %{&fileformat}]\\ %{fugitive#statusline()}"
let l:s3="%=\\ 0x%-8B\\ \\ %-14.(%l,%c%V%)\\ %<%P"
execute "set statusline=" . l:s1 . l:s2 . l:s3
endfunction