Last active
October 9, 2019 00:34
-
-
Save danschumann/b8289b118c71edfca224 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" Plugin manager.. auto download if not already ( re launch vim a few times ) | |
if empty(glob('~/.vim/autoload/plug.vim')) | |
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs | |
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim | |
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC | |
endif | |
" Plugin manager.. auto download if not already ( re launch vim a few times ) | |
call plug#begin('~/.vim/plugged') | |
Plug 'michaeljsmith/vim-indent-object' | |
Plug 'tmhedberg/matchit' | |
Plug 'bkad/CamelCaseMotion' | |
"remap f to be the next camelCase | |
map <silent> f <Plug>CamelCaseMotion_w | |
sunmap f | |
map <silent> t <Plug>CamelCaseMotion_e | |
sunmap t | |
Plug 'tpope/vim-commentary' | |
Plug 'vim-scripts/ReplaceWithRegister' | |
Plug 'kana/vim-textobj-user' | |
Plug 'kana/vim-textobj-line' | |
Plug 'kana/vim-textobj-entire' | |
Plug 'kana/vim-textobj-function' | |
Plug 'Chun-Yang/vim-textobj-chunk' | |
Plug 'sgur/vim-textobj-parameter' | |
Plug 'danschumann/vim-textobj-punctuation' | |
Plug 'othree/html5.vim' | |
Plug 'kchmck/vim-coffee-script' | |
"Plug 'MaxMEllon/vim-jsx-pretty' | |
Plug 'mtscout6/vim-cjsx' | |
"Plug 'sheerun/vim-polyglot' | |
Plug 'lifepillar/vim-solarized8' | |
Plug 'rafi/awesome-vim-colorschemes' | |
Plug 'scrooloose/nerdtree' | |
Plug 'tpope/vim-repeat' | |
"Plug 'tpope/vim-surround' | |
Plug 'machakann/vim-sandwich' | |
Plug 'jeffkreeftmeijer/vim-numbertoggle' | |
" Initialize plugin system | |
call plug#end() | |
" vim surround key mapping | |
runtime macros/sandwich/keymap/surround.vim | |
map <c-t> :NERDTreeToggle<cr> | |
" Start NERDTree | |
" autocmd VimEnter * NERDTree | |
" Jump to the main window. | |
" autocmd VimEnter * wincmd p | |
"execute pathogen#infect() | |
filetype plugin indent on | |
syntax on | |
set backspace=indent,eol,start | |
set number | |
set expandtab | |
set tabstop=2 | |
set shiftwidth=2 | |
set ff=unix | |
set ffs=unix | |
set sw=2 | |
set ts=2 | |
set sts=2 | |
set expandtab | |
set nobackup | |
set nowritebackup | |
set noswapfile | |
map! jk <ESC> | |
map! kj <ESC> | |
set backupdir=x:\\temp | |
set visualbell t_vb= | |
au GuiEnter * set visualbell t_vb= | |
set complete-=i | |
" show the current file path even if only 1 file is open | |
set laststatus=2 | |
set number | |
" ctrl+l to toggle relative line numbers | |
nnoremap <C-l> :set rnu!<CR> | |
" Toggle /search highlighting ctrl+n | |
set nohlsearch | |
nnoremap <silent> <C-N> :se invhlsearch<CR> | |
" Focus current file by default in explorer | |
function! SearchNetrw(fname) | |
if ! search('\V\^' . a:fname . '\$') | |
call search('^' . substitute(a:fname, '\w\zs.*', '', '') . '.*\/\@<!$') | |
endif | |
endfunction | |
autocmd VimEnter * com! -nargs=* -bar -bang -count=0 -complete=dir Explore execute "call netrw#Explore(<count>,0,0+<bang>0,<q-args>)" . ' | call SearchNetrw(' . string(expand('%:t')) . ')' | |
set t_Co=256 | |
colors focuspoint | |
" bugfix for tmux | |
if exists('+termguicolors') | |
let &t_8f = "\<Esc>[38;2;%lu;%lu;%lum" | |
let &t_8b = "\<Esc>[48;2;%lu;%lu;%lum" | |
set termguicolors | |
endif | |
set noundofile | |
match Ignore /\r$/ | |
set suffixesadd+=.coffee,.js | |
set path+=/home/dan/digi2sign/src/app | |
set selection=inclusive | |
nnoremap <c-q> <c-v> | |
" Colors on <f8> key | |
" Change the color scheme from a list of color scheme names. | |
" Version 2010-09-12 from http://vim.wikia.com/wiki/VimTip341 | |
" Press key: | |
" F8 next scheme | |
" Shift-F8 previous scheme | |
" Alt-F8 random scheme | |
" Set the list of color schemes used by the above (default is 'all'): | |
" :SetColors all (all $VIMRUNTIME/colors/*.vim) | |
" :SetColors my (names built into script) | |
" :SetColors blue slate ron (these schemes) | |
" :SetColors (display current scheme names) | |
" Set the current color scheme based on time of day: | |
" :SetColors now | |
if v:version < 700 || exists('loaded_setcolors') || &cp | |
finish | |
endif | |
let loaded_setcolors = 1 | |
" Returns the list of available color schemes | |
function! GetColorSchemes() | |
return uniq(sort(map( | |
\ globpath(&runtimepath, "colors/*.vim", 0, 1), | |
\ 'fnamemodify(v:val, ":t:r")' | |
\))) | |
endfunction | |
" colorscheme names that we use to set color | |
let s:mycolors = GetColorSchemes() | |
" Set list of color scheme names that we will use, except | |
" argument 'now' actually changes the current color scheme. | |
function! s:SetColors(args) | |
if len(a:args) == 0 | |
echo 'Current color scheme names:' | |
let i = 0 | |
while i < len(s:mycolors) | |
echo ' '.join(map(s:mycolors[i : i+4], 'printf("%-14s", v:val)')) | |
let i += 5 | |
endwhile | |
elseif a:args == 'all' | |
let paths = split(globpath(&runtimepath, 'colors/*.vim'), "\n") | |
let s:mycolors = uniq(sort(map(paths, 'fnamemodify(v:val, ":t:r")'))) | |
echo 'List of colors set from all installed color schemes' | |
elseif a:args == 'my' | |
let c1 = 'default elflord peachpuff desert256 breeze morning' | |
let c2 = 'darkblue gothic aqua earth black_angus relaxedgreen' | |
let c3 = 'darkblack freya motus impact less chocolateliquor' | |
let s:mycolors = split(c1.' '.c2.' '.c3) | |
echo 'List of colors set from built-in names' | |
elseif a:args == 'now' | |
call s:HourColor() | |
else | |
let s:mycolors = split(a:args) | |
echo 'List of colors set from argument (space-separated names)' | |
endif | |
endfunction | |
command! -nargs=* SetColors call s:SetColors('<args>') | |
" Set next/previous/random (how = 1/-1/0) color from our list of colors. | |
" The 'random' index is actually set from the current time in seconds. | |
" Global (no 's:') so can easily call from command line. | |
function! NextColor(how) | |
call s:NextColor(a:how, 1) | |
endfunction | |
" Helper function for NextColor(), allows echoing of the color name to be | |
" disabled. | |
function! s:NextColor(how, echo_color) | |
if len(s:mycolors) == 0 | |
call s:SetColors('all') | |
endif | |
if exists('g:colors_name') | |
let current = index(s:mycolors, g:colors_name) | |
else | |
let current = -1 | |
endif | |
let missing = [] | |
let how = a:how | |
for i in range(len(s:mycolors)) | |
if how == 0 | |
let current = localtime() % len(s:mycolors) | |
let how = 1 " in case random color does not exist | |
else | |
let current += how | |
if !(0 <= current && current < len(s:mycolors)) | |
let current = (how>0 ? 0 : len(s:mycolors)-1) | |
endif | |
endif | |
try | |
execute 'colorscheme '.s:mycolors[current] | |
break | |
catch /E185:/ | |
call add(missing, s:mycolors[current]) | |
endtry | |
endfor | |
redraw | |
if len(missing) > 0 | |
echo 'Error: colorscheme not found:' join(missing) | |
endif | |
if (a:echo_color) | |
echo g:colors_name | |
endif | |
endfunction | |
nnoremap <F8> :call NextColor(1)<CR> | |
nnoremap <S-F8> :call NextColor(-1)<CR> | |
nnoremap <A-F8> :call NextColor(0)<CR> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment