Skip to content

Instantly share code, notes, and snippets.

@lukeschunk
Created October 16, 2018 15:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lukeschunk/e9c267e29102f6f048ca95f647c9dccf to your computer and use it in GitHub Desktop.
Save lukeschunk/e9c267e29102f6f048ca95f647c9dccf to your computer and use it in GitHub Desktop.
" minimal vim config for working on remote machines, in containers, etc.
" apk update && apk add vim
" curl -sL https://raw.githubusercontent.com/zacanger/z/master/.vimrc ~/.vimrc
call plug#begin('~/.vim/plugged')
Plug 'scrooloose/nerdtree'
Plug 'airblade/vim-gitgutter'
Plug 'sheerun/vim-polyglot'
Plug 'junegunn/vim-peekaboo'
Plug 'vim-scripts/syntaxcomplete'
Plug 'trevordmiller/nova-vim'
Plug 'TroyFletcher/vim-colors-synthwave'
Plug 'ctrlpvim/ctrlp.vim'
Plug 'jiangmiao/auto-pairs'
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
call plug#end()
set nu
syntax enable
set shiftwidth=2
set expandtab
set tabstop=2
set nobackup
set nowritebackup
set noswapfile
colorscheme synthwave
nmap <F6> :NERDTreeToggle<CR>
" Searching
set hlsearch
set incsearch
set ignorecase
set smartcase
highlight clear Search
highlight Search ctermfg=White
" Clean search (highlight)
nnoremap <silent> <leader>/ :noh<cr>
" blink the line containing the match
function! HLNext (blinktime)
set invcursorline
redraw
exec 'sleep ' . float2nr(a:blinktime * 250) . 'm'
set invcursorline
redraw
endfunction
" highlight matches when jumping to next
" This rewires n and N to do the highlighing...
nnoremap <silent> n n:call HLNext(0.4)<cr>
nnoremap <silent> N N:call HLNext(0.4)<cr>
" VIM-POLYGLOT
let g:javascript_plugin_flow = 1
" disable polyglot on these file types
" let g:polyglot_disabled = ['css', 'js', 'jsx', 'javascript', 'javascript.jsx']
"
" Silver Searcher integration https://github.com/ggreer/the_silver_searcher
let g:ackprg = 'ag --nogroup --nocolor --column'
" syntaxcomplete
if has("autocmd") && exists("+omnifunc")
autocmd Filetype *
\ if &omnifunc == "" |
\ setlocal omnifunc=syntaxcomplete#Complete |
\ endif
endif
set wildmode=list:longest,list:full
let g:ctrlp_custom_ignore = '\v[\/](public|node_modules|target|dist)|(\.(swp|tox|ico|git|hg|svn))$'
let g:ctrlp_user_command = "find %s -type f | grep -Ev '"+ g:ctrlp_custom_ignore +"'"
let g:ctrlp_use_caching = 0
let g:ctrlp_open_new_file = 'r'
"let g:ctrlp_map = '<leader>p'
let g:ctrlp_cmd = 'CtrlP'
" sync vim register with system clipboard
set clipboard=unnamed
"these are for relative line numbers
"autocmd InsertEnter * :set number
"autocmd InsertLeave * :set relativenumber
nnoremap x "_x
" docker + webpack on mac is a thing
let g:backupcopy = 'yes'
function! Smart_TabComplete()
let line = getline('.') " current line
let substr = strpart(line, -1, col('.')+1) " from the start of the current
" line to one character right
" of the cursor
let substr = matchstr(substr, "[^ \t]*$") " word till cursor
if (strlen(substr)==0) " nothing to match on empty string
return "\<tab>"
endif
let has_period = match(substr, '\.') != -1 " position of period, if any
let has_slash = match(substr, '\/') != -1 " position of slash, if any
if (!has_period && !has_slash)
return "\<C-X>\<C-P>" " existing text matching
elseif ( has_slash )
return "\<C-X>\<C-F>" " file matching
else
return "\<C-X>\<C-O>" " plugin matching
endif
endfunction
inoremap <tab> <c-r>=Smart_TabComplete()<CR>
map <silent> <F8> /^\(<\{7\}\\|>\{7\}\\|=\{7\}\\|\|\{7\}\)\( \\|$\)<cr>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment