Last active
February 15, 2019 18:44
-
-
Save edrpls/7ffb7c6a9cf01f21398c4b6804f3f724 to your computer and use it in GitHub Desktop.
init.vim on antergos
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"set shell=/bin/sh | |
set termguicolors | |
set number | |
set ruler | |
set relativenumber | |
set cursorline | |
set synmaxcol=1000 | |
set clipboard=unnamed | |
set list listchars=tab:▸\ ,eol:¬,trail:· | |
" auto-reload | |
augroup VimConfig | |
au! | |
au BufWritePost ~/.config/nvim/init.vim so <afile> | |
augroup END | |
" preview replace changes in split window | |
set inccommand=split | |
nmap <bs> :<c-u>TmuxNavigateLeft<cr> | |
"Terminal Mappings | |
"https://neovim.io/doc/user/nvim_terminal_emulator.html | |
tnoremap <A-h> <C-\><C-n><C-w>h | |
tnoremap <A-j> <C-\><C-n><C-w>j | |
tnoremap <A-k> <C-\><C-n><C-w>k | |
tnoremap <A-l> <C-\><C-n><C-w>l | |
nnoremap <A-h> <C-w>h | |
nnoremap <A-j> <C-w>j | |
nnoremap <A-k> <C-w>k | |
nnoremap <A-l> <C-w>l | |
" Open terminal | |
nnoremap <leader>ot :bot pedit +terminal<CR><C-W><C-j>A | |
"NerdTree | |
map <C-n> :NERDTreeToggle<CR> | |
"mxw/jsx | |
" add json syntax highlighting | |
"au BufNewFile,BufRead *.json set ft=javascript | |
au BufRead,BufNewFile *.mdx set filetype=markdown | |
" Whitespace stuff | |
"set nowrap | |
set tabstop=8 | |
set shiftwidth=4 | |
set softtabstop=0 | |
set softtabstop=0 | |
set expandtab | |
set smarttab | |
set list listchars=tab:▸\ ,trail:· | |
" Wordwrap | |
set wrap | |
set linebreak | |
set nolist " list disables linebreak | |
set textwidth=0 | |
set wrapmargin=0 | |
"Folders | |
set fdm=marker | |
" Searching | |
set hlsearch | |
set incsearch | |
set ignorecase | |
set smartcase | |
" Tab completion | |
set wildmode=list:longest,list:full | |
set wildignore+=*.o,*.obj,.git,*.rbc,*.class,.svn,vendor/gems/* | |
" Status bar | |
set laststatus=2 | |
" " Copy to clipboard | |
"vnoremap <leader>y "+y | |
"nnoremap <leader>Y "+yg_ | |
"nnoremap <leader>y "+y | |
" " Paste from clipboard | |
"nnoremap <leader>p "+p | |
"nnoremap <leader>P "+P | |
"vnoremap <leader>p "+p | |
"vnoremap <leader>P "+P | |
" make userreal tabs | |
au FileType make set noexpandtab | |
" Thorfile, Rakefile, Vagrantfile and Gemfile are Ruby | |
au BufRead,BufNewFile {Gemfile,Rakefile,Vagrantfile,Thorfile,config.ru} set ft=ruby | |
" Remember last location in file | |
if has("autocmd") | |
au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$") | |
\| exe "normal g'\"" | endif | |
endif | |
"fzf regular search | |
set rtp+=~/.fzf | |
let $FZF_DEFAULT_COMMAND = 'ag -l --nocolor -g "" | grep -v ".*(ico|png|jpe?g|gif|svg|ttf|otf|eot|woff|map|dat)\$"' | |
nnoremap <silent> <C-p> :FZF<cr> | |
" [Files] File preview | |
let g:fzf_files_options = '--preview "highlight -O xterm256 -s moria {} 2> /dev/null; or cat {} | head -'.&lines.'"' | |
" MRU | |
"command! FZFMru call fzf#run({ | |
"\ 'source': v:oldfiles, | |
"\ 'sink': 'e', | |
"\ 'options': '-m -x +s', | |
"\ 'down': '40%'}) | |
"nnoremap <silent> <Leader>m :FZFMru<CR> | |
command! FZFLines call fzf#run({ | |
\ 'source': <sid>buffer_lines(), | |
\ 'sink': function('<sid>line_handler'), | |
\ 'options': '--extended --nth=3..', | |
\ 'down': '60%' | |
\}) | |
nmap <leader>/ :FZFLines<CR> | |
"chuck's FZF mappings | |
" regular search | |
nnoremap <silent> <C-p> :Files<CR> | |
" Open buffers | |
nnoremap <leader>bu :Buffers<CR> | |
" MRU | |
nnoremap <leader>h :History<CR> | |
" Marks | |
nnoremap <leader>m :Marks<CR> | |
" Search whitin current buffer | |
nnoremap <leader>/ :BLines<CR> | |
" Search within all buffers | |
nnoremap <leader>? :Lines<CR> | |
" Command history | |
command! CmdHist call fzf#vim#command_history({ | |
\ 'right': '40', | |
\ 'options': '+m --ansi --prompt="cmd:> " --header-lines=1 --expect=ctrl-e --tiebreak=index' | |
\}) | |
nnoremap q: :CmdHist<CR> | |
" Search history | |
command! QHist call fzf#vim#search_history({ | |
\ 'right': '40', | |
\ 'options': '+m --ansi --prompt="/:> " --header-lines=1 --expect=ctrl-e --tiebreak=index' | |
\}) | |
nnoremap q/ :QHist<CR> | |
" Commands | |
nnoremap <leader>c :Commands<CR> | |
" Buffer commits | |
nnoremap <leader>bc :BCommits<CR> | |
"END chuck's FZF mappings | |
" UndoTree map to F5 | |
nnoremap <F5> :UndotreeToggle<cr> | |
" Clear selection map to F11 | |
nnoremap <silent> <F5> :noh<cr> | |
nnoremap <silent> <F6> :set nopaste<cr> | |
nmap <silent> <F7> :LivedownToggle<CR> | |
set background=dark | |
"set background=light | |
" Default color scheme | |
"colorscheme solarized | |
colorscheme molokayo | |
"Airline | |
let g:airline_powerline_fonts = 1 | |
let g:airline_theme="molokai" | |
" search on open buffers | |
function! s:line_handler(l) | |
let keys = split(a:l, ':\t') | |
exec 'buf' keys[0] | |
exec keys[1] | |
normal! ^zz | |
endfunction | |
function! s:buffer_lines() | |
let res = [] | |
for b in filter(range(1, bufnr('$')), 'buflisted(v:val)') | |
call extend(res, map(getbufline(b,0,"$"), 'b . ":\t" . (v:key + 1) . ":\t" . v:val ')) | |
endfor | |
return res | |
endfunction | |
"No ctrl+w while changing split Not working :( | |
nnoremap <C-J> <C-W><C-J> | |
nnoremap <C-K> <C-W><C-K> | |
nnoremap <C-L> <C-W><C-L> | |
nnoremap <C-H> <C-W><C-H> | |
"UndoTree | |
if has("persistent_undo") | |
set undodir=~/.vim/undodir/ | |
set undofile | |
endif | |
"UltiSnips | |
let g:UltiSnipsExpandTrigger="<c-t>" | |
let g:UltiSnipsJumpForwardTrigger="<c-b>" | |
let g:UltiSnipsJumpBackwardTrigger="<c-z>" | |
"Deoplete | |
let g:deoplete#enable_at_startup = 1 | |
if !exists('g:deoplete#omni#input_patterns') | |
let g:deoplete#omni#input_patterns = {} | |
endif | |
" use tab to forward cycle | |
inoremap <silent><expr><tab> pumvisible() ? "\<c-n>" : "\<tab>" | |
" use tab to backward cycle | |
inoremap <silent><expr><s-tab> pumvisible() ? "\<c-p>" : "\<s-tab>" | |
" ALE configs | |
let g:ale_fixers = { 'javascript': ['eslint', 'prettier']} | |
let g:ale_fix_on_save = 1 | |
let g:ale_javascript_prettier_use_local_config = 1 | |
" ALE helpers | |
nnoremap <silent> gH :ALEHover<CR> | |
nnoremap <silent> gD :ALEDetail<CR> | |
nnoremap <silent> gG :ALEGoToDefinition<CR> | |
" omnifuncs | |
augroup omnifuncs | |
autocmd! | |
autocmd FileType css setlocal omnifunc=csscomplete#CompleteCSS | |
autocmd FileType html,markdown setlocal omnifunc=htmlcomplete#CompleteTags | |
autocmd FileType javascript setlocal omnifunc=javascriptcomplete#CompleteJS | |
autocmd FileType python setlocal omnifunc=pythoncomplete#Complete | |
autocmd FileType xml setlocal omnifunc=xmlcomplete#CompleteTags | |
augroup end | |
" tern | |
if exists('g:plugs["tern_for_vim"]') | |
let g:tern_show_argument_hints = 'on_hold' | |
let g:tern_show_signature_in_pum = 1 | |
autocmd FileType javascript setlocal omnifunc=tern#Complete | |
endif | |
"vim-plug | |
call plug#begin('~/.config/nvim/plugged') | |
" Make sure you use single quotes | |
" Shorthand notation; fetches https://github.com/junegunn/vim-easy-align | |
Plug 'junegunn/vim-easy-align' | |
Plug 'junegunn/vim-pseudocl' | |
Plug 'junegunn/vim-oblique' | |
Plug 'https://github.com/junegunn/vim-github-dashboard.git' | |
" Group dependencies, vim-snippets depends on ultisnips | |
Plug 'SirVer/ultisnips' | Plug 'honza/vim-snippets' | |
" On-demand loading | |
Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' } | |
" Plugin outside ~/.vim/plugged with post-update hook | |
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' } | |
Plug 'junegunn/fzf.vim' | |
Plug 'junegunn/gv.vim' | |
Plug 'junegunn/vim-peekaboo' | |
Plug 'tpope/vim-fugitive' | |
Plug 'tpope/vim-surround' | |
Plug 'tpope/vim-unimpaired' | |
Plug 'tpope/vim-repeat' | |
Plug 'tpope/vim-eunuch' | |
Plug 'rking/ag.vim' | |
Plug 'kshenoy/vim-signature' | |
Plug 'othree/html5.vim' | |
Plug 'othree/es.next.syntax.vim' | |
Plug 'othree/javascript-libraries-syntax.vim' | |
Plug 'othree/yajs.vim' | |
Plug 'mxw/vim-jsx' | |
Plug 'marijnh/tern_for_vim' | |
Plug 'vim-airline/vim-airline' | |
Plug 'vim-airline/vim-airline-themes' | |
Plug 'unblevable/quick-scope' | |
Plug 'mbbill/undotree' | |
Plug 'editorconfig/editorconfig-vim' | |
Plug 'pelodelfuego/vim-swoop' | |
Plug 'airblade/vim-gitgutter' | |
Plug 'christoomey/vim-tmux-navigator' | |
Plug 'christoomey/vim-tmux-runner' | |
Plug 'vim-scripts/Tabmerge' | |
Plug 'tomasr/molokai' | |
Plug 'fmoralesc/molokayo' | |
Plug 'shime/vim-livedown' | |
Plug 'w0rp/ale' | |
function! DoRemote(arg) | |
UpdateRemotePlugins | |
endfunction | |
Plug 'Shougo/deoplete.nvim', { 'do': function('DoRemote') } | |
Plug 'ternjs/tern_for_vim', { 'do': 'npm install' } | |
" Add plugins to &runtimepath | |
call plug#end() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment