Created
August 7, 2018 20:30
-
-
Save Mierenga/871204f6a0a704427ba4b104d4c4f3f3 to your computer and use it in GitHub Desktop.
A vim configuration file to use on raspberry pi shells
This file contains 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
set nocompatible | |
"""""""""""""""""""""""""""""""""""""""""""""" | |
"Vundle package manager | |
"""""""""""""""""""""""""""""""""""""""""""""" | |
"filetype off | |
set rtp+=~/.vim/bundle/Vundle.vim | |
call vundle#begin() | |
Plugin 'VundleVim/Vundle.vim' | |
"Add vundle plugins here | |
Plugin 'scrooloose/nerdtree' | |
Plugin 'Xuyuanp/nerdtree-git-plugin' | |
Plugin 'mileszs/ack.vim' | |
Plugin 'flazz/vim-colorschemes' | |
Plugin 'airblade/vim-gitgutter' | |
Plugin 'majutsushi/tagbar' | |
Plugin 'Raimondi/delimitMate' | |
Plugin 'christoomey/vim-tmux-navigator' | |
"Plugin 'vim-airline/vim-airline' | |
Plugin 'vim-syntastic/syntastic' | |
"End vundle plugins | |
call vundle#end() | |
"""""""""""""""""""""""""""""""""""""""""""""" | |
"""""""""""""""""""""""""""""""""""""""""""""" | |
" store swap files in centralized location | |
set directory^=$HOME/.vim/tmp// | |
" set tab types for different filetypes | |
filetype plugin indent on | |
autocmd FileType javascript setlocal shiftwidth=2 tabstop=2 softtabstop=2 | |
autocmd FileType html setlocal shiftwidth=2 tabstop=2 softtabstop=2 | |
"Open NERDTree when opening vim with no files specified | |
autocmd StdinReadPre * let s:std_in=1 | |
autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif | |
"""Close vim if NERDTree is the only window open | |
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif | |
" ignore files in nerd tree (add to the array for more) | |
let NERDTreeIgnore = [ | |
\'\.pyc$', | |
\'__pycache__', | |
\'__init__.py' | |
\] | |
"""REMAPS""" | |
" nerd tree toggle | |
map <C-;> :NERDTreeToggle<CR> | |
" split navigation | |
nnoremap <C-J> <C-W><C-J> | |
nnoremap <C-K> <C-W><C-K> | |
nnoremap <C-L> <C-W><C-L> | |
nnoremap <C-H> <C-W><C-H> | |
nmap <C-B> :TagbarToggle<CR> | |
set t_Co=256 "enable 256 colors | |
set mouse=nicr "allow mouse scroll | |
set cursorline | |
set expandtab | |
set tabstop=4 | |
set softtabstop=4 | |
set shiftwidth=4 | |
set nu | |
"set rnu | |
set cindent | |
set incsearch | |
set hlsearch | |
set splitbelow | |
set splitright | |
set runtimepath^=~/.vim/bundle/ctrlp.vim | |
" toggle pastemode " | |
set pastetoggle=<F3> | |
" use '+' register as clipboard " | |
set clipboard=unnamedplus | |
inoremap jj <Esc> | |
inoremap jk <Esc> | |
inoremap <S-CR> <C-o>A<CR> | |
let g:netrw_liststyle=3 | |
command Ex Explore | |
" colors " | |
syntax on | |
"colo brogrammer | |
"colo wellsokai | |
"colo skittles_berry | |
"colorscheme Tomorrow-Night-Bright | |
"colorscheme znake | |
"colorscheme Tomorrow-Night-Eighties | |
"colorscheme monokai | |
"colorscheme icansee | |
"colo obsidian | |
colo CandyPaper | |
"""""""""""" | |
" SYNTASTIC | |
"""""""""""" | |
set statusline=2 | |
set statusline=%f | |
"set statusline+=%#warningmsg# | |
"set statusline+=%{SyntasticStatuslineFlag()} | |
"set statusline+=%* | |
let g:syntastic_always_populate_loc_list = 1 | |
let g:syntastic_auto_loc_list = 1 | |
let g:syntastic_check_on_open = 0 | |
let g:syntastic_check_on_wq = 0 | |
let g:syntastic_enable_signs=1 | |
let g:syntastic_aggregate_errors=1 | |
let g:syntastic_c_checkers = ['clang_check', 'gcc'] | |
"" use F6 to toggle syntax checking on & off | |
silent! nmap <F6> :SyntasticToggleMode<CR> | |
silent! nmap <F7> :SyntasticCheck<CR> | |
silent! nmap <F8> :SyntasticReset<CR> | |
""""""""""""""" | |
" GIT GUTTER | |
""""""""""""""" | |
silent! nmap <F2> :GitGutterToggle<CR> | |
" the_silver_searcher " | |
let g:ackprg = 'ag --vimgrep' | |
" RSC: replace skip comments: replace a pattern with a new pattern, | |
" while skipping comments | |
function RSC(pattern, patternSub) | |
" Move to top of the file | |
normal 1G | |
" Search Pattern, no wrap | |
while search(a:pattern, "W", "", "") > 0 | |
" If found pattern is a comment, skip | |
if eval(synIDattr(synID(line("."), col("."), 0), "name") =~? "Comment") | |
continue | |
endif | |
" Replace pattern by it's substitute | |
exec '.s/'.a:pattern.'/'.a:patternSub.'/' | |
" Restore cursor position | |
normal `` | |
endwhile | |
endfunction | |
command! -nargs=+ -complete=command RSC call RSC(<args>) | |
" RSS: replace skip strings: repalce a pattern with a new pattern, | |
" while skipping strings | |
function RSS(pattern, patternSub) | |
" Move to top of the file | |
normal 1G | |
" Search Pattern, no wrap | |
while search(a:pattern, "W", "", "") > 0 | |
" If found pattern is a string, skip | |
if eval(synIDattr(synID(line("."), col("."), 0), "name") =~? "String") | |
continue | |
endif | |
" Replace pattern by it's substitute | |
exec '.s/'.a:pattern.'/'.a:patternSub.'/' | |
" Restore cursor position | |
normal `` | |
endwhile | |
endfunction | |
command! -nargs=+ -complete=command RSS call RSS(<args>) | |
" RSSC: replace skip strings & comments: repalce a pattern with a new pattern, | |
" while skipping strings & comments | |
function RSSC(pattern, patternSub) | |
" Move to top of the file | |
normal 1G | |
" Search Pattern, no wrap | |
while search(a:pattern, "W", "", "") > 0 | |
" If found pattern is a string, skip | |
if eval(synIDattr(synID(line("."), col("."), 0), "name") =~? "String") | |
continue | |
endif | |
" If found pattern is a comment, skip | |
if eval(synIDattr(synID(line("."), col("."), 0), "name") =~? "Comment") | |
continue | |
endif | |
" Replace pattern by it's substitute | |
exec '.s/'.a:pattern.'/'.a:patternSub.'/' | |
" Restore cursor position | |
normal `` | |
endwhile | |
endfunction | |
command! -nargs=+ -complete=command RSSC call RSSC(<args>) | |
command! -nargs=+ -complete=command RSCS call RSSC(<args>) | |
"""""""""""""""""""""""""""""""""""""" | |
" delimitMate (autoclose braces and stuff) | |
"""""""""""""""""""""""""""""""""""""" | |
let g:delimitMate_expand_cr=2 | |
"""""""""""""""""""""""""""""""""""""" | |
" macOS copy paste with clipboard | |
"""""""""""""""""""""""""""""""""""""" | |
vnoremap <C-c> :w !pbcopy<CR><CR> | |
noremap <C-v> :r !pbpaste<CR><CR> | |
"""""""""""""""""""""""""""""""""""""" | |
" abbreviations | |
"""""""""""""""""""""""""""""""""""""" | |
:ab #b /**************************************** | |
:ab #e *****************************************/ | |
:ab @@ /** | |
\<CR> | |
\<CR>*/ | |
"""""""""""""""""""""""""""""""""""""" | |
" abbreviations | |
"""""""""""""""""""""""""""""""""""""" | |
command XXD % ! xxd | |
"""""""""""""""""""""""""""""""""""""" | |
" airline | |
"""""""""""""""""""""""""""""""""""""" | |
let g:airline_powerline_fonts = 1 | |
"""""""""""""""""""""""""""""""""""""" | |
"" start/stop | |
"""""""""""""""""""""""""""""""""""""" | |
nmap <F1> :!~/run.sh<CR><CR> | |
nmap <F4> :!~/kill.sh<CR><CR> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment