Plug 'luochen1990/rainbow'
Plug 'scrooloose/nerdcommenter'
Plug 'Chiel92/vim-autoformat'

Plug 'SirVer/ultisnips'
Plug 'honza/vim-snippets'

Plug 'skywind3000/asyncrun.vim',        { 'on': ['AsyncRun!', 'AsyncRun'] }
Plug 'nathanaelkane/vim-indent-guides', { 'on': 'IndentGuidesToggle'}

if executable('ctags')
    " Do not lazy loading tagbar, see vim-airline issue 1313.
    Plug 'majutsushi/tagbar'
endif

Add editorconfig-vim to programming layer

Plug 'luochen1990/rainbow'
Plug 'scrooloose/nerdcommenter'
Plug 'Chiel92/vim-autoformat'

Plug 'SirVer/ultisnips'
Plug 'honza/vim-snippets'

Plug 'skywind3000/asyncrun.vim',        { 'on': ['AsyncRun!', 'AsyncRun'] }
Plug 'nathanaelkane/vim-indent-guides', { 'on': 'IndentGuidesToggle'}
Plug 'editorconfig/editorconfig-vim'

if executable('ctags')
    " Do not lazy loading tagbar, see vim-airline issue 1313.
    Plug 'majutsushi/tagbar'
endif


nnoremap <silent> <leader>gs :Gstatus<CR>
nnoremap <silent> <leader>gd :Gdiff<CR>
nnoremap <silent> <leader>gc :Gcommit<CR>
nnoremap <silent> <leader>gb :Gblame<CR>
nnoremap <silent> <leader>gl :Glog<CR>
nnoremap <silent> <leader>gp :Git push<CR>
nnoremap <silent> <leader>gu :Git pull<CR>
nnoremap <silent> <leader>gr :Gread<CR>
nnoremap <silent> <leader>gw :Gwrite<CR>
let g:signify_vcs_list = [ 'git', 'svn' ]

Add nvr command as VISUAL inside nvim

nnoremap <silent> <leader>gs :Gstatus<CR>
nnoremap <silent> <leader>gd :Gdiff<CR>
nnoremap <silent> <leader>gc :Gcommit<CR>
nnoremap <silent> <leader>gb :Gblame<CR>
nnoremap <silent> <leader>gl :Glog<CR>
nnoremap <silent> <leader>gp :Git push<CR>
nnoremap <silent> <leader>gu :Git pull<CR>
nnoremap <silent> <leader>gr :Gread<CR>
nnoremap <silent> <leader>gw :Gwrite<CR>
let g:signify_vcs_list = [ 'git', 'svn' ]

if has('nvim')
  let $VISUAL = 'nvr -cc split --remote-wait'
endif


command! XcodebuildBuild call <sid>build()
command! XcodebuildTest call <sid>test()

let s:plugin_path = expand("<sfile>:p:h:h")

function! s:build()
  let cmd = s:base_command()  . s:xcpretty()
  call s:run_command(cmd)
endfunction

function! s:test()
  let cmd =  s:base_command() . ' -sdk iphonesimulator test' . s:xcpretty()
  call s:run_command(cmd)
endfunction

function! s:run_command(cmd)
  echom a:cmd
  execute '!' . a:cmd
endfunction

function! s:base_command()
  return 'xcodebuild ' . s:build_target() . ' ' . s:scheme()
endfunction

function! s:build_target()
  let xcworkspaceFile = globpath(expand('.'), '*.xcworkspace')
  if empty(xcworkspaceFile)
    return '-project ' . s:project_file()
  else
    return '-workspace ' . xcworkspaceFile
  endif
endfunction

function! s:project_file()
  return globpath(expand('.'), '*.xcodeproj')
endfunction

function! s:scheme()
  let scheme = "silent ! 'sh " . s:plugin_path . "/bin/find_scheme.sh \"" . s:project_file() . "\""
  return '-scheme '. scheme
endfunction

function! s:xcpretty()
  if executable('xcpretty')
    return ' | xcpretty --color --test'
  else
    return ''
  endif
endfunction

Remove logging info from run_command

command! XcodebuildBuild call <sid>build()
command! XcodebuildTest call <sid>test()

let s:plugin_path = expand("<sfile>:p:h:h")

function! s:build()
  let cmd = s:base_command()  . s:xcpretty()
  call s:run_command(cmd)
endfunction

function! s:test()
  let cmd =  s:base_command() . ' -sdk iphonesimulator test' . s:xcpretty()
  call s:run_command(cmd)
endfunction

function! s:run_command(cmd)
  execute '!' . a:cmd
endfunction

function! s:base_command()
  return 'xcodebuild ' . s:build_target() . ' ' . s:scheme()
endfunction

function! s:build_target()
  let xcworkspaceFile = globpath(expand('.'), '*.xcworkspace')
  if empty(xcworkspaceFile)
    return '-project ' . s:project_file()
  else
    return '-workspace ' . xcworkspaceFile
  endif
endfunction

function! s:project_file()
  return globpath(expand('.'), '*.xcodeproj')
endfunction

function! s:scheme()
  let scheme = "silent ! 'sh " . s:plugin_path . "/bin/find_scheme.sh \"" . s:project_file() . "\""
  return '-scheme '. scheme
endfunction

function! s:xcpretty()
  if executable('xcpretty')
    return ' | xcpretty --color --test'
  else
    return ''
  endif
endfunction


" Reload
map <silent> <Leader>r :source ~/.config/nvim/init.vim<CR>:echo "NVIM Reloaded"<CR>

" Keybindings
nnoremap <silent> <F2> :bp<CR>
nnoremap <silent> <F3> :bn<CR>
nnoremap <silent> <leader>ws :split<CR>
nnoremap <silent> <leader>wv :vsplit<CR>
nnoremap <silent> <leader>wS :split<CR><C-W>w
nnoremap <silent> <leader>wV :vsplit<CR><C-W>w
nnoremap <silent> <leader>wd <C-W>q
nnoremap <silent> <leader>w <C-W>

nnoremap <silent> <C-P> :Files<CR>
nnoremap <silent> <leader>p :Files %:h<CR>
nnoremap <silent> <leader>e :NERDTreeToggle %<CR>
nnoremap <silent> <leader>f :NERDTreeToggle<CR>
nnoremap <silent> <leader>b :Buffers<CR>
nnoremap <silent> <leader>s :Rg<CR>
nnoremap <silent> <leader>l :BLines<CR>

nnoremap <silent> <leader>c :echo expand("%:h")<CR>:e %:h/

nnoremap <silent> <leader><tab> :b#<CR>

Add command to vim to close all buffers except current (visible)

" Reload
map <silent> <Leader>r :source ~/.config/nvim/init.vim<CR>:echo "NVIM Reloaded"<CR>

" Keybindings
nnoremap <silent> <F2> :bp<CR>
nnoremap <silent> <F3> :bn<CR>
nnoremap <silent> <leader>ws :split<CR>
nnoremap <silent> <leader>wv :vsplit<CR>
nnoremap <silent> <leader>wS :split<CR><C-W>w
nnoremap <silent> <leader>wV :vsplit<CR><C-W>w
nnoremap <silent> <leader>wd <C-W>q
nnoremap <silent> <leader>w <C-W>

nnoremap <silent> <C-P> :Files<CR>
nnoremap <silent> <leader>p :Files %:h<CR>
nnoremap <silent> <leader>e :NERDTreeToggle %<CR>
nnoremap <silent> <leader>f :NERDTreeToggle<CR>
nnoremap <silent> <leader>b :Buffers<CR>
nnoremap <silent> <leader>s :Rg<CR>
nnoremap <silent> <leader>l :BLines<CR>

nnoremap <silent> <leader>c :echo expand("%:h")<CR>:e %:h/

nnoremap <silent> <leader><tab> :b#<CR>

command Bdo %bd|e#


" dockerfile.vim - Syntax highlighting for Dockerfiles
" Maintainer:   Honza Pokorny <https://honza.ca>
" Version:      0.5

if exists("b:current_syntax")
    finish
endif

let b:current_syntax = "dockerfile"

syntax case ignore

syntax match dockerfileKeyword /\v^\s*(ONBUILD\s+)?(ADD|CMD|ENTRYPOINT|ENV|EXPOSE|FROM|MAINTAINER|RUN|USER|LABEL|VOLUME|WORKDIR|COPY)\s/
highlight link dockerfileKeyword Keyword

syntax region dockerfileString start=/\v"/ skip=/\v\\./ end=/\v"/
highlight link dockerfileString String

syntax match dockerfileComment "\v^\s*#.*$"
highlight link dockerfileComment Comment

set commentstring=#\ %s

Add embedded shell script highlight to vim syntax

" dockerfile.vim - Syntax highlighting for Dockerfiles
" Maintainer:   Honza Pokorny <https://honza.ca>
" Version:      0.5

if exists("b:current_syntax")
    finish
endif

let b:current_syntax = "dockerfile"

syntax case ignore

syntax match dockerfileKeyword /\v^\s*(ONBUILD\s+)?(ADD|CMD|ENTRYPOINT|ENV|EXPOSE|FROM|MAINTAINER|RUN|USER|LABEL|VOLUME|WORKDIR|COPY)\s/
highlight link dockerfileKeyword Keyword

syntax region dockerfileString start=/\v"/ skip=/\v\\./ end=/\v"/
highlight link dockerfileString String

syntax match dockerfileComment "\v^\s*#.*$"
highlight link dockerfileComment Comment

set commentstring=#\ %s

" match "RUN", "CMD", and "ENTRYPOINT" lines, and parse them as shell
let s:current_syntax = b:current_syntax
unlet b:current_syntax
syntax include @SH syntax/sh.vim
let b:current_syntax = s:current_syntax
syntax region shLine matchgroup=dockerfileKeyword start=/\v^\s*(RUN|CMD|ENTRYPOINT)\s/ end=/\v$/ contains=@SH
" since @SH will handle "\" as part of the same line automatically, this "just works" for line continuation too, but with the caveat that it will highlight "RUN echo '" followed by a newline as if it were a block because the "'" is shell line continuation...  not sure how to fix that just yet (TODO)


if !has("gui_running")
  nnoremap <C-t>n :tabnew<CR>
  nnoremap <C-t>1 :tabn 1<CR>
  nnoremap <C-t>2 :tabn 2<CR>
  nnoremap <C-t>3 :tabn 3<CR>
  nnoremap <C-t>4 :tabn 4<CR>
  nnoremap <C-t>5 :tabn 5<CR>
  nnoremap <C-t>6 :tabn 6<CR>
  nnoremap <C-t>7 :tabn 7<CR>
  nnoremap <C-t>8 :tabn 8<CR>
  nnoremap <C-t>9 :tabn 9<CR>
endif

nnoremap vv :vsplit<CR>
nnoremap <C-l> <C-w>l
nnoremap <C-h> <C-w>h
nnoremap <C-j> <C-w>j
nnoremap <C-k> <C-w>k

let g:tmux_navigator_no_mappings = 1

nnoremap <silent> <C-h> :TmuxNavigateLeft<cr>
nnoremap <silent> <C-j> :TmuxNavigateDown<cr>
nnoremap <silent> <C-k> :TmuxNavigateUp<cr>
nnoremap <silent> <C-l> :TmuxNavigateRight<cr>
nnoremap <silent> <BS> :TmuxNavigateLeft<cr>

Add <BS> tmux mapping for nvim only

if !has("gui_running")
  nnoremap <C-t>n :tabnew<CR>
  nnoremap <C-t>1 :tabn 1<CR>
  nnoremap <C-t>2 :tabn 2<CR>
  nnoremap <C-t>3 :tabn 3<CR>
  nnoremap <C-t>4 :tabn 4<CR>
  nnoremap <C-t>5 :tabn 5<CR>
  nnoremap <C-t>6 :tabn 6<CR>
  nnoremap <C-t>7 :tabn 7<CR>
  nnoremap <C-t>8 :tabn 8<CR>
  nnoremap <C-t>9 :tabn 9<CR>
endif

nnoremap vv :vsplit<CR>
nnoremap <C-l> <C-w>l
nnoremap <C-h> <C-w>h
nnoremap <C-j> <C-w>j
nnoremap <C-k> <C-w>k

let g:tmux_navigator_no_mappings = 1

nnoremap <silent> <C-h> :TmuxNavigateLeft<cr>
nnoremap <silent> <C-j> :TmuxNavigateDown<cr>
nnoremap <silent> <C-k> :TmuxNavigateUp<cr>
nnoremap <silent> <C-l> :TmuxNavigateRight<cr>
if has('nvim')
  nnoremap <silent> <BS> :TmuxNavigateLeft<cr>
end


" BEGIN
if exists("g:loaded_VimPivo") || &cp
  finish
endif
let g:loaded_VimPivo = 1
let s:keepcpo        = &cpo
set cpo&vim

" END
let &cpo= s:keepcpo
unlet s:keepcpo

Add :Pivo command which opens Pivotal buffer

" BEGIN
if exists("g:loaded_pivo") || &cp
  finish
endif
let g:loaded_pivo = 1
let s:keepcpo     = &cpo
set cpo&vim

let PivoBufferName = "__Pivotal__"

function! s:PivoBufferOpen()
    " Check whether the scratch buffer is already created
    let scr_bufnum = bufnr(g:PivoBufferName)
    if scr_bufnum == -1
        " open a new scratch buffer
        exe "new " . g:PivoBufferName
    else
        " Pivo buffer is already created,
        " check whether it is open in one of the windows.
        let scr_winnum = bufwinnr(scr_bufnum)
        if scr_winnum != -1
            " Jump to the window which has the scratch buffer if we are not
            " already in that window
            if winnr() != scr_winnum
                exe scr_winnum . "wincmd w"
            endif
        else
            " Create a new scratch buffer
            exe "split +buffer" . scr_bufnum
        endif
    endif
endfunction

command! -nargs=0 Pivo call s:PivoBufferOpen()

" END
let &cpo= s:keepcpo
unlet s:keepcpo


if exists('g:vundle_installing_plugins')
  Plugin 'tomtom/tcomment_vim'
  finish
endif

let g:tcommentMaps = 0
nnoremap <silent><leader>c :TComment<CR>
vnoremap <silent><leader>c :TComment<CR>
nnoremap <silent><leader>cb :TCommentBlock<CR>
vnoremap <silent><leader>cb :TCommentBlock<CR>

" Use '//' for C comments instead of '/* .. */'
call tcomment#DefineType('c', '// %s')

Revert "feat: use <leader>c to toggle comment"

if exists('g:vundle_installing_plugins')
  Plugin 'tomtom/tcomment_vim'
  finish
endif

let g:tcommentMaps = 0
nnoremap <silent><leader>cc :TComment<CR>
vnoremap <silent><leader>cc :TComment<CR>
nnoremap <silent><leader>cb :TCommentBlock<CR>
vnoremap <silent><leader>cb :TCommentBlock<CR>

" Use '//' for C comments instead of '/* .. */'
call tcomment#DefineType('c', '// %s')


if has("gui_macvim")
  macmenu &File.New\ Tab key=<nop>
  map <D-t> :CommandT<CR>
  imap <D-t> <Esc>:CommandT<CR>
endif

Add mappings for non-osx systems.

if has("gui_macvim")
  macmenu &File.New\ Tab key=<nop>

  map <D-t> :CommandT<CR>
  imap <D-t> <ESC>:CommandT<CR>

  map <D-M-t> :CommandTFlush<CR>
  imap <D-M-t> <ESC>:CommandTFlush<CR>
else
  map <C-t> :CommandT<CR>
  imap <C-t> <ESC>:CommandT<CR>

  map <C-M-t> :CommandTFlush<CR>
  imap <C-M-t> <ESC>:CommandTFlush<CR>
endif

map <M-t> :CommandTBuffer<CR>
imap <M-t> <ESC>:CommandTBuffer<CR>


let s:save_cpo = &cpo
set cpo&vim

if exists('g:markdown_pl_loaded')
    finish
endif

let g:markdown_pl_home = fnamemodify(expand('<sfile>'), ':p:h:h:gs?\\?/?')

command! -nargs=0 MarkDownPreview call MarkDownPreview()

function! MarkDownPreview()
    let s:fileName = expand("%:p:r").'.html'
    silent exec '!'.g:markdown_pl_home.'/bin/markdown.pl % >  '.s:fileName
    exec '!xdg-open file://'.s:fileName
    echon "\r\r"
    echon ''
endf

let g:markdown_pl_loaded = 1

let &cpo = s:save_cpo
unlet s:save_cpo

Remove generate file after preview

let s:save_cpo = &cpo
set cpo&vim

if exists('g:markdown_pl_loaded')
    finish
endif

let g:markdown_pl_home = fnamemodify(expand('<sfile>'), ':p:h:h:gs?\\?/?')

command! -nargs=0 MarkDownPreview call MarkDownPreview()

function! MarkDownPreview()
    let s:fileName = expand("%:p:r").'.html'
    silent exec '!'.g:markdown_pl_home.'/bin/markdown.pl % >  '.s:fileName
    call system('xdg-open file://'.s:fileName)
    call system('rm '.s:fileName)
endf

let g:markdown_pl_loaded = 1

let &cpo = s:save_cpo
unlet s:save_cpo


" make the mouse do sane things
set mouse=a

filetype plugin indent on
" show tabs as 2 spaces
set tabstop=2
" indenting with '>', uses 2 spaces
set shiftwidth=2
" tab, inserts spaces
set expandtab


" Cameron Rossington File definition vimscript
" created 170605

" ##### Python #####
au BufNewFile,BufRead *.py,*.pyw  "PEP8 style settings
  \ set tabstop=4       |
  \ set softtabstop=4   |
  \ set shiftwidth=4    |
  \ set expandtab       |
  \ set autoindent      |
  \ set fileformat=unix |
  \ setlocal colorcolumn=100

" ##### Web Files #####
au BufNewFile,BufRead *.js,*.css,*.htm,*.html,*.php
  \ set tabstop=2     |
  \ set softtabstop=2 |
  \ set shiftwidth=2  |
  \ set noexpandtab   |
  \ set autoindent    |
  \ set fileformat=unix

" ##### C files #####
au BufNewFile,BufRead *.c,*.h
  \ set tabstop=4     |
  \ set softtabstop=4 |
  \ set shiftwidth=4  |
  \ set noexpandtab   |
  \ set filetype=c    |
  \ set colorcolumn=100

" ##### journal files #####
au BufNewFile,BufRead *.jo
  \ set wrap |
  \ set cc=0 |
  \ set nonumber

" ##### test/status files #####
au BufNewFile,BufRead *.txt
  \ set cc=0    |
  \ set autoread

" ##### logfiles #####
au BufNewFile,BufRead *.log
  \ set cc=0
  \ setlocal foldlevel = 1

Fix issue with local and global settings.

" Cameron Rossington File definition vimscript
" created 170605

" ##### Python #####
au BufNewFile,BufRead *.py,*.pyw  "PEP8 style settings
  \ set tabstop=4       |
  \ set softtabstop=4   |
  \ set shiftwidth=4    |
  \ set expandtab       |
  \ set autoindent      |
  \ set fileformat=unix |
  \ setlocal colorcolumn=100

" ##### Web Files #####
au BufNewFile,BufRead *.js,*.css,*.htm,*.html,*.php
  \ set tabstop=2     |
  \ set softtabstop=2 |
  \ set shiftwidth=2  |
  \ set noexpandtab   |
  \ set autoindent    |
  \ set fileformat=unix

" ##### C files #####
au BufNewFile,BufRead *.c,*.h
  \ set tabstop=4     |
  \ set softtabstop=4 |
  \ set shiftwidth=4  |
  \ set noexpandtab   |
  \ set filetype=c    |
  \ set colorcolumn=100

" ##### journal files #####
au BufNewFile,BufRead *.jo
  \ set wrap |
  \ set cc=0 |
  \ set nonumber

" ##### test/status files #####
au BufNewFile,BufRead *.txt
  \ set cc=0    |
  \ set autoread

" ##### logfiles #####
au BufNewFile,BufRead *.log
  \ set cc=0
  \ set foldlevel = 1


set background=dark
colorscheme solarized

" textwidth < 81 please
set colorcolumn=81

" Big Menlo
set guifont=Menlo:h16

Reduce GUI font size in Vim

set background=dark
colorscheme solarized

" textwidth < 81 please
set colorcolumn=81

" Medium Menlo
set guifont=Menlo:h15


if has('autocmd') && !exists('autocommands_loaded')
  " Load autocommands only once
  let autocommands_loaded = 1

  " === File type settings ===
  " Disable comment continuation when using 'o' or 'O'
  autocmd FileType * setlocal formatoptions-=o
  " Enable java completion
  autocmd FileType java set omnifunc=javacomplete#Complete
  " Activate spell checking for relevant files
  autocmd FileType gitcommit,markdown,tex set spell
  " Use tags from ~/.tags/<filetype>
  autocmd FileType * exec "setlocal tags+=~/.tags/" . &filetype

  " === Tab settings ===
  autocmd FileType python setlocal shiftwidth=4 softtabstop=4 expandtab
  autocmd FileType make setlocal ts=8 sts=8 sw=8 noexpandtab

  " === Pane settings ===
  " Resize panes when resizing window
  autocmd VimResized * wincmd =
  " Make quickfix windows take all the lower section of the screen when there
  " are multiple windows open
  autocmd FileType qf wincmd J

  " === Buffer settings ===
  " Recognise markdown files properly
  autocmd BufRead,BufNewFile *.md set filetype=markdown
  " Refresh trailing whitespace indicator
  autocmd BufRead,BufWritePost * unlet! b:statusline_trailing_space_warning
endif

Remove forcing the quickfix window to the bottom

if has('autocmd') && !exists('autocommands_loaded')
  " Load autocommands only once
  let autocommands_loaded = 1

  " === File type settings ===
  " Disable comment continuation when using 'o' or 'O'
  autocmd FileType * setlocal formatoptions-=o
  " Enable java completion
  autocmd FileType java set omnifunc=javacomplete#Complete
  " Activate spell checking for relevant files
  autocmd FileType gitcommit,markdown,tex set spell
  " Use tags from ~/.tags/<filetype>
  autocmd FileType * exec "setlocal tags+=~/.tags/" . &filetype

  " === Tab settings ===
  autocmd FileType python setlocal shiftwidth=4 softtabstop=4 expandtab
  autocmd FileType make setlocal ts=8 sts=8 sw=8 noexpandtab

  " === Pane settings ===
  " Resize panes when resizing window
  autocmd VimResized * wincmd =

  " === Buffer settings ===
  " Recognise markdown files properly
  autocmd BufRead,BufNewFile *.md set filetype=markdown
  " Refresh trailing whitespace indicator
  autocmd BufRead,BufWritePost * unlet! b:statusline_trailing_space_warning
endif


set directory=~/.vim/backup
set backupdir=~/.vim/backup

set smartindent
set tabstop=2
set shiftwidth=2
set expandtab

set ai
set number
set hlsearch
set ignorecase
set smartcase

set spell spelllang=en_us
set mousemodel=popup_setpos

let g:NERDTreeChDirMode = 2

let g:DeleteTrailingWhitespace = 1
let g:DeleteTrailingWhitespace_Action = 'delete'

if has('gui_running')
  colorscheme molokai
  set background=dark
else
  set background=dark
endif

Set guifont to Inconsolata XL.

set directory=~/.vim/backup
set backupdir=~/.vim/backup

set smartindent
set tabstop=2
set shiftwidth=2
set expandtab

set ai
set number
set hlsearch
set ignorecase
set smartcase

set spell spelllang=en_us
set mousemodel=popup_setpos

let g:NERDTreeChDirMode = 2

let g:DeleteTrailingWhitespace = 1
let g:DeleteTrailingWhitespace_Action = 'delete'

if has('gui_running')
  colorscheme molokai
  set background=dark
else
  set background=dark
endif

if has('gui_running')
  set guifont=Inconsolata\ XL\ 10
endif


"function! GetCompDB()
"    exec CMakeCompDB()
"endfunc
"let FnCMakeCompDB = function("GetCompDB")
"let funccmakecompdb = string(FnCMakeCompDB)
"let RunCMakeCompDB = function('GetCompDB')
"   let self.fn = function("GetCompDB")
"function cmake.run() dict
"   let self.fn = FnCMakeCompDB
"endfunction
"let g:neomake_cmakecompdb_maker = {
"    \ 'exe': string(FnCMakeCompDB),
"    \ 'args': ['']
"    \ }
nmap <unique> <Plug>GenerateCompDB :exec CMakeCompDB()<CR>
function! CMakeTargets()
    echo "Get CMake Targets"
endfunction

Fix command mapping for plugin.

"function! GetCompDB()
"    exec CMakeCompDB()
"endfunc
"let FnCMakeCompDB = function("GetCompDB")
"let funccmakecompdb = string(FnCMakeCompDB)
"let RunCMakeCompDB = function('GetCompDB')
"   let self.fn = function("GetCompDB")
"function cmake.run() dict
"   let self.fn = FnCMakeCompDB
"endfunction
"let g:neomake_cmakecompdb_maker = {
"    \ 'exe': string(FnCMakeCompDB),
"    \ 'args': ['']
"    \ }
nnoremap <unique> <Plug>GenerateCompDB :exec CMakeCompDB()<CR>
function! CMakeTargets()
    echo "Get CMake Targets"
endfunction


iab <buffer> co const
iab <buffer> re return

noremap <leader>SC /^export default class \(\w\+\) extends React.\(Pure\)\?Component<Props> {\n  public render() {\n\(\(^$\n\\|    .*\n\)*\)  }\n}<CR>
noremap <leader>Sc :%s/^export default class \(\w\+\) extends React.\(Pure\)\?Component<Props> {\n  public render() {\n\(\(^$\n\\|    .*\n\)*\)  }\n}/export default function \1(props: Props) {\r\3}/g<CR>V%:s/this\.props/props/g<CR>

Update TypeScript class conversion scripts

iab <buffer> co const
iab <buffer> re return

noremap <leader>SC /class \(\w\+\) extends React.\(Pure\)\?Component<\([A-Za-z]\+\)> {\n  public render() {\n\(\(^$\n\\|    .*\n\)*\)  }\n}<CR>
noremap <leader>Sc :%s/class \(\w\+\) extends React.\(Pure\)\?Component<\([A-Za-z]\+\)> {\n  public render() {\n\(\(^$\n\\|    .*\n\)*\)  }\n}/function \1(props: \3) {\r\4}/g<CR>V%:s/this\.props/props/g<CR>

noremap <leader>SF /class \(\w\+\) extends React.\(Pure\)\?Component {\n  public render() {\n\(\(^$\n\\|    .*\n\)*\)  }\n}<CR>
noremap <leader>Sf :%s/class \(\w\+\) extends React.\(Pure\)\?Component {\n  public render() {\n\(\(^$\n\\|    .*\n\)*\)  }\n}/function \1() {\r\3}/g<CR>V%:s/this\.props/props/g<CR>


" Fugitive key mappings
nnoremap <leader>gs :Gstatus<cr>
nnoremap <leader>gc :Gcommit
nnoremap <leader>gl :Glog
nnoremap <leader>gw :Gwrite<cr>
nnoremap <leader>gd :Gdiff

Add <cr> to Fugitive :Gcommit mapping

" Fugitive key mappings
nnoremap <leader>gs :Gstatus<cr>
nnoremap <leader>gc :Gcommit<cr>
nnoremap <leader>gl :Glog
nnoremap <leader>gw :Gwrite<cr>
nnoremap <leader>gd :Gdiff


set background=dark

try
    colorscheme molokai
catch /^Vim\%((\a\+)\)\=:E185/
    " Well, not much I can do at the moment
endtry

set autoindent

set showmatch
set matchpairs=(:),{:},[:],<:>

"Show line numbers
set nu

"Extra highlighting settings
au InsertEnter * match ExtraWhitespace /\s\+\%#\@<!$/
au InsertLeave * match ExtraWhitespace /\s\+$/
highlight ExtraWhiteSpace ctermbg=52
setlocal spell spelllang=en_gb
hi SpellBad term=reverse ctermfg=white ctermbg=darkred
set hlsearch

" Always show the status bar at the bottom of the window
set laststatus=2
set incsearch

" Don't show the mode if we are using lightline.
if exists('g:solarnz_will_load_lightline')
    set noshowmode
endif

set list lcs=trail:·,tab:»·

let &t_SI = "\e]50;CursorShape=1\x7"
let &t_EI = "\e]50;CursorShape=0\x7"

Remove my custom SpellBad highlighting.

set background=dark

try
    colorscheme molokai
catch /^Vim\%((\a\+)\)\=:E185/
    " Well, not much I can do at the moment
endtry

set autoindent

set showmatch
set matchpairs=(:),{:},[:],<:>

"Show line numbers
set nu

"Extra highlighting settings
au InsertEnter * match ExtraWhitespace /\s\+\%#\@<!$/
au InsertLeave * match ExtraWhitespace /\s\+$/
highlight ExtraWhiteSpace ctermbg=52
setlocal spell spelllang=en_gb
set hlsearch

" Always show the status bar at the bottom of the window
set laststatus=2
set incsearch

" Don't show the mode if we are using lightline.
if exists('g:solarnz_will_load_lightline')
    set noshowmode
endif

set list lcs=trail:·,tab:»·

let &t_SI = "\e]50;CursorShape=1\x7"
let &t_EI = "\e]50;CursorShape=0\x7"


" Vim filetype detect
" Language:    Nix
" Maintainer:  Daiderd Jordan <daiderd@gmail.com>
" URL:         https://github.com/LnL7/vim-nix

au BufRead,BufNewFile *.nix set filetype=nix

Use setfiletype instead of set filetype

" Vim filetype detect
" Language:    Nix
" Maintainer:  Daiderd Jordan <daiderd@gmail.com>
" URL:         https://github.com/LnL7/vim-nix

au BufRead,BufNewFile *.nix setf nix


Plug 'tpope/vim-fugitive'
Plug 'tommcdo/vim-fugitive-blame-ext'
Plug 'airblade/vim-gitgutter'
Plug 'junegunn/gv.vim'

Add vim-rhubarb to git layer

Plug 'tpope/vim-fugitive'
Plug 'tpope/vim-rhubarb'
Plug 'tommcdo/vim-fugitive-blame-ext'
Plug 'airblade/vim-gitgutter'
Plug 'junegunn/gv.vim'


nnoremap <Leader>gb :Gblame<CR>
nnoremap <Leader>gd :Gdiff<CR>

Add git add and commit leader commands

nnoremap <Leader>gb :Gblame<CR>
nnoremap <Leader>gd :Gdiff<CR>
nnoremap <Leader>ga :Gwrite<CR>
nnoremap <Leader>gc :Gcommit -v<CR>


if exists('g:my_plugin_loaded_ncm2')
  finish
end

call my_plugin#add('ncm2/ncm2')
call my_plugin#add('roxma/nvim-yarp')
call my_plugin#add('ncm2/float-preview.nvim')

" enable ncm2 for all buffers
augroup activate_ncm2
  au!
  autocmd BufEnter * call ncm2#enable_for_buffer()
augroup END

" IMPORTANT: :help Ncm2PopupOpen for more information
set completeopt=noinsert,menuone,noselect

au User Ncm2Plugin call ncm2#register_source({
        \ 'name' : 'todo',
        \ 'priority': 9,
        \ 'scope': ['todo'],
        \ 'mark': 'todo',
        \ 'word_pattern': '[+@]\S+',
        \ 'complete_length': -1,
        \ 'complete_pattern': '[+@]',
        \ 'on_complete': ['ncm2#on_complete#omni', 'todo#Complete'],
        \ })

Fix post source loading of Ncm2

if exists('g:my_plugin_loaded_ncm2')
  finish
end

call my_plugin#add('ncm2/ncm2')
call my_plugin#add('roxma/nvim-yarp')
call my_plugin#add('ncm2/float-preview.nvim')

" enable ncm2 for all buffers
function Hook_post_source_ncm2()
  augroup activate_ncm2
    au!
    autocmd BufEnter * call ncm2#enable_for_buffer()
  augroup END

  " IMPORTANT: :help Ncm2PopupOpen for more information
  set completeopt=noinsert,menuone,noselect

  au User Ncm2Plugin call ncm2#register_source({
          \ 'name' : 'todo',
          \ 'priority': 9,
          \ 'scope': ['todo'],
          \ 'mark': 'todo',
          \ 'word_pattern': '[+@]\S+',
          \ 'complete_length': -1,
          \ 'complete_pattern': '[+@]',
          \ 'on_complete': ['ncm2#on_complete#omni', 'todo#Complete'],
          \ })
endfunction


"""""""""""""""""""""""""""
" nvim-tree Settings
"""""""""""""""""""""""""""

let g:nvim_tree_width = 40 "30 by default
let g:nvim_tree_ignore = [ '.git', 'node_modules', '.cache', '.DS_STORE' ] "empty by default
let g:nvim_tree_auto_close = 1 "0 by default, closes the tree when it's the last window
let g:nvim_tree_follow = 1 "0 by default, this option allows the cursor to be updated when entering a buffer

noremap <silent> <leader>n :NvimTreeToggle<CR>
nnoremap <leader>r :NvimTreeRefresh<CR>

Update custom bindings for nvim tree

"""""""""""""""""""""""""""
" nvim-tree Settings
"""""""""""""""""""""""""""

let g:nvim_tree_width = 40 "30 by default
let g:nvim_tree_ignore = [ '.git', 'node_modules', '.cache', '.DS_STORE' ] "empty by default
let g:nvim_tree_auto_close = 1 "0 by default, closes the tree when it's the last window
let g:nvim_tree_follow = 1 "0 by default, this option allows the cursor to be updated when entering a buffer

noremap <silent> <leader>n :NvimTreeToggle<CR>
nnoremap <leader>r :NvimTreeRefresh<CR>

lua <<EOF
    local tree_cb = require'nvim-tree.config'.nvim_tree_callback
    vim.g.nvim_tree_bindings = {
      ["w"]          = tree_cb("vsplit"),
      ["s"]          = tree_cb("split"),
    }
EOF


" plugin/plug-vim-test.vim
nmap <silent> t<C-n> :TestNearest<CR> " t Ctrl+n
nmap <silent> t<C-f> :TestFile<CR>    " t Ctrl+f
nmap <silent> t<C-s> :TestSuite<CR>   " t Ctrl+s
nmap <silent> t<C-l> :TestLast<CR>    " t Ctrl+l
nmap <silent> t<C-g> :TestVisit<CR>   " t Ctrl+g

" make test commands execute using neomake
let test#strategy = "basic"

" set project root dir
let test#project_root = dkoproject#GetRoot()

Use vimux test strategy by default

" plugin/plug-vim-test.vim
nmap <silent> t<C-n> :TestNearest<CR> " t Ctrl+n
nmap <silent> t<C-f> :TestFile<CR>    " t Ctrl+f
nmap <silent> t<C-s> :TestSuite<CR>   " t Ctrl+s
nmap <silent> t<C-l> :TestLast<CR>    " t Ctrl+l
nmap <silent> t<C-g> :TestVisit<CR>   " t Ctrl+g

" make test commands execute using neomake
let test#strategy = "vimux"

" set project root dir
let test#project_root = dkoproject#GetRoot()


if has("gui_running")
  let g:airline_powerline_fonts = 1
  if !exists('g:airline_symbols')
    let g:airline_symbols = {}
  endif
  let g:airline_symbols.space = "\ua0"
  " always show statusline
  set laststatus=2
endif

set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*

let g:syntastic_enable_signs=1
let g:syntastic_auto_loc_list=0
let g:syntastic_always_populate_loc_list = 0

let g:syntastic_error_symbol='✗'
let g:syntastic_style_error_symbol='✗'
let g:syntastic_warning_symbol='⚠'
let g:syntastic_style_warning_symbol='⚠'

"let g:syntastic_javascript_checkers = ['jshint']
let g:syntastic_javascript_checkers = ['jscs']

"let g:syntastic_javascript_jshint_args = '--config ~/.vim/syntax/jshintrc'
let g:syntastic_coffee_coffeelint_args = "--csv --file ~/.vim/syntax/coffeelint.json"

let jshint2_read = 0
let jshint2_save = 0

set runtimepath+=~/.vim/bundle/jshint2.vim/

Add eslint as default js checker

if has("gui_running")
  let g:airline_powerline_fonts = 1
  if !exists('g:airline_symbols')
    let g:airline_symbols = {}
  endif
  let g:airline_symbols.space = "\ua0"
  " always show statusline
  set laststatus=2
endif

set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*

let g:syntastic_enable_signs=1
let g:syntastic_auto_loc_list=0
let g:syntastic_always_populate_loc_list = 0

let g:syntastic_error_symbol='✗'
let g:syntastic_style_error_symbol='✗'
let g:syntastic_warning_symbol='⚠'
let g:syntastic_style_warning_symbol='⚠'

"let g:syntastic_javascript_checkers = ['jshint']
let g:syntastic_javascript_checkers = ['eslint']

"let g:syntastic_javascript_jshint_args = '--config ~/.vim/syntax/jshintrc'
let g:syntastic_coffee_coffeelint_args = "--csv --file ~/.vim/syntax/coffeelint.json"

let jshint2_read = 0
let jshint2_save = 0

set runtimepath+=~/.vim/bundle/jshint2.vim/


set background=dark
colorscheme solarized

" textwidth < 81 please
set colorcolumn=81

" Medium Menlo
set guifont=Consolas:h16

Use Consolas for Powerline in Vim

set background=dark
colorscheme solarized

" textwidth < 81 please
set colorcolumn=81

" Medium Consolas for Powerline
set guifont=Consolas\ for\ Powerline:h16


" include_recipe 'current_cookbook::foo' => ./foo.rb
" include_recipe 'apache2::ssl' => apache2/recipes/ssl.rb
" include_recipe 'apache2' => 'apache2/recipes/default.rb

" Make gf work on Chef include_recipe lines
" Add all cookbooks/*/recipe dirs to Vim's path variable
setlocal path+=.;cookbooks

setlocal isfname+=:
setlocal includeexpr=substitute(substitute(v:fname,'::','/recipes/',''),'$','.rb','')

" Ruby's
" setlocal includeexpr=substitute(substitute(v:fname,'::','/recipes/default','g'),'$','.rb','')

Make gf work with include_recipe 'cookbook::recipe'

" Handle these cases:
" include_recipe 'current_cookbook::foo' => ./foo.rb
" include_recipe "#{cookbook_name}::foo" => ./foo.rb
" include_recipe 'apache2::ssl' => apache2/recipes/ssl.rb
function! ChefIncludeExpr(file)
  let l:match_colon = match(a:file, '::')

  if l:match_colon == 0
    " a:file == '::foo'
    " This is an edge case, e.g. include_recipe "#{cookbook_name}::log-parser"
    let l:included_recipe=substitute(substitute(a:file, '::', '',''), '$','.rb','')
  elseif l:match_colon > 0
    " a:file == 'git::source'
    " This is the most likely case
    let l:included_recipe=substitute(substitute(a:file,'::','/recipes/',''),'$','.rb','')
  else
    " if we get here, the user has 'gf' on something which isn't a filename
    " return the string and let Vim handle it natively
    return a:file
  endif

  return l:included_recipe
endfunction

" Make gf work on Chef include_recipe lines
" Add all cookbooks/*/recipe dirs to Vim's path variable
setlocal path+=.;cookbooks
setlocal includeexpr=ChefIncludeExpr(v:fname)
setlocal isfname+=:

" make this case work:
" include_recipe 'apache2' => apache2/recipes/default.rb
setlocal suffixesadd+=/recipes/default.rb

" TODO: Add Berkshelf support
" require 'berkshelf'
" cbs = Berkshelf.cookbook_store
" cbs.storage_path.to_path


" Author: Tomota Nakamura <https://github.com/tomotanakamura>
" Description: clang linter for cpp files

call ale#Set('cpp_clang_executable', 'clang++')
call ale#Set('cpp_clang_options', '-std=c++14 -Wall')

function! ale_linters#cpp#clang#GetExecutable(buffer) abort
    return ale#Var(a:buffer, 'cpp_clang_executable')
endfunction

function! ale_linters#cpp#clang#GetCommand(buffer) abort
    let l:paths = ale#c#FindLocalHeaderPaths(a:buffer)

    " -iquote with the directory the file is in makes #include work for
    "  headers in the same directory.
    return ale#Escape(ale_linters#cpp#clang#GetExecutable(a:buffer))
    \   . ' -S -x c++ -fsyntax-only '
    \   . '-iquote ' . ale#Escape(fnamemodify(bufname(a:buffer), ':p:h')) . ' '
    \   . ale#c#IncludeOptions(l:paths)
    \   . ale#Var(a:buffer, 'cpp_clang_options') . ' -'
endfunction

call ale#linter#Define('cpp', {
\   'name': 'clang',
\   'output_stream': 'stderr',
\   'executable_callback': 'ale_linters#cpp#clang#GetCommand',
\   'command_callback': 'ale_linters#cpp#clang#GetCommand',
\   'callback': 'ale#handlers#gcc#HandleGCCFormat',
\})

Fix another executable callback typo

" Author: Tomota Nakamura <https://github.com/tomotanakamura>
" Description: clang linter for cpp files

call ale#Set('cpp_clang_executable', 'clang++')
call ale#Set('cpp_clang_options', '-std=c++14 -Wall')

function! ale_linters#cpp#clang#GetExecutable(buffer) abort
    return ale#Var(a:buffer, 'cpp_clang_executable')
endfunction

function! ale_linters#cpp#clang#GetCommand(buffer) abort
    let l:paths = ale#c#FindLocalHeaderPaths(a:buffer)

    " -iquote with the directory the file is in makes #include work for
    "  headers in the same directory.
    return ale#Escape(ale_linters#cpp#clang#GetExecutable(a:buffer))
    \   . ' -S -x c++ -fsyntax-only '
    \   . '-iquote ' . ale#Escape(fnamemodify(bufname(a:buffer), ':p:h')) . ' '
    \   . ale#c#IncludeOptions(l:paths)
    \   . ale#Var(a:buffer, 'cpp_clang_options') . ' -'
endfunction

call ale#linter#Define('cpp', {
\   'name': 'clang',
\   'output_stream': 'stderr',
\   'executable_callback': 'ale_linters#cpp#clang#GetExecutable',
\   'command_callback': 'ale_linters#cpp#clang#GetCommand',
\   'callback': 'ale#handlers#gcc#HandleGCCFormat',
\})


" Toggle Tagbar.
nnoremap <silent> <Leader>oc :<C-U>TagbarToggle<CR>
nnoremap <silent> <Leader>c :<C-U>TagbarOpen fj<CR>

Use t for ctag mappings

" Toggle Tagbar.
nnoremap <silent> <Leader>ot :<C-U>TagbarToggle<CR>
nnoremap <silent> <Leader>t :<C-U>TagbarOpen fj<CR>


let g:EasyClipShareYanks = 1
let g:EasyClipAutoFormat = 1
let g:EasyClipUseSubstituteDefaults = 1
let g:EasyClipUseGlobalPasteToggle = 0

" Remap cut operation
let g:EasyClipUseCutDefaults = 0
nmap dc <Plug>MoveMotionPlug
xmap dc <Plug>MoveMotionXPlug
nmap dC <Plug>MoveMotionEndOfLinePlug
nmap dcc <Plug>MoveMotionLinePlug

" Remap Yank cycle
let g:EasyClipUsePasteToggleDefaults = 0
nmap ]y <plug>EasyClipSwapPasteForward
nmap [y <plug>EasyClipSwapPasteBackwards

" Ctrl-v pastes
imap <c-v> <plug>EasyClipInsertModePaste
cmap <c-v> <plug>EasyClipCommandModePaste

" Yank buffer
map <leader>yy :Yanks<cr>
map <leader>ip :IPaste<cr>

Change easyclip to adhere to normal deletes

let g:EasyClipShareYanks = 1
let g:EasyClipAutoFormat = 1
let g:EasyClipUseSubstituteDefaults = 1
let g:EasyClipUseGlobalPasteToggle = 0

" Remap cut operation
let g:EasyClipEnableBlackHoleRedirect = 0
let g:EasyClipUseCutDefaults = 0
nmap dc "_d
xmap dc "_d
nmap dcc "_dd

" Remap Yank cycle
let g:EasyClipUsePasteToggleDefaults = 0
nmap ]y <plug>EasyClipSwapPasteForward
nmap [y <plug>EasyClipSwapPasteBackwards

" Ctrl-v pastes
imap <c-v> <plug>EasyClipInsertModePaste
cmap <c-v> <plug>EasyClipCommandModePaste

" Yank buffer
map <leader>yy :Yanks<cr>
map <leader>ip :IPaste<cr>


" File tree browser - backslash
map - :NERDTreeToggle<CR>
" File tree browser showing current file - pipe (shift-backslash)
map _ :NERDTreeFind<CR>

Remove comment on Nerdtree settings

nnoremap - :NERDTreeToggle<CR>
nnoremap _ :NERDTreeFind<CR>


set shiftwidth=8
set softtabstop=8
set noexpandtab
set nolist

" Code navigation
nmap <C-UP> gd
nmap <C-DOWN> :GoReferrers<CR>

" Not working very well :-(
nmap <Leader>d <Plug>(go-doc)
nmap <Leader>l :GoMetaLinter<CR>
nmap <Leader>i :GoImplements<CR>
nmap <Leader>r <Plug>(go-rename)
nmap <F5> <Plug>(go-coverage)

"vimgrep word under cursor
nnoremap <Leader>g yiw:vimgrep /<C-r>"/g **/*.go

let g:go_highlight_functions = 1
let g:go_highlight_methods = 1
let g:go_highlight_structs = 1
let g:go_highlight_interfaces = 1
let g:go_highlight_operators = 1
let g:go_highlight_build_constraints = 1

let g:go_fmt_command = "goimports"

let g:syntastic_go_checkers = ['golint', 'govet', 'errcheck']
let g:syntastic_mode_map = { 'mode': 'active', 'passive_filetypes': ['go'] }

let g:go_list_type = "quickfix"

Add shortcut to run tests

set shiftwidth=8
set softtabstop=8
set noexpandtab
set nolist

" Code navigation
nmap <C-UP> gd
nmap <C-DOWN> :GoReferrers<CR>

" Not working very well :-(
nmap <Leader>d <Plug>(go-doc)
nmap <Leader>l :GoMetaLinter<CR>
nmap <Leader>i :GoImplements<CR>
nmap <Leader>r <Plug>(go-rename)
nmap <Leader>b <Plug>(go-test)
nmap <F5> <Plug>(go-coverage)

"vimgrep word under cursor
nnoremap <Leader>g yiw:vimgrep /<C-r>"/g **/*.go

let g:go_highlight_functions = 1
let g:go_highlight_methods = 1
let g:go_highlight_structs = 1
let g:go_highlight_interfaces = 1
let g:go_highlight_operators = 1
let g:go_highlight_build_constraints = 1

let g:go_fmt_command = "goimports"

let g:syntastic_go_checkers = ['golint', 'govet', 'errcheck']
let g:syntastic_mode_map = { 'mode': 'active', 'passive_filetypes': ['go'] }

let g:go_list_type = "quickfix"


function AutoFormat()
  "Save cursor position
  let l:winview = winsaveview()

  "Remove trailing whitespace
  %s/\s\+$//e

  "Perform indentation
  norm gg=G

  "Insert two newlines after any 'end'
  %s/end\n\n*/end\r\r/e

  "Remove blank lines after a comma
  %s/,\n\n*/,\r/e

  "Remove all newlines before 'end'
  %s/^\n*\( *\)end/\1end/e

  "Remove all newlines before 'else'
  %s/^\n*\( *\)else/\1else/e

  "Standard indentation for scenarios
  %s/\n*  Scenario/\r\r  Scenario/e

  "Standard indentation for scenarios
  %s/\(@\w\+\)\n\n  Scenario/\1\r  Scenario/e

  "Remove trailing newlines
  %s/\n*\%$//e

  "CSS-only fixes
  if expand('%:e') == 'css' || expand('%:e') == 'scss'
    "Insert a space after all colons
    %s/:\s*\(\w\)/: \1/e

    "Insert a return character after all }
    %s/\}\n*/}\r/e

    "Insert a second return character between } and other styles
    %s/\}\n\(\s*[\w#\.&]\)/}\r\r\1/e
  endif

  "Remove highlighting
  nohls

  "Restore cursor position
  call winrestview(l:winview)
endfunction

Remove spaces for :hover and :checked attributes

function AutoFormat()
  "Save cursor position
  let l:winview = winsaveview()

  "Remove trailing whitespace
  %s/\s\+$//e

  "Perform indentation
  norm gg=G

  "Insert two newlines after any 'end'
  %s/end\n\n*/end\r\r/e

  "Remove blank lines after a comma
  %s/,\n\n*/,\r/e

  "Remove all newlines before 'end'
  %s/^\n*\( *\)end/\1end/e

  "Remove all newlines before 'else'
  %s/^\n*\( *\)else/\1else/e

  "Standard indentation for scenarios
  %s/\n*  Scenario/\r\r  Scenario/e

  "Standard indentation for scenarios
  %s/\(@\w\+\)\n\n  Scenario/\1\r  Scenario/e

  "Remove trailing newlines
  %s/\n*\%$//e

  "CSS-only fixes
  if expand('%:e') == 'css' || expand('%:e') == 'scss'
    "Insert a space after all colons
    %s/:\s*\(\w\)/: \1/e

    "Remove space if it's a declaration like :hover
    %s/: \(.*[{,]\)/:\1/e

    "Insert a return character after all }
    %s/\}\n*/}\r/e

    "Insert a second return character between } and other styles
    %s/\}\n\(\s*[\w#\.&]\)/}\r\r\1/e
  endif

  "Remove highlighting
  nohls

  "Restore cursor position
  call winrestview(l:winview)
endfunction


" ========================================
" Common Plugins
" ========================================
Plug 'kien/ctrlp.vim'
Plug 'terryma/vim-multiple-cursors'
Plug 'ddollar/nerdcommenter'
Plug 'scrooloose/nerdtree'
Plug 'ervandew/supertab'
Plug 'majutsushi/tagbar'
Plug 'Lokaltog/vim-easymotion'
Plug 'bronson/vim-trailing-whitespace'
Plug 'rking/ag.vim'
Plug 'junegunn/vim-emoji'
Plug 'scrooloose/syntastic'
Plug 'Shougo/deoplete.nvim'
Plug 'junegunn/rainbow_parentheses.vim'

" ========================================
" Syntaxes
" ========================================
" All in one
Plug 'sheerun/vim-polyglot'

" Haskell
Plug 'Shougo/vimproc.vim', {'do': 'make'}
Plug 'eagletmt/ghcmod-vim'
Plug 'Twinside/vim-hoogle'
Plug 'eagletmt/neco-ghc'

" PureScript
Plug 'frigoeu/psc-ide-vim'

" ========================================
" Appearance and Usability
" ========================================

" Color Scheme
Plug 'joshdick/onedark.vim'

" Enjoy some hard time!
Plug 'takac/vim-hardtime'

Add matchtag vim plugin for html

" ========================================
" Common Plugins
" ========================================
Plug 'kien/ctrlp.vim'
Plug 'terryma/vim-multiple-cursors'
Plug 'ddollar/nerdcommenter'
Plug 'scrooloose/nerdtree'
Plug 'ervandew/supertab'
Plug 'majutsushi/tagbar'
Plug 'Lokaltog/vim-easymotion'
Plug 'bronson/vim-trailing-whitespace'
Plug 'rking/ag.vim'
Plug 'junegunn/vim-emoji'
Plug 'scrooloose/syntastic'
Plug 'Shougo/deoplete.nvim'
Plug 'junegunn/rainbow_parentheses.vim'

" ========================================
" Syntaxes
" ========================================
" All in one
Plug 'sheerun/vim-polyglot'

" Haskell
Plug 'Shougo/vimproc.vim', {'do': 'make'}
Plug 'eagletmt/ghcmod-vim'
Plug 'Twinside/vim-hoogle'
Plug 'eagletmt/neco-ghc'

" PureScript
Plug 'frigoeu/psc-ide-vim'

" HTML
Plug 'gregsexton/matchtag'

" ========================================
" Appearance and Usability
" ========================================

" Color Scheme
Plug 'joshdick/onedark.vim'

" Enjoy some hard time!
Plug 'takac/vim-hardtime'


" Change mapleader
let mapleader=","

" Save session for restoring later with 'vim -S' (,ss)
map <leader>ss :mksession<CR>

" Save a file as root (,sr)
map <leader>sr :w !sudo tee % > /dev/null<CR>

" Use ',t' to toggle absolute and relative line numbers
map <leader>t :call ToggleNumber()<CR>

" Open ag.vim with '\'
map \ :Ag<SPACE>

" Use ',.' to go to end of current line
map <leader>. $

" Use ',m' to go to beginning of current line
map <leader>m ^

" Pasting from clipboard into vim is formatted correctly (,p)
map <silent> <leader>p :set paste<CR>"*p:set nopaste<CR>

" Quickly edit/reload the ~/.vimrc file
" ',ev' opens ~/.vimrc in a new buffer to edit.
" ',sv' sources the ~/.vimrc file.
map <silent> <leader>ev :e $MYVIMRC<CR>
map <silent> <leader>sv :so $MYVIMRC<CR>:call SourceConfigs()<CR>

" Switch CWD to the directory of the open buffer
map <leader>cd :cd %:p:h<cr>:pwd<cr>

" vim:foldenable:foldmethod=marker

Remove unused nvim leader shortcuts, add new one

" Change mapleader
let mapleader=","

" Save a file as root (,sr)
map <leader>sr :w !sudo tee % > /dev/null<CR>

" Use ',t' to toggle absolute and relative line numbers
map <leader>t :call ToggleNumber()<CR>

" Pasting from clipboard into vim is formatted correctly (,p)
map <silent> <leader>p :set paste<CR>"*p:set nopaste<CR>

" Quickly edit/reload the ~/.vimrc file
" ',ev' opens ~/.vimrc in a new buffer to edit.
" ',sv' sources the ~/.vimrc file.
map <silent> <leader>ev :e $MYVIMRC<CR>
map <silent> <leader>sv :so $MYVIMRC<CR>:call SourceConfigs()<CR>

" Switch CWD to the directory of the open buffer
map <leader>cd :cd %:p:h<cr>:pwd<CR>

" Update all plugins
nmap <leader>pu :PackerUpdate<CR>

" vim:foldenable:foldmethod=marker


" Language:    CoffeeScript
" Maintainer:  Mick Koch <kchmck@gmail.com>
" URL:         http://github.com/kchmck/vim-coffee-script
" License:     WTFPL

if exists("b:did_ftplugin")
  finish
endif

setlocal formatoptions-=t formatoptions+=croql
setlocal comments=:#
setlocal commentstring=#\ %s

let b:did_ftplugin = 1

Move ftplugin blocking stuff together

" Language:    CoffeeScript
" Maintainer:  Mick Koch <kchmck@gmail.com>
" URL:         http://github.com/kchmck/vim-coffee-script
" License:     WTFPL

if exists("b:did_ftplugin")
  finish
endif

let b:did_ftplugin = 1

setlocal formatoptions-=t formatoptions+=croql
setlocal comments=:#
setlocal commentstring=#\ %s


set runtimepath^=~/.vim runtimepath+=~/.vim/after
let &packpath = &runtimepath
let g:python3_host_prog = '/Users/scott/.pyenv/versions/py3nvim/bin/python'
" let g:loaded_python_provider = 0

source ~/.vimrc

Remove Hard Coded Home Directory Path

set runtimepath^=~/.vim runtimepath+=~/.vim/after
let &packpath = &runtimepath
let g:python3_host_prog = "$HOME/.pyenv/versions/py3nvim/bin/python""
" let g:loaded_python_provider = 0

source ~/.vimrc


if exists('g:loaded_deleft') || &cp
  finish
endif

let g:loaded_deleft = '0.0.1' " version number
let s:keepcpo = &cpo
set cpo&vim

let s:indent_based_filetypes = ['coffee', 'python', 'haml', 'slim']

if !exists('g:deleft_indent_based_filetypes')
  let g:deleft_indent_based_filetypes = []
endif

if !exists('g:deleft_remove_strategy')
  " possible values: "none", "comment", "delete", "spaces"
  let g:deleft_remove_strategy = 'none'
endif

command! Deleft call s:Deleft()
nnoremap dh :call <SID>Deleft()<cr>

function! s:Deleft()
  let saved_view = winsaveview()
  normal! ^

  let indent_based_filetypes = []
  call extend(indent_based_filetypes, s:indent_based_filetypes)
  call extend(indent_based_filetypes, g:deleft_indent_based_filetypes)

  if index(indent_based_filetypes, &filetype) >= 0
    call deleft#Run({'indent': 1})
  else
    call deleft#Run({'indent': 0})
  endif

  call winrestview(saved_view)
endfunction

let &cpo = s:keepcpo
unlet s:keepcpo

Allow customizing the provided mapping

if exists('g:loaded_deleft') || &cp
  finish
endif

let g:loaded_deleft = '0.0.1' " version number
let s:keepcpo = &cpo
set cpo&vim

let s:indent_based_filetypes = ['coffee', 'python', 'haml', 'slim']

if !exists('g:deleft_indent_based_filetypes')
  let g:deleft_indent_based_filetypes = []
endif

if !exists('g:deleft_mapping')
  let g:deleft_mapping = 'dh'
endif

if !exists('g:deleft_remove_strategy')
  " possible values: "none", "comment", "delete", "spaces"
  let g:deleft_remove_strategy = 'none'
endif

command! Deleft call s:Deleft()
if g:deleft_mapping != ''
  exe 'nnoremap '.g:deleft_mapping.' :call <SID>Deleft()<cr>'
endif

function! s:Deleft()
  let saved_view = winsaveview()
  normal! ^

  let indent_based_filetypes = []
  call extend(indent_based_filetypes, s:indent_based_filetypes)
  call extend(indent_based_filetypes, g:deleft_indent_based_filetypes)

  if index(indent_based_filetypes, &filetype) >= 0
    call deleft#Run({'indent': 1})
  else
    call deleft#Run({'indent': 0})
  endif

  call winrestview(saved_view)
endfunction

let &cpo = s:keepcpo
unlet s:keepcpo


let g:gutentags_cache_dir = '~/.vim/gutentags'

Allow the disabling of autotagging again

let g:gutentags_cache_dir = '~/.vim/gutentags'

"prevent automatically generating the tagfile and syntax highlighting tags (default: 0)
if !exists("g:disableautotags")
    let g:gutentags_enabled = 0
endif


"============================================================================
"File:        javascript.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer:  Martin Grenfell <martin_grenfell at msn dot com>
"License:     This program is free software. It comes without any warranty,
"             to the extent permitted by applicable law. You can redistribute
"             it and/or modify it under the terms of the Do What The Fuck You
"             Want To Public License, Version 2, as published by Sam Hocevar.
"             See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"============================================================================
if exists("loaded_javascript_syntax_checker")
    finish
endif
let loaded_javascript_syntax_checker = 1

"bail if the user doesnt have jsl installed
if !executable("jsl")
    finish
endif

function! SyntaxCheckers_javascript_GetLocList()
    let makeprg = "jsl -nologo -nofilelisting -nosummary -nocontext -process %"
    let errorformat='%W%f(%l): lint warning: %m,%-Z%p^,%E%f(%l): SyntaxError: %m,%-Z%p^,%-G'
    return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
endfunction

Add another jsl warning format

"============================================================================
"File:        javascript.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer:  Martin Grenfell <martin_grenfell at msn dot com>
"License:     This program is free software. It comes without any warranty,
"             to the extent permitted by applicable law. You can redistribute
"             it and/or modify it under the terms of the Do What The Fuck You
"             Want To Public License, Version 2, as published by Sam Hocevar.
"             See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"============================================================================
if exists("loaded_javascript_syntax_checker")
    finish
endif
let loaded_javascript_syntax_checker = 1

"bail if the user doesnt have jsl installed
if !executable("jsl")
    finish
endif

function! SyntaxCheckers_javascript_GetLocList()
    let makeprg = "jsl -nologo -nofilelisting -nosummary -nocontext -process %"
    let errorformat='%W%f(%l): lint warning: %m,%-Z%p^,%W%f(%l): warning: %m,%-Z%p^,%E%f(%l): SyntaxError: %m,%-Z%p^,%-G'
    return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
endfunction


" vim: et sw=2 sts=2

scriptencoding utf-8

" Function: #escape {{{1
function! sy#util#escape(path) abort
  if exists('+shellslash')
    let old_ssl = &shellslash
    set noshellslash
  endif

  let path = shellescape(a:path)

  if exists('old_ssl')
    let &shellslash = old_ssl
  endif

  return path
endfunction

" Function: #separator {{{1
function! sy#util#separator() abort
  return !exists('+shellslash') || &shellslash ? '/' : '\'
endfunction

Set noshellslash only for cmd.exe

" vim: et sw=2 sts=2

scriptencoding utf-8

" Function: #escape {{{1
function! sy#util#escape(path) abort
  if exists('+shellslash')
    let old_ssl = &shellslash
    if fnamemodify(&shell, ':t') == 'cmd.exe'
      set noshellslash
    else
      set shellslash
    endif
  endif

  let path = shellescape(a:path)

  if exists('old_ssl')
    let &shellslash = old_ssl
  endif

  return path
endfunction

" Function: #separator {{{1
function! sy#util#separator() abort
  return !exists('+shellslash') || &shellslash ? '/' : '\'
endfunction


set wildignore+=*/tmp/*,*.so,*.swp,*.zip     " MacOSX/Linux
set wildignore+=*\\tmp\\*,*.swp,*.zip,*.exe  " Windows

let g:ctrlp_custom_ignore = '\v[\/]\.(git|hg|svn)$'
let g:ctrlp_custom_ignore = {
  \ 'dir':  '\v[\/]\.(git|hg|svn)$',
  \ 'file': '\v\.(exe|so|dll)$',
  \ }

if executable('rg')
  set grepprg=rg\ --color=never
  let g:ctrlp_user_command = 'rg %s --files --color=never --glob ""'
  let g:ctrlp_use_caching = 0
endif

Enable tag search using leader-space

set wildignore+=*/tmp/*,*.so,*.swp,*.zip     " MacOSX/Linux
set wildignore+=*\\tmp\\*,*.swp,*.zip,*.exe  " Windows

let g:ctrlp_extensions = ['tag', 'buffertag']

let g:ctrlp_custom_ignore = '\v[\/]\.(git|hg|svn)$'
let g:ctrlp_custom_ignore = {
  \ 'dir':  '\v[\/]\.(git|hg|svn)$',
  \ 'file': '\v\.(exe|so|dll)$',
  \ }

if executable('rg')
  set grepprg=rg\ --color=never
  let g:ctrlp_user_command = 'rg %s --files --color=never --glob ""'
  let g:ctrlp_use_caching = 0
endif

nnoremap <Leader><Space> :CtrlPTag<cr>


scriptencoding utf-8

let s:save_cpo = &cpo
set cpo&vim

python3 import vim
execute 'py3file' expand("<sfile>:p:r") . '.py'

function! py3diff#diffexpr()
  python3 diff_files(vim.eval("v:fname_in"), vim.eval("v:fname_new"), vim.eval("v:fname_out")
        \ , vim.eval("&diffopt =~# 'icase'")==1, vim.eval("&diffopt =~# 'iwhite'")==1)
endfunction

let &cpo = s:save_cpo
unlet s:save_cpo

Add option to skip diff work check

scriptencoding utf-8

let s:save_cpo = &cpo
set cpo&vim

python3 import vim
execute 'py3file' expand("<sfile>:p:r") . '.py'

function! py3diff#diffexpr()
  if get(g:, 'py3diff_skip_check', 0)
        \ && getfsize(v:fname_in) <= 6 && getfsize(v:fname_new) <= 6
    call writefile(['1c1'], v:fname_out)
    return
  endif
  echomsg getfsize(v:fname_in) getfsize(v:fname_new)
  python3 diff_files(vim.eval("v:fname_in"), vim.eval("v:fname_new"), vim.eval("v:fname_out")
        \ , vim.eval("&diffopt =~# 'icase'")==1, vim.eval("&diffopt =~# 'iwhite'")==1)
endfunction

let &cpo = s:save_cpo
unlet s:save_cpo


call plug#begin()

Plug 'gruvbox-community/gruvbox'
Plug 'machakann/vim-sandwich'
Plug 'unblevable/quick-scope'

call plug#end()

let mapleader=" "

set background=dark
set expandtab
set foldopen=mark,search,tag,undo
set hidden
set ignorecase
set listchars=tab:»\ ,extends:›,precedes:‹,nbsp:·,trail:·
set mouse=a
set nohlsearch
set number
set scrolloff=4
set shiftwidth=4
set showmode
set sidescrolloff=4
set smartcase
set smartindent
set softtabstop=4
set spelllang="en_au,en_gb"
set splitbelow
set splitright
set tabstop=4
set wrap

colorscheme gruvbox

if exists('g:vscode')

xmap gc <Plug>VSCodeCommentary
nmap gc <Plug>VSCodeCommentary
omap gc <Plug>VSCodeCommentary
nmap gcc <Plug>VSCodeCommentaryLine

highlight QuickScopePrimary guifg='#fbf1c7' gui=bold
highlight QuickScopeSecondary gui=none

endif

Make small tweaks to Neovim configuration

call plug#begin()

Plug 'gruvbox-community/gruvbox'
Plug 'machakann/vim-sandwich'
Plug 'unblevable/quick-scope'

call plug#end()

let mapleader=" "

set expandtab
set foldopen=mark,search,tag,undo
set hidden
set ignorecase
set listchars=tab:»\ ,extends:›,precedes:‹,nbsp:·,trail:·
set mouse=a
set nohlsearch
set number
set scrolloff=4
set shiftwidth=4
set showmode
set sidescrolloff=4
set smartcase
set smartindent
set softtabstop=4
set spelllang="en_au,en_gb"
set splitbelow
set splitright
set tabstop=4
set wrap

noremap Y y$

if exists('g:vscode')
    xmap gc <Plug>VSCodeCommentary
    nmap gc <Plug>VSCodeCommentary
    omap gc <Plug>VSCodeCommentary
    nmap gcc <Plug>VSCodeCommentaryLine

    nnoremap k <Cmd>call VSCodeNotify('cursorMove', { 'to': 'up', 'by': 'wrappedLine', 'value': v:count ? v:count : 1 })<CR>
    nnoremap j <Cmd>call VSCodeNotify('cursorMove', { 'to': 'down', 'by': 'wrappedLine', 'value': v:count ? v:count : 1 })<CR>

    nnoremap gj j
    nnoremap gk k

    highlight QuickScopePrimary guifg='#fbf1c7' gui=bold
    highlight QuickScopeSecondary gui=none
else
    set background=dark
    colorscheme gruvbox

    nnoremap j gj
    nnoremap k gk

    nnoremap gj j
    nnoremap gk k
endif


function! LightlineFilename()
  let l:name = winwidth(0) > 70 ? expand('%:p:h:t') . '/' . expand('%:t') : expand('%:t')
  return expand('%:t') !=# '' ? l:name : 'nil'
endfunction

function! LightlineReadonly()
  return &readonly && &filetype !=# 'help' ? 'RO' : ''
endfunction

function! LightlineFiletype()
  return winwidth(0) > 70 && &filetype !=# '' ? &filetype : ''
endfunction

let g:lightline = {
      \ 'colorscheme': 'onedark',
      \ 'component_function': {
      \   'filename': 'LightlineFilename',
      \   'readonly': 'LightlineReadonly',
      \   'filetype': 'LightlineFiletype',
      \ },
      \ 'active': {
      \   'left': [ [ 'mode', 'paste' ],
      \             [ 'readonly', 'filename', 'modified' ] ],
      \   'right': [ [ 'lineinfo' ],
      \              [ 'percent' ] ]
      \ },
      \ }

Remove file name component if empty

function! LightlineFilename()
  let l:name = winwidth(0) > 70 ? expand('%:p:h:t') . '/' . expand('%:t') : expand('%:t')
  return expand('%:t') !=# '' ? l:name : ''
endfunction

function! LightlineReadonly()
  return &readonly && &filetype !=# 'help' ? 'RO' : ''
endfunction

function! LightlineFiletype()
  return winwidth(0) > 70 && &filetype !=# '' ? &filetype : ''
endfunction

let g:lightline = {
      \ 'colorscheme': 'onedark',
      \ 'component_function': {
      \   'filename': 'LightlineFilename',
      \   'readonly': 'LightlineReadonly',
      \   'filetype': 'LightlineFiletype',
      \ },
      \ 'active': {
      \   'left': [ [ 'mode', 'paste' ],
      \             [ 'readonly', 'filename', 'modified' ] ],
      \   'right': [ [ 'lineinfo' ],
      \              [ 'percent' ] ]
      \ },
      \ }


au BufRead,BufNewFile *.ino setlocal ft=arduino

Load plugin for any c and c++ files in the Arduino folder

au BufRead,BufNewFile *.ino setlocal ft=arduino
au BufRead,BufNewFile */Arduino/**/*.h setlocal ft=arduino
au BufRead,BufNewFile */Arduino/**/*.c setlocal ft=arduino
au BufRead,BufNewFile */Arduino/**/*.cpp setlocal ft=arduino


set nocompatible " not vi compatible

set background=dark
colorscheme solarized

"------------------
" Syntax and indent
"------------------
syntax enable " turn on syntax highlighting
set showmatch " show matching braces when text indicator is over them

filetype on
filetype plugin indent on " enable file type detection
set autoindent

"---------------------
" Basic editing config
"---------------------
set tags=tags;/ " recursively search parent directory for tags
set list
set listchars=tab:\|\ ,trail:●,extends:>,precedes:<,nbsp:+

set backspace=indent,eol,start " allow backspacing over everything

set incsearch " incremental search (as string is being typed)
set hlsearch " highlight search

set laststatus=2
set statusline=%F%m%r%h%w\ (%{&ff}){%Y}\ [%l,%v][%p%%]

" Make all spaces size 4, use spaces instead of tabs
set tabstop=4 shiftwidth=4 expandtab smarttab

set showcmd
set number " number lines

" Ignore case when doing regex searches, except if you capitalize explicitly
set ignorecase
set smartcase

set runtimepath^=~/.vim/bundle/ctrlp.vim
set autoread

set spell

set complete+=kspell
autocmd filetype crontab setlocal nobackup nowritebackup
autocmd BufNewFile,BufRead *.template   set syntax=html

Add webflow to html formatting

set nocompatible " not vi compatible

set background=dark
colorscheme solarized

"------------------
" Syntax and indent
"------------------
syntax enable " turn on syntax highlighting
set showmatch " show matching braces when text indicator is over them

filetype on
filetype plugin indent on " enable file type detection
set autoindent

"---------------------
" Basic editing config
"---------------------
set tags=tags;/ " recursively search parent directory for tags
set list
set listchars=tab:\|\ ,trail:●,extends:>,precedes:<,nbsp:+

set backspace=indent,eol,start " allow backspacing over everything

set incsearch " incremental search (as string is being typed)
set hlsearch " highlight search

set laststatus=2
set statusline=%F%m%r%h%w\ (%{&ff}){%Y}\ [%l,%v][%p%%]

" Make all spaces size 4, use spaces instead of tabs
set tabstop=4 shiftwidth=4 expandtab smarttab

set showcmd
set number " number lines

" Ignore case when doing regex searches, except if you capitalize explicitly
set ignorecase
set smartcase

set runtimepath^=~/.vim/bundle/ctrlp.vim
set autoread

set spell

set complete+=kspell
autocmd filetype crontab setlocal nobackup nowritebackup
autocmd BufNewFile,BufRead *.{template,webflow} set syntax=html


" Automatically show the git diff when commiting.
" Also, disable neocomplete (as much as possible) while comitting.
" NOTE: I tired using NeoCompleteLock or NeoBundleDisable, but these functions
" are simply not aavailable at the time this code gets run.

autocmd FileType gitcommit DiffGitCached |
    \ wincmd L | wincmd h |
    \ let g:neocomplete#enable_auto_close_preview = 0 |
    \ let g:neocomplete#disable_auto_complete = 1

Make the automatic git diff window smarter.

" Automatically show the git diff when running 'git commit'. If the commit
" window is not the first buffer opened, it will not show the diff panel. This
" is useful for using the Gstatus / Gcommit functions from the vim-fugitive
" plugin.

function s:open_diff_window()
    if bufnr('') == 1
        execute 'DiffGitCached | wincmd L | wincmd h'
    endif
endfunction

au BufRead COMMIT_EDITMSG call s:open_diff_window()


" Global-like variables should not be warned
let g:explicit_global_var = 101
let b:buffer_local_var = 102
let w:window_local_var = 103
let t:tab_local_var = 104
let implicit_global_var = 106
let $ENV_VAR = 107
let @" = 108
let &opt_var = 109
let v:count = 110

" Script-local variables should be used
let s:script_local_var = 105
echo s:script_local_var

function! s:ScriptLocalFunc()
endfunction
call s:ScriptLocalFunc()

function! g:FuncContext(param_var, param_func)
    " Parameter should be used
    echo a:param_var
    call a:param_func()

    " Function-local variables should be used
    let l:explicit_func_local_var = 106
    echo l:explicit_func_local_var

    let implicit_func_local_var = 107
    echo implicit_func_local_var

    function! l:ExplicitFunctionLocalFunc()
    endfunction
    call l:ExplicitFunctionLocalFunc()

    function! ImplicitFunctionLocalFunc()
    endfunction
    call ImplicitFunctionLocalFunc()
endfunction

" redir variable should be warned
redir => l:redit_variable

Fix a fixture bug about unexpected unused variable exists

" Global-like variables should not be warned
let g:explicit_global_var = 101
let b:buffer_local_var = 102
let w:window_local_var = 103
let t:tab_local_var = 104
let implicit_global_var = 106
let $ENV_VAR = 107
let @" = 108
let &opt_var = 109
let v:count = 110

" Script-local variables should be used
let s:script_local_var = 105
echo s:script_local_var

function! s:ScriptLocalFunc()
endfunction
call s:ScriptLocalFunc()

redir => l:redit_variable
redir END
echo l:redit_variable

function! g:FuncContext(param_var, param_func)
    " Parameter should be used
    echo a:param_var
    call a:param_func()

    " Function-local variables should be used
    let l:explicit_func_local_var = 106
    echo l:explicit_func_local_var

    let implicit_func_local_var = 107
    echo implicit_func_local_var

    function! l:ExplicitFunctionLocalFunc()
    endfunction
    call l:ExplicitFunctionLocalFunc()

    function! ImplicitFunctionLocalFunc()
    endfunction
    call ImplicitFunctionLocalFunc()
endfunction


func! cm#sources#css#init()
    call cm#register_source({'name' : 'cm-css',
                \ 'priority': 9,
                \ 'scoping': 1,
                \ 'scopes': ['css','scss'],
                \ 'abbreviation': 'css',
                \ 'word_pattern': '[\w\-]+',
                \ 'cm_refresh_patterns':['[\w\-]+\s*:\s+'],
                \ 'cm_refresh': {'omnifunc': 'csscomplete#CompleteCSS'},
                \ })
