-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvimrc
More file actions
114 lines (103 loc) · 3.61 KB
/
vimrc
File metadata and controls
114 lines (103 loc) · 3.61 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
"Vundle Setup
set nocompatible
filetype off
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'gmarik/Vundle.vim'
Bundle 'Valloric/YouCompleteMe'
"Plugin 'scrooloose/syntastic'
"Plugin 'nvie/vim-flake8'
Plugin 'jnurmine/Zenburn'
Plugin 'altercation/vim-colors-solarized'
Plugin 'nanotech/jellybeans.vim'
Plugin 'rakr/vim-one'
Plugin 'scrooloose/nerdcommenter'
call vundle#end()
filetype plugin indent on
"End Vundle Setup
if has('gui_running')
try
colorscheme solarized
catch /^Vim\%((\a\+)\)\=:E185/
"Do nothing
endtry
set guioptions-=T
if has("gui_macvim")
set guifont=Inconsolata:h18
else
set guifont=Ubuntu\ Mono\ 14
set guifont=Monospace\ 14
endif
else
try
colorscheme solarized
catch /^Vim\%((\a\+)\)\=:E185/
"Do nothing
endtry
endif
syntax on "Syntax highlighting on
set number "Line numbers on
"# Toggle line numbers and fold column for easy copying:
nnoremap <F2> :set nonumber!<CR>:set foldcolumn=0<CR>
set hlsearch "Highlights for search
set wrap linebreak nolist "Soft wrap on word boundaries
set scrolloff=3 "Keep a few lines of context when scrolling
set history=1000 "Keep more history of commands/searches
set wildmenu "Command line tab completion gives list
set wildmode=list:longest "Give it in the buffer, rather than statusline
set listchars=tab:\ \ ,trail:· "Put trailing spaces as ·
set list "Enable the use of listchars
set expandtab "Put spaces in when tab is entered
set tabstop=4 "Four spaces for a tab
set shiftwidth=4 "Use two spaces for auto indentation
set autoindent "Preserve indent level when moving to a new line
set colorcolumn=80 "Color column 80
set t_Co=256
set backspace=2
let mapleader = ','
"Status line
set laststatus=2 "Always show statusline
set statusline=%f "Filename as typed
set statusline+=[%{strlen(&fenc)?&fenc:'none'}, "file encoding
set statusline+=%{&ff}] "file format
set statusline+=%h "help file flag
set statusline+=%m "modified flag
set statusline+=%r "read only flag
set statusline+=%y "filetype
set statusline+=%= "left/right separator
set statusline+=%c, "cursor column
set statusline+=%l/%L "cursor line/total lines
set statusline+=\ %p%% "percent through file
"" Backup and swap files
set backupdir=~/.vim/_backup/ " where to put backup files.
set directory=~/.vim/_temp/ " where to put swap files.
autocmd Filetype javascript setlocal ts=2 sts=2 sw=2 " tabs to two spaces for js
nnoremap <leader>s :w<CR>
inoremap jk <Esc>
"inoremap <Esc> <nul>
"let g:ycm_autoclose_preview_window_after_completion=1
"map <leader>g :YcmCompleter GoToDefinitionElseDeclaration<CR>
command! RandomLine execute 'normal! '.(matchstr(system('od -vAn -N3 -tu4 /dev/urandom'), '^\_s*\zs.\{-}\ze\_s*$') % line('$')).'G'
function! SetBackgroundMode(...)
let s:new_bg = "light"
if $TERM_PROGRAM ==? "Apple_Terminal"
let s:mode = systemlist("defaults read -g AppleInterfaceStyle")[0]
if s:mode ==? "dark"
let s:new_bg = "dark"
else
let s:new_bg = "light"
endif
else
" This is for Linux where I use an environment variable for this:
if $VIM_BACKGROUND ==? "dark"
let s:new_bg = "dark"
else
let s:new_bg = "light"
endif
endif
if &background !=? s:new_bg
let &background = s:new_bg
endif
endfunction
"call SetBackgroundMode()
call timer_start(3000, "SetBackgroundMode", {"repeat": -1})