endfunc

Enable CSS completion for Stylus, SASS and LESS

func! cm#sources#css#init()
    call cm#register_source({'name' : 'cm-css',
                \ 'priority': 9,
                \ 'scoping': 1,
                \ 'scopes': ['css','scss', 'stylus', 'less', 'sass'],
                \ 'abbreviation': 'css',
                \ 'word_pattern': '[\w\-]+',
                \ 'cm_refresh_patterns':['[\w\-]+\s*:\s+'],
                \ 'cm_refresh': {'omnifunc': 'csscomplete#CompleteCSS'},
                \ })
endfunc


" Set line wrapping for comments to 90 characters
fun! AdjustWrapForLine()
   if !exists('s:lastLine') || line('.') != s:lastLine
      let s:lastLine = line(".")
      let matched = matchstr(getline('.'), '^\s*\/\=\(\*\|\/\)')

      if !empty(matched)
         set textwidth=90
      else
         set textwidth=140
      endif
   endif
endfun
autocmd CursorMoved * call AdjustWrapForLine()
" End of line wrapping config

Move colorcolumn to match textwidth

" Set line wrapping for comments to 90 characters
fun! AdjustWrapForLine()
   if !exists('s:lastLine') || line('.') != s:lastLine
      let s:lastLine = line(".")
      let matched = matchstr(getline('.'), '^\s*\/\=\(\*\|\/\)')

      if !empty(matched)
         set textwidth=90
         set colorcolumn=90
      else
         set textwidth=140
         set colorcolumn=140
      endif
   endif
endfun
autocmd CursorMoved * call AdjustWrapForLine()
" End of line wrapping config


set background=dark

try
    set t_Co=256                      " Make vim aware of 256 colorspace
    let base16colorspace=256          " Enable base16 256 colorspace
    colorscheme base16-default-dark
catch /^Vim\%((\a\+)\)\=:E185/
    " Well, not much I can do at the moment
endtry

set autoindent

set showmatch
set matchpairs=(:),{:},[:],<:>

"Show line numbers
set number
set relativenumber

"Extra highlighting settings
au InsertEnter * match ExtraWhitespace /\s\+\%#\@<!$/
au InsertLeave * match ExtraWhitespace /\s\+$/
highlight ExtraWhiteSpace ctermbg=52
set spell spelllang=en_gb
set hlsearch

" Always show the status bar at the bottom of the window
set laststatus=2
set incsearch

" Don't show the mode if we are using lightline.
if exists('g:solarnz_will_load_lightline')
    set noshowmode
endif

set list lcs=trail:·,tab:»·

let &t_SI = "\e]50;CursorShape=1\x7"
let &t_EI = "\e]50;CursorShape=0\x7"

if has('nvim')
    set inccommand=split
endif

Make the spelling errors a little easier to see in vim

set background=dark

try
    set t_Co=256                      " Make vim aware of 256 colorspace
    let base16colorspace=256          " Enable base16 256 colorspace
    colorscheme base16-default-dark
    highlight SpellBad ctermbg=0
catch /^Vim\%((\a\+)\)\=:E185/
    " Well, not much I can do at the moment
endtry

set autoindent

set showmatch
set matchpairs=(:),{:},[:],<:>

"Show line numbers
set number
set relativenumber

"Extra highlighting settings
au InsertEnter * match ExtraWhitespace /\s\+\%#\@<!$/
au InsertLeave * match ExtraWhitespace /\s\+$/
highlight ExtraWhiteSpace ctermbg=52
set spell spelllang=en_gb
set hlsearch

" Always show the status bar at the bottom of the window
set laststatus=2
set incsearch

" Don't show the mode if we are using lightline.
if exists('g:solarnz_will_load_lightline')
    set noshowmode
endif

set list lcs=trail:·,tab:»·

let &t_SI = "\e]50;CursorShape=1\x7"
let &t_EI = "\e]50;CursorShape=0\x7"

if has('nvim')
    set inccommand=split
endif


let NERDTreeShowHidden=1

augroup nerdtree
    autocmd!

    " Close NERDTree if it's the last window
    autocmd BufEnter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
augroup END

nnoremap <Leader>dd :NERDTreeToggle<CR>
nnoremap <Leader>df :NERDTreeFind<CR>

Use d and D for NERDTree

let NERDTreeShowHidden=1

augroup nerdtree
    autocmd!

    " Close NERDTree if it's the last window
    autocmd BufEnter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
augroup END

nnoremap <Leader>D :NERDTreeToggle<CR>
nnoremap <Leader>d :NERDTreeFind<CR>


if !exists("g:loaded_nvim_treesitter")
  finish
endif

lua <<EOF
require('nvim-treesitter.configs').setup{
  ensure_installed = {
    "dockerfile",
    "go",
    "ruby",
    "yaml",
    "json",
    "toml",
  }, -- this is available in the list of official parsers
  ignore_install = {}, -- list of parsers to ignore installing
  highlight = {
    enable = true
  },
  incremental_selection = {
    enable = true
  },
  textobjects = {
    enable = true
  },
}
EOF

Add bash support for treesitter

if !exists("g:loaded_nvim_treesitter")
  finish
endif

lua <<EOF
require('nvim-treesitter.configs').setup{
  ensure_installed = {
    "bash",
    "dockerfile",
    "go",
    "ruby",
    "yaml",
    "json",
    "toml",
  }, -- this is available in the list of official parsers
  ignore_install = {}, -- list of parsers to ignore installing
  highlight = {
    enable = true
  },
  incremental_selection = {
    enable = true
  },
  textobjects = {
    enable = true
  },
}
EOF


" Use Q to intelligently close a window
" (if there are multiple windows into the same buffer)
" or kill the buffer entirely if it's the last window looking into that buffer
function! CloseWindowOrKillBuffer()
  if(bufwinnr('%')) > 1
    wincmd c
  else
    bdelete
  endif
endfunction

nnoremap <silent> Q :call CloseWindowOrKillBuffer()<CR>

Improve window killer (Q) - close window if multiple windows to same buffer exist

" Use Q to intelligently close a window
" (if there are multiple windows into the same buffer)
" or kill the buffer entirely if it's the last window looking into that buffer
function! CloseWindowOrKillBuffer()
  let number_of_windows_to_this_buffer = len(filter(range(1, winnr('$')), "winbufnr(v:val) == bufnr('%')"))

  if number_of_windows_to_this_buffer > 1
    wincmd c
  else
    bdelete
  endif
endfunction

nnoremap <silent> Q :call CloseWindowOrKillBuffer()<CR>


nmap <C-p> :tabprevious<CR>
nmap <C-n> :tabnext<CR>

nmap <Leader>x :close<CR>

nmap <Leader>sd :%s/\s\+$//g<CR>
nmap <Leader>ss /\s\+$<CR>

nmap <Leader>t~ :tabedit ~/<CR>
nmap <Leader>t. :tabedit .<CR>
nmap <Leader>tn :tabedit<CR>
nmap <Leader>tt :tabedit %<CR>
nmap <Leader>to :tabonly<CR>

nmap <Leader>h~ :split ~/<CR>
nmap <Leader>h. :split .<CR>
nmap <Leader>hh :split<CR>

nmap <Leader>v~ :vsplit ~/<CR>
nmap <Leader>v. :vsplit .<CR>
nmap <Leader>vv :vsplit<CR>

nmap <C-h> zh
nmap <C-L> zl

nmap <Up> <C-y>
nmap <Down> <C-e>
nmap <Left> 4zh
nmap <Right> 4zl

Add C-F C-B navigation in vim edit mode

nmap <C-p> :tabprevious<CR>
nmap <C-n> :tabnext<CR>

nmap <Leader>x :close<CR>

nmap <Leader>sd :%s/\s\+$//g<CR>
nmap <Leader>ss /\s\+$<CR>

nmap <Leader>t~ :tabedit ~/<CR>
nmap <Leader>t. :tabedit .<CR>
nmap <Leader>tn :tabedit<CR>
nmap <Leader>tt :tabedit %<CR>
nmap <Leader>to :tabonly<CR>

nmap <Leader>h~ :split ~/<CR>
nmap <Leader>h. :split .<CR>
nmap <Leader>hh :split<CR>

nmap <Leader>v~ :vsplit ~/<CR>
nmap <Leader>v. :vsplit .<CR>
nmap <Leader>vv :vsplit<CR>

nmap <C-h> zh
nmap <C-L> zl

nmap <Up> 3<C-y>
nmap <Down> 3<C-e>
nmap <Left> 4zh
nmap <Right> 4zl

imap <C-f> <C-o>l
imap <C-b> <C-o>h


" tab
set expandtab
set tabstop=4
set shiftwidth=4
set softtabstop=4
set smarttab

au BufRead,BufNewFile,BufReadPre *.coffee set filetype=coffee

augroup fileTypeIndent
    autocmd!
    autocmd BufNewFile,BufRead *.html setlocal tabstop=2 shiftwidth=2 softtabstop=2
    autocmd BufNewFile,BufRead *.coffee setlocal tabstop=2 shiftwidth=2 softtabstop=2
    autocmd BufNewFile,BufRead *.rkt setlocal tabstop=2 shiftwidth=2 softtabstop=2
    autocmd BufNewFile,BufRead *.py setlocal tabstop=2 shiftwidth=2 softtabstop=2
augroup END

" appearance
set showmatch
set list
set listchars=tab:>.,trail:_,eol:↲,extends:>,precedes:<,nbsp:%

" control
set backspace=start,eol,indent
set whichwrap=b,s,[,],,~
source $VIMRUNTIME/macros/matchit.vim

" for tex
let g:tex_conceal = ''

Use 2-spaces as a tab in js file

" tab
set expandtab
set tabstop=4
set shiftwidth=4
set softtabstop=4
set smarttab

au BufRead,BufNewFile,BufReadPre *.coffee set filetype=coffee

augroup fileTypeIndent
    autocmd!
    autocmd BufNewFile,BufRead *.html setlocal tabstop=2 shiftwidth=2 softtabstop=2
    autocmd BufNewFile,BufRead *.coffee setlocal tabstop=2 shiftwidth=2 softtabstop=2
    autocmd BufNewFile,BufRead *.rkt setlocal tabstop=2 shiftwidth=2 softtabstop=2
    autocmd BufNewFile,BufRead *.py setlocal tabstop=2 shiftwidth=2 softtabstop=2
    autocmd BufNewFile,BufRead *.js setlocal tabstop=2 shiftwidth=2 softtabstop=2
augroup END

" appearance
set showmatch
set list
set listchars=tab:>.,trail:_,eol:↲,extends:>,precedes:<,nbsp:%

" control
set backspace=start,eol,indent
set whichwrap=b,s,[,],,~
source $VIMRUNTIME/macros/matchit.vim

" for tex
let g:tex_conceal = ''


let g:conjure_log_direction = "horizontal"
let g:conjure_log_blacklist = ["up", "ret", "ret-multiline", "load-file", "eval"]

Use vertical Conjure log again


" map Meta keys for tmux-navigator
nnoremap <silent> <M-h> :TmuxNavigateLeft<CR>
nnoremap <silent> <M-j> :TmuxNavigateDown<CR>
nnoremap <silent> <M-k> :TmuxNavigateUp<CR>
nnoremap <silent> <M-l> :TmuxNavigateRight<CR>

" handle Meta keys in terminal
if !has('gui_running')
  silent! execute 'set <F31>=h'
  silent! execute 'set <F32>=j'
  silent! execute 'set <F33>=k'
  silent! execute 'set <F34>=l'
  nmap <F31> <M-h>
  nmap <F32> <M-j>
  nmap <F33> <M-k>
  nmap <F34> <M-l>
endif

Add tnoremap for M-hjkl mappings

" handle Meta keys in terminal
if !has('gui_running')
  silent! execute 'set <M-h>=h'
  silent! execute 'set <M-j>=j'
  silent! execute 'set <M-k>=k'
  silent! execute 'set <M-l>=l'
endif

" map Meta keys for tmux-navigator
nnoremap <silent> <M-h> :TmuxNavigateLeft<CR>
nnoremap <silent> <M-j> :TmuxNavigateDown<CR>
nnoremap <silent> <M-k> :TmuxNavigateUp<CR>
nnoremap <silent> <M-l> :TmuxNavigateRight<CR>
tnoremap <silent> <M-h> <C-w>:TmuxNavigateLeft<CR>
tnoremap <silent> <M-j> <C-w>:TmuxNavigateDown<CR>
tnoremap <silent> <M-k> <C-w>:TmuxNavigateUp<CR>
tnoremap <silent> <M-l> <C-w>:TmuxNavigateRight<CR>


" echo back messages
echo "Hello, world!"

" echo back messages more permanently
echom "Hello again, world!"

Add Vim note on comments

" comments are made with double quotes
" comment like this

" echo back messages
echo "Hello, world!"

" echo back messages more permanently
echom "Hello again, world!"


set background=dark

if has("gui_running")
  colorscheme wombat
else
  colorscheme wombat256mod
endif

" Use the same background color for signs as we do for line numbers. This
" makes signs and line numbers look like one nice big column.
hi! link SignColumn LineNr

" Use a more subtle color to highlight whitespace when using 'listchars'.
hi! SpecialKey gui=NONE guifg=#113245 guibg=#002b36

hi! ColorColumn guibg=black ctermbg=black

" Use the same background colour behind text, and non-text. This removes the
" two different background colours you get out-of-the-box.
hi! Normal ctermbg=NONE
hi! NonText ctermbg=NONE
hi! link NonText Normal

Switch colorscheme from Wombat to Hybrid

set background=dark

colorscheme hybrid

" Use the same background color for signs as we do for line numbers. This
" makes signs and line numbers look like one nice big column.
hi! link SignColumn LineNr

" Use a more subtle color to highlight whitespace when using 'listchars'.
hi! SpecialKey gui=NONE guifg=#113245 guibg=#002b36

hi! ColorColumn guibg=black ctermbg=black

" Use the same background colour behind text, and non-text. This removes the
" two different background colours you get out-of-the-box.
hi! Normal ctermbg=NONE
hi! NonText ctermbg=NONE
hi! link NonText Normal


let g:UltiSnipsSnippetsDir="~/.vim/ultisnips"

" Remap Ultisnips for compatibility for YCM
let g:UltiSnipsExpandTrigger='<C-j>'
let g:UltiSnipsJumpForwardTrigger='<C-j>'
let g:UltiSnipsJumpBackwardTrigger='<C-k>'

Fix path to custom UltiSnips snippets

let g:UltiSnipsSnippetsDir="~/.config/nvim/ultisnips"

" Remap Ultisnips for compatibility for YCM
let g:UltiSnipsExpandTrigger='<C-j>'
let g:UltiSnipsJumpForwardTrigger='<C-j>'
let g:UltiSnipsJumpBackwardTrigger='<C-k>'


"Editor Settings
setlocal softtabstop=2 shiftwidth=2 tabstop=2 textwidth=79 expandtab

Update to lyft JS convention

"Editor Settings
setlocal softtabstop=4 shiftwidth=4 tabstop=4 textwidth=80 expandtab


Plug 'Shougo/deoplete.nvim'
Plug 'airblade/vim-gitgutter'
Plug 'ctrlpvim/ctrlp.vim'
Plug 'easymotion/vim-easymotion'
Plug 'jiangmiao/auto-pairs'
Plug 'liuchengxu/vim-better-default'
Plug 'rafi/awesome-vim-colorschemes'
Plug 'tpope/vim-commentary'
Plug 'tpope/vim-dispatch'
Plug 'tpope/vim-eunuch'
Plug 'tpope/vim-fugitive'
Plug 'tpope/vim-repeat'
Plug 'tpope/vim-sleuth'
Plug 'tpope/vim-surround'
Plug 'tpope/vim-unimpaired'
Plug 'tpope/vim-vinegar'
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'w0rp/ale'

Add dadbod and fireplace (<3 tpope)

Plug 'Shougo/deoplete.nvim'
Plug 'airblade/vim-gitgutter'
Plug 'ctrlpvim/ctrlp.vim'
Plug 'easymotion/vim-easymotion'
Plug 'jiangmiao/auto-pairs'
Plug 'liuchengxu/vim-better-default'
Plug 'rafi/awesome-vim-colorschemes'
Plug 'tpope/vim-commentary'
Plug 'tpope/vim-dadbod'
Plug 'tpope/vim-dispatch'
Plug 'tpope/vim-eunuch'
Plug 'tpope/vim-fireplace'
Plug 'tpope/vim-fugitive'
Plug 'tpope/vim-repeat'
Plug 'tpope/vim-sleuth'
Plug 'tpope/vim-surround'
Plug 'tpope/vim-unimpaired'
Plug 'tpope/vim-vinegar'
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'w0rp/ale'


let g:vimtex_compiler_latexmk = {
	\ 'background' : 1,
	\ 'build_dir' : 'build',
	\ 'callback' : 1,
	\ 'continuous' : 1,
	\ 'executable' : 'latexmk',
	\ 'options' : [
	\   '-pdf',
	\   '-verbose',
	\   '-file-line-error',
	\   '-synctex=1',
	\   '-interaction=nonstopmode',
	\ ],
	\}

Use xetex by default again

let g:vimtex_compiler_latexmk = {
	\ 'background' : 1,
	\ 'build_dir' : 'build',
	\ 'callback' : 1,
	\ 'continuous' : 1,
	\ 'executable' : 'latexmk',
	\ 'options' : [
	\   '-pdf',
	\   '-verbose',
	\   '-file-line-error',
	\   '-synctex=1',
	\   '-interaction=nonstopmode',
	\   '-xelatex',
	\ ],
	\}


call dein#add('ap/vim-css-color')
call dein#add('chrisbra/Colorizer')
call dein#add('chriskempson/base16-vim')
call dein#add('croaky/vim-colors-github')
call dein#add('edkolev/tmuxline.vim')
call dein#add('flazz/vim-colorschemes')
call dein#add('iCyMind/NeoSolarized')
call dein#add('jby/tmux.vim')
call dein#add('junegunn/goyo.vim')
call dein#add('junegunn/limelight.vim')
call dein#add('junegunn/rainbow_parentheses.vim')
call dein#add('morhetz/gruvbox')
call dein#add('NLKNguyen/papercolor-theme')
call dein#add('noahfrederick/vim-hemisu')
call dein#add('reedes/vim-colors-pencil')
call dein#add('scheakur/vim-scheakur')
call dein#add('trusktr/seti.vim')
call dein#add('vim-airline/vim-airline')
call dein#add('vim-airline/vim-airline-themes')
call dein#add('whatyouhide/vim-gotham')
call dein#add('xsunsmile/showmarks')

Use vim-colorschemes fork to avoid case-sensitive git

call dein#add('ap/vim-css-color')
call dein#add('chrisbra/Colorizer')
call dein#add('chriskempson/base16-vim')
call dein#add('croaky/vim-colors-github')
call dein#add('edkolev/tmuxline.vim')
call dein#add('mrap/vim-colorschemes')
call dein#add('iCyMind/NeoSolarized')
call dein#add('jby/tmux.vim')
call dein#add('junegunn/goyo.vim')
call dein#add('junegunn/limelight.vim')
call dein#add('junegunn/rainbow_parentheses.vim')
call dein#add('morhetz/gruvbox')
call dein#add('NLKNguyen/papercolor-theme')
call dein#add('noahfrederick/vim-hemisu')
call dein#add('reedes/vim-colors-pencil')
call dein#add('scheakur/vim-scheakur')
call dein#add('trusktr/seti.vim')
call dein#add('vim-airline/vim-airline')
call dein#add('vim-airline/vim-airline-themes')
call dein#add('whatyouhide/vim-gotham')
call dein#add('xsunsmile/showmarks')


function! GetCompDB()
    exec CMakeCompDB()
endfunc
let RunCMakeCompDB = function('GetCompDB')
let g:neomake_cmakecompdb_maker = {
    \ 'exe': 'RunCMakeCompDB',
    \ 'args': ['']
    \ }
noremap <unique> <Plug>NeomakeCompDB :Neomake! cmakecompdb<CR>
function CMakeTargets()
    echo "Get CMake Targets"
endfunction

Modify funcref passed to the neomaker maker.

function! GetCompDB()
    exec CMakeCompDB()
endfunc
let FnCMakeRun = function("GetCompDB")
"let RunCMakeCompDB = function('GetCompDB')
"function cmake.run() dict
"   let self.fn = function('GetCompDB')
"endfunction
let g:neomake_cmakecompdb_maker = {
    \ 'exe': string(FnCMakeRun),
    \ 'args': ['']
    \ }
noremap <unique> <Plug>NeomakeCompDB :Neomake! cmakecompdb<CR>
function CMakeTargets()
    echo "Get CMake Targets"
endfunction


" read Vim manual in Vim
help

" comments are made with double quotes
" comment like this

" echo back messages
echo "Hello, world!"

" echo back messages more permanently
echom "Hello again, world!"

" boolean options
set number " <name>
set nonumber " no<name>

" toggling boolean options
set number! " toggle on/off
set number! " toggle off/on

" ask vim what option is currently set
set number? " <name>?

Add Vim note on numeric options + multiple options

" read Vim manual in Vim
help

" comments are made with double quotes
" comment like this

" echo back messages
echo "Hello, world!"

" echo back messages more permanently
echom "Hello again, world!"

" boolean options
set number " <name>
set nonumber " no<name>

" toggling boolean options
set number! " toggle on/off
set number! " toggle off/on

" ask vim what option is currently set
set number? " <name>?

" set numeric options
set numberwidth=10

" set multiple options in one line
set number numberwidth=10


if has('nvim')
  "FUNCTIONS {{{
  " }}}

  " SETTINGS {{{
    let g:LanguageClient_autoStart = 1

    let g:LanguageClient_serverCommands = {
          \ 'rust': ['rustup', 'run', 'nightly', 'rls'],
          \ 'javascript': ['javascript-typescript-stdio'],
          \ 'typescript': ['javascript-typescript-stdio'],
          \ 'typescript.tsx': ['javascript-typescript-stdio'],
          \ 'reason': ['reason-language-server.exe'],
          \ 'ocaml': ['ocaml-language-server', '--stdio'],
          \ 'go': ['go-langserver'],
          \ 'ruby': ['solargraph', 'stdio'],
          \ }
  " }}}

  " MAPPINGS {{{
    nnoremap <silent> K :call LanguageClient_textDocument_hover()<CR>
    nnoremap <silent> gd :call LanguageClient_textDocument_definition()<cr>
    nnoremap <silent> lf :call LanguageClient_textDocument_formatting()<cr>
    nnoremap <silent> lr :call LanguageClient_textDocument_rename()<CR>
  " }}}
end

Use bingo for go language server

if has('nvim')
  "FUNCTIONS {{{
  " }}}

  " SETTINGS {{{
    let g:LanguageClient_autoStart = 1

    let g:LanguageClient_rootMarkers = {
        \ 'go': ['.git', 'go.mod'],
        \ }

    let g:LanguageClient_serverCommands = {
          \ 'rust': ['rustup', 'run', 'nightly', 'rls'],
          \ 'javascript': ['javascript-typescript-stdio'],
          \ 'typescript': ['javascript-typescript-stdio'],
          \ 'typescript.tsx': ['javascript-typescript-stdio'],
          \ 'reason': ['reason-language-server.exe'],
          \ 'ocaml': ['ocaml-language-server', '--stdio'],
          \ 'go': ['bingo', '--format-style', 'goimports'],
          \ 'ruby': ['solargraph', 'stdio'],
          \ }
  " }}}

  " MAPPINGS {{{
    nnoremap <silent> K :call LanguageClient_textDocument_hover()<CR>
    nnoremap <silent> gd :call LanguageClient_textDocument_definition()<cr>
    nnoremap <silent> lf :call LanguageClient_textDocument_formatting()<cr>
    nnoremap <silent> lr :call LanguageClient_textDocument_rename()<CR>
  " }}}
end


let g:ale_lint_on_text_changed = 0

let g:ale_linters = {
      \ 'ruby': ['rubocop'],
      \ 'go': ['gofmt', 'goimports', 'golint', 'go vet', 'go build']
      \ }

let g:ale_echo_msg_format = '[%linter%] %s'
let g:ale_sign_error = 'x'
let g:ale_sign_warning = '⚠'

Use goimports instead of gofmt

let g:ale_lint_on_text_changed = 0

let g:ale_linters = {
      \ 'ruby': ['rubocop'],
      \ 'go': ['goimports', 'gofmt', 'golint', 'go vet', 'go build']
      \ }

let g:ale_echo_msg_format = '[%linter%] %s'
let g:ale_sign_error = 'x'
let g:ale_sign_warning = '⚠'


" Vim syntax file
" Language:	Janus
" Maintainer:	Michael Budde <mbudde@gmail.com>
" Last Change:	March 2013

if exists("b:current_syntax")
  finish
endif

syn keyword janusKeyword swap local delocal push pop nil
syn keyword janusKeyword call uncall
syn keyword janusStatement procedure nextgroup=janusProcedure skipwhite
syn keyword janusConditional if then else fi
syn keyword janusRepeat from do loop until
syn keyword janusOperator empty top

syn keyword janusType int stack

syn match   janusProcedure "\w\+" contained

syn match   janusNumber	"\<\%([1-9]\d*\|0\)\>"

syn match   janusComment "//.*$"

hi def link janusNumber         Number
hi def link janusProcedure      Function
hi def link janusStatement      Statement
hi def link janusConditional    Conditional
hi def link janusRepeat         Repeat
hi def link janusOperator       Operator
hi def link janusKeyword        Keyword
hi def link janusType           Type
hi def link janusComment        Comment

let b:current_syntax = "janus"

Add multiline comments to vim syntax

" Vim syntax file
" Language:	Janus
" Maintainer:	Michael Budde <mbudde@gmail.com>
" Last Change:	March 2013

if exists("b:current_syntax")
  finish
endif

syn keyword janusKeyword swap local delocal push pop nil
syn keyword janusKeyword call uncall
syn keyword janusStatement procedure nextgroup=janusProcedure skipwhite
syn keyword janusConditional if then else fi
syn keyword janusRepeat from do loop until
syn keyword janusOperator empty top

syn keyword janusType int stack

syn match   janusProcedure "\w\+" contained

syn match   janusNumber	"\<\%([1-9]\d*\|0\)\>"

syn keyword janusCommentTodo   TODO FIXME XXX TBD contained
syn match   janusLineComment   "\/\/.*" contains=janusCommentTodo
syn region  janusComment       start="/\*" end="\*/" contains=janusCommentTodo

hi def link janusNumber         Number
hi def link janusProcedure      Function
hi def link janusStatement      Statement
hi def link janusConditional    Conditional
hi def link janusRepeat         Repeat
hi def link janusOperator       Operator
hi def link janusKeyword        Keyword
hi def link janusType           Type
hi def link janusComment        Comment
hi def link janusLineComment    Comment
hi def link janusCommentTodo    Todo

let b:current_syntax = "janus"


" Author: w0rp <devw0rp@gmail.com>
" Description: This file adds support for using the shellcheck linter with
"   shell scripts.

if exists('g:loaded_ale_linters_sh_shellcheck')
    finish
endif

let g:loaded_ale_linters_sh_shellcheck = 1

" This global variable can be set with a string of comma-seperated error
" codes to exclude from shellcheck. For example:
"
" let g:ale_linters_sh_shellcheck_exclusions = 'SC2002,SC2004'
if !exists('g:ale_linters_sh_shellcheck_exclusions')
    let g:ale_linters_sh_shellcheck_exclusions = ''
endif

if g:ale_linters_sh_shellcheck_exclusions != ''
    let s:exclude_option = '-e ' .  g:ale_linters_sh_shellcheck_exclusions
else
    let s:exclude_option = ''
endif

call ALEAddLinter('sh', {
\   'name': 'shellcheck',
\   'executable': 'shellcheck',
\   'command': 'shellcheck ' . s:exclude_option . ' -f gcc -',
\   'callback': 'ale#handlers#HandleGCCFormat',
\})

echo 'shellcheck' . s:exclude_option . '-f gcc -'

Remove a test echo line.


let g:SuperTabLongestEnhanced = 1
let g:SuperTabLongestHighlight = 1

Settle on let g:SuperTabDefaultCompletionType = "context"

let g:SuperTabDefaultCompletionType = "context"
let g:SuperTabLongestEnhanced = 1
let g:SuperTabLongestHighlight = 1


" Fuzzyfinder プラグイン
" http://vim.g.hatena.ne.jp/keyword/fuzzyfinder.vim

" Enable FufMruFile
let g:fuf_modesDisable = ['mrucmd']
" Make mru list larger
let g:fuf_mrufile_maxItem = 400
" Keymapping
nnoremap <silent> <C-m> :FufBuffer<CR>
nnoremap <silent> <C-k> :FufFile<CR>
nnoremap <silent> <C-l> :FufFileWithCurrentBufferDir<CR>
nnoremap <silent> <C-j> :FufMruFile<CR>

Enable new feature on FuF

" Fuzzyfinder プラグイン
" http://vim.g.hatena.ne.jp/keyword/fuzzyfinder.vim

" Enable FufMruFile
let g:fuf_modesDisable = ['mrucmd']
" Make mru list larger
let g:fuf_mrufile_maxItem = 400
" The key to show the preview in the status lines
let g:fuf_keyPreview = '<Space>'

" Keymapping
nnoremap <silent> <C-m> :FufBuffer<CR>
nnoremap <silent> <C-k> :FufFile<CR>
nnoremap <silent> <C-l> :FufFileWithCurrentBufferDir<CR>
nnoremap <silent> <C-j> :FufMruFile<CR>


This is a small Java library for parsing the Cloud Foundry environment variables (VCAP_SERVICES and so on).

// the first line of this file is used as a description in the POM, so keep it short and sweet!

Download from Bintray:

image::https://api.bintray.com/packages/pivotal-labs-london/maven/cf-env/images/download.svg[link="https://bintray.com/pivotal-labs-london/maven/cf-env/_latestVersion"]

Build with Gradle:

--------------------------------------
./gradlew build
--------------------------------------

Release with Gradle:

--------------------------------------
# you probably want to make these changes manually rather than like this
sed -i -e "s/^version = .*/version = 'x.y.z'/" build.gradle
echo -e "bintrayUser=pivotal-labs-london\nbintrayKey=..." >gradle.properties

./gradlew bintrayUpload
--------------------------------------

Document how to use the Bintray repo

This is a small Java library for parsing the Cloud Foundry environment variables (VCAP_SERVICES and so on).

// the first line of this file is used as a description in the POM, so keep it short and sweet!

Download from Bintray:

image::https://api.bintray.com/packages/pivotal-labs-london/maven/cf-env/images/download.svg[link="https://bintray.com/pivotal-labs-london/maven/cf-env/_latestVersion"]

Use as a dependency in your build:

--------------------------------------
repositories {
    jcenter() // or mavenCentral, for transitive dependencies
    maven {
        url = 'http://dl.bintray.com/pivotal-labs-london/maven/'
    }
}

dependencies {
    compile group: 'io.pivotal.labs', name: 'cf-env', version: '0.0.1'
}
--------------------------------------

We hope to have the artifact available via JCenter soon, but until then, please use the repository on Bintray.

Build with Gradle:

--------------------------------------
./gradlew build
--------------------------------------

Release with Gradle:

--------------------------------------
# you probably want to make these changes manually rather than like this
sed -i -e "s/^version = .*/version = 'x.y.z'/" build.gradle
echo -e "bintrayUser=pivotal-labs-london\nbintrayKey=..." >gradle.properties

./gradlew bintrayUpload
--------------------------------------


= Auxly

image:http://img.shields.io/:license-mit-blue.svg["License", link="https://github.com/jeffrimko/Qprompt/blob/master/LICENSE"]
image:https://travis-ci.org/jeffrimko/Auxly.svg?branch=master["Build Status"]

== Introduction
This project provides a Python 2.7/3.x library for common tasks especially when writing shell-like scripts. Some of the functionality overlaps with the standard library but the API is slightly modified.

== Status
The status of this project is **pre-alpha**. This project is not yet suitable for use other than testing.

== Requirements
Auxly should run on any Python 2.7/3.x interpreter without additional dependencies.

== Usage
===
The following are basic examples of Auxly (all examples can be found https://github.com/jeffrimko/Auxly/tree/master/examples[here]):

  - https://github.com/jeffrimko/Auxly/blob/master/examples/delete_1.py[examples/delete_1.py] - Deletes all PYC files in the project.

----
include::examples\delete_1.py[]
----

Undo include change in readme.

= Auxly

image:http://img.shields.io/:license-mit-blue.svg["License", link="https://github.com/jeffrimko/Qprompt/blob/master/LICENSE"]
image:https://travis-ci.org/jeffrimko/Auxly.svg?branch=master["Build Status"]

== Introduction
This project provides a Python 2.7/3.x library for common tasks especially when writing shell-like scripts. Some of the functionality overlaps with the standard library but the API is slightly modified.

== Status
The status of this project is **pre-alpha**. This project is not yet suitable for use other than testing.

== Requirements
Auxly should run on any Python 2.7/3.x interpreter without additional dependencies.

== Usage

The following are basic examples of Auxly (all examples can be found https://github.com/jeffrimko/Auxly/tree/master/examples[here]):

  - https://github.com/jeffrimko/Auxly/blob/master/examples/delete_1.py[examples/delete_1.py] - Deletes all PYC files in the project.


// Module included in the following assemblies:
//
// * serverless/configuring-knative-serving-autoscaling.adoc

[id="configuring-scale-bounds-knative_{context}"]
= Configuring scale bounds Knative Serving autoscaling

The `minScale` and `maxScale` annotations can be used to configure the minimum and maximum number of Pods that can serve applications.
These annotations can be used to prevent cold starts or to help control computing costs.

minScale:: If the `minScale` annotation is not set, Pods will scale to zero (or to 1 if enable-scale-to-zero is false per the `ConfigMap`).

maxScale:: If the `maxScale` annotation is not set, there will be no upper limit for the number of Pods created.

`minScale` and `maxScale` can be configured as follows in the revision template:

[source,yaml]
----
spec:
  template:
    metadata:
      autoscaling.knative.dev/minScale: "2"
      autoscaling.knative.dev/maxScale: "10"
----

Using these annotations in the revision template will propagate this confguration to `PodAutoscaler` objects.

[NOTE]
====
These annotations apply for the full lifetime of a revision. Even when a revision is not referenced by any route, the minimal Pod count specified by `minScale` will still be provided. Keep in mind that non-routeable revisions may be garbage collected, which enables Knative to reclaim the resources.
====

Fix spec.template.metadata.annotations for min and max scale example

// Module included in the following assemblies:
//
// * serverless/configuring-knative-serving-autoscaling.adoc

[id="configuring-scale-bounds-knative_{context}"]
= Configuring scale bounds Knative Serving autoscaling

The `minScale` and `maxScale` annotations can be used to configure the minimum and maximum number of Pods that can serve applications.
These annotations can be used to prevent cold starts or to help control computing costs.

minScale:: If the `minScale` annotation is not set, Pods will scale to zero (or to 1 if enable-scale-to-zero is false per the `ConfigMap`).

maxScale:: If the `maxScale` annotation is not set, there will be no upper limit for the number of Pods created.

`minScale` and `maxScale` can be configured as follows in the revision template:

[source,yaml]
----
spec:
  template:
    metadata:
      annotations:
        autoscaling.knative.dev/minScale: "2"
        autoscaling.knative.dev/maxScale: "10"
----

Using these annotations in the revision template will propagate this confguration to `PodAutoscaler` objects.

[NOTE]
====
These annotations apply for the full lifetime of a revision. Even when a revision is not referenced by any route, the minimal Pod count specified by `minScale` will still be provided. Keep in mind that non-routeable revisions may be garbage collected, which enables Knative to reclaim the resources.
====


= Packetbeat reference
:libbeat: http://www.elastic.co/guide/en/beats/libbeat/1.0.0-rc1
:version: 1.0.0-rc1

include::./overview.asciidoc[]

include::./gettingstarted.asciidoc[]

include::./configuration.asciidoc[]

include::./command-line.asciidoc[]

include::./capturing.asciidoc[]

include::./https.asciidoc[]

include::./fields.asciidoc[]

include::./thrift.asciidoc[]

include::./windows.asciidoc[]

include::./kibana3.asciidoc[]

include::./filtering.asciidoc[]

include::./troubleshooting.asciidoc[]

include::./new_protocol.asciidoc[]

Use master version in docs

= Packetbeat reference
:libbeat: http://www.elastic.co/guide/en/beats/libbeat/master
:version: master

include::./overview.asciidoc[]

include::./gettingstarted.asciidoc[]

include::./configuration.asciidoc[]

include::./command-line.asciidoc[]

include::./capturing.asciidoc[]

include::./https.asciidoc[]

include::./fields.asciidoc[]

include::./thrift.asciidoc[]

include::./windows.asciidoc[]

include::./kibana3.asciidoc[]

include::./filtering.asciidoc[]

include::./troubleshooting.asciidoc[]

include::./new_protocol.asciidoc[]


= AsciiBinder

image:https://badge.fury.io/rb/ascii_binder.svg["Gem Version", link="https://badge.fury.io/rb/ascii_binder"]

AsciiBinder is an AsciiDoc-based system for authoring and publishing closely related documentation sets from a single source.

== Learn More

* See the http://www.asciibinder.org[homepage].
* Have a gander at the http://www.asciibinder.org/latest/welcome/[AsciiBinder documentation].
* Or just take the https://rubygems.org/gems/ascii_binder[ascii_binder Ruby Gem] for a spin.

The AsciiBinder system was initially developed for https://github.com/openshift/openshift-docs[OpenShift documentation], but has been revised to work for documenting a wide variety of complex, multi-versioned software projects.

== Contributing

We are using the https://github.com/redhataccess/ascii_binder/issues[Issues] page to track bugs and feature ideas on the code, so have a look and feel free to ask questions there. You can also chat with us on IRC at FreeNode, http://webchat.freenode.net/?randomnick=1&channels=asciibinder&uio=d4[#asciibinder] channel, or on Twitter - https://twitter.com/AsciiBinder[@AsciiBinder].

== License

The gem is available as open source under the terms of the http://opensource.org/licenses/MIT[MIT License].

Update docs link to point to docs repo

= AsciiBinder

image:https://badge.fury.io/rb/ascii_binder.svg["Gem Version", link="https://badge.fury.io/rb/ascii_binder"]

AsciiBinder is an AsciiDoc-based system for authoring and publishing closely related documentation sets from a single source.

== Learn More

* Have a gander at the https://github.com/redhataccess/ascii_binder-docs/blob/master/welcome/index.adoc[AsciiBinder documentation].
* Or just take the https://rubygems.org/gems/ascii_binder[ascii_binder Ruby Gem] for a spin.

The AsciiBinder system was initially developed for https://github.com/openshift/openshift-docs[OpenShift documentation], but has been revised to work for documenting a wide variety of complex, multi-versioned software projects.

== Contributing

We are using the https://github.com/redhataccess/ascii_binder/issues[Issues] page to track bugs and feature ideas on the code, so have a look and feel free to ask questions there. You can also chat with us on IRC at FreeNode, http://webchat.freenode.net/?randomnick=1&channels=asciibinder&uio=d4[#asciibinder] channel, or on Twitter - https://twitter.com/AsciiBinder[@AsciiBinder].

== License

The gem is available as open source under the terms of the http://opensource.org/licenses/MIT[MIT License].


:figure-caption!:

image::https://travis-ci.org/mmjmanders/ng-iban.svg?branch=master[title="travis status", alt="travis status", link="https://travis-ci.org/mmjmanders/ng-iban"]

image::https://app.wercker.com/status/eb4337041c62e162c5dd7af43122647c/m[title="wercker status", alt="wercker status", link="https://app.wercker.com/project/bykey/eb4337041c62e162c5dd7af43122647c"]

= ng-iban - validate input fields as IBAN
The goal is to provide an easy way to validate an input field as an IBAN number with https://angularjs.org/[AngularJS].
From version `0.4.0` the module uses https://github.com/arhs/iban.js[iban.js] for validation.

== Usage
First add

* `AngularJS`
* `ng-iban`

to your HTML file.

Make sure you require `mm.iban` as a dependency of your AngularJS module.

== Installation
`bower install ng-iban`

=== directive
[source,html]
----
<input type="text" ng-model="iban" ng-iban/>
----

To use this directive the `ngModel` directive must also be used because this directive depends on it.

Update documentation for NPM support

:figure-caption!:

image::https://travis-ci.org/mmjmanders/ng-iban.svg?branch=master[title="travis status", alt="travis status", link="https://travis-ci.org/mmjmanders/ng-iban"]

image::https://app.wercker.com/status/eb4337041c62e162c5dd7af43122647c/m[title="wercker status", alt="wercker status", link="https://app.wercker.com/project/bykey/eb4337041c62e162c5dd7af43122647c"]

= ng-iban - validate input fields as IBAN
The goal is to provide an easy way to validate an input field as an IBAN number with https://angularjs.org/[AngularJS].
From version `0.4.0` the module uses https://github.com/arhs/iban.js[iban.js] for validation.

== Installation

=== Bower

`bower install ng-iban`

=== NPM

`npm install ng-iban`

=== Other

Download file `dist/ng-iban.mni.js`.

== Usage

Add `mm.iban` as a dependency of your AngularJS module.

=== directive
[source,html]
----
<input type="text" ng-model="iban" ng-iban/>
----

To use this directive the `ngModel` directive must also be used because this directive depends on it.