205 lines
5.3 KiB
VimL

call plug#begin(stdpath('data') . '/plugged')
"Timmy Popester
Plug 'tpope/vim-surround'
Plug 'tpope/vim-repeat'
Plug 'tpope/vim-commentary'
Plug 'tpope/vim-fugitive'
Plug 'jiangmiao/auto-pairs'
" Nav
Plug 'rhysd/clever-f.vim'
Plug 'easymotion/vim-easymotion'
" Utilities
" Plug 'Yggdroot/LeaderF', { 'do': ':LeaderfInstallCExtension' }
Plug 'mhinz/vim-startify'
Plug 'mbbill/undotree'
Plug 'junegunn/vim-easy-align'
Plug 'famiu/nvim-reload'
Plug 'kyazdani42/nvim-web-devicons'
Plug 'nvim-lua/plenary.nvim'
Plug 'nvim-lua/popup.nvim'
Plug 'nvim-telescope/telescope.nvim'
" Languages
Plug 'dag/vim-fish', { 'for' : 'fish' }
" Stuff to maybe install later
Plug 'airblade/vim-gitgutter' " This one is going to depend on whether vim still remains snappy
" Plug 'ionide/Ionide-vim', { " Are we really going to try and develop on vim?
" \ 'do': 'make fsautocomplete',
" \}
" Plug 'autozimu/LanguageClient-neovim', { 'branch': 'next', 'do': 'bash install.sh' }
call plug#end()
set number
set relativenumber
set autochdir
set splitbelow
set splitright
set tabstop=4
set tw=80
set ft+=t
set shiftwidth=4
set expandtab
set softtabstop=4
set nowrap
set ignorecase
set smartcase
set noswapfile
set nobackup
set hidden
set wildmenu
set clipboard=unnamedplus
set shell=/bin/bash
if exists('g:fvim_loaded')
nnoremap <silent> <C-=> :set guifont=+<CR>
nnoremap <silent> <C--> :set guifont=-<CR>
FVimCursorSmoothMove v:false
FVimCursorSmoothBlink v:true
FVimFontAutoSnap v:true
endif
let mapleader = " "
nnoremap Y y$
nnoremap vv ^vg_
noremap \ q
noremap $ g_
nnoremap ' `
nnoremap ` '
nnoremap - :Ex<CR>
map , <Plug>(easymotion-prefix)
nnoremap <silent> <Leader>/ :nohlsearch<CR>
nnoremap <Leader>w :w<CR>
nnoremap <silent> <Leader>rl :so $MYVIMRC<CR>:echo 'init.vim Reloaded!'<CR>
nnoremap <silent> <Leader>ei :e $MYVIMRC<CR>
nnoremap <silent> <Leader>bk :bd<CR>
nnoremap <silent> <Leader>bb :b#<CR>
" nnoremap <silent> <Leader>q :call DeleteBuffer()<CR>
nnoremap <silent> <Leader>q :q<CR>
nnoremap <C-W>o :call MaximizeToggle()<CR>
nnoremap <silent> <C-CR> :e term://fish<CR>
nnoremap <silent> <C-s>v :vsplit term://fish<CR>
nnoremap <silent> <C-s>s :split term://fish<CR>
nnoremap <silent> <C-s>t :tabnew term://fish<CR>
tnoremap <A-e> <C-\><C-n>
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
inoremap <A-h> <C-\><C-N><C-w>h
inoremap <A-j> <C-\><C-N><C-w>j
inoremap <A-k> <C-\><C-N><C-w>k
inoremap <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
noremap <A-H> <C-\><C-n>:tabprev<CR>
noremap <A-L> <C-\><C-n>:tabnext<CR>
tnoremap <A-H> <C-\><C-n>:tabprev<CR>
tnoremap <A-L> <C-\><C-n>:tabnext<CR>
inoremap <A-H> <C-\><C-n>:tabprev<CR>
inoremap <A-L> <C-\><C-n>:tabnext<CR>
noremap <A-Left> <C-\><C-n>:tabm -1<CR>
noremap <A-Right> <C-\><C-n>:tabm +1<CR>
noremap <A-S-Left> :vert resize -3<CR>
noremap <A-S-Right> :vert resize +3<CR>
noremap <A-S-Down> :resize +3<CR>
noremap <A-S-Up> :resize -3<CR>
nnoremap <C-t>n :tabnew<CR>
nnoremap <C-t>k :tabclose<CR>
nnoremap <Leader>pi :w<CR>:so $MYVIMRC<CR>:PlugInstall<CR>
nnoremap <Leader>pc :w<CR>:so $MYVIMRC<CR>:PlugClean<CR>
augroup terminal_settings
autocmd!
autocmd BufWinEnter,WinEnter term://* startinsert | setlocal norelativenumber nonumber nocursorcolumn nocursorline
autocmd BufLeave term://* stopinsert
" Ignore various filetypes as those will close terminal automatically
" Ignore fzf, ranger, coc
autocmd TermClose term://*
\ if (expand('<afile>') !~ "fzf") && (expand('<afile>') !~ "ranger") && (expand('<afile>') !~ "coc") |
\ call nvim_input('<CR>') |
\ endif
augroup END
" Plugins
" Clever-F
let g:clever_f_fix_key_direction = 1
" EasyMotion
let g:EasyMotion_startofline = 0
let g:EasyMotion_keys = 'asdfjklhgwueiroxnmvczqp'
" LeaderF
let g:Lf_ShortcutF = ''
let g:Lf_ShortcutB = ''
let g:Lf_WindowPosition = 'popup'
let g:Lf_PreviewInPopup = 1
noremap ;f :Leaderf file<CR>
noremap ;b :Leaderf buffer<CR>
noremap ;m :Leaderf mru<CR>
noremap ;c :Leaderf command<CR>
noremap ;h :Leaderf help<CR>
noremap ;l :Leaderf line<CR>
noremap ;w :Leaderf window<CR>
noremap ;a :Leaderf self<CR>
" Easy Align
xmap ga <Plug>(EasyAlign)
nmap ga <Plug>(EasyAlign)
" Custom Functions
function! MaximizeToggle()
if exists("s:maximize_session")
exec "source " . s:maximize_session
call delete(s:maximize_session)
unlet s:maximize_session
let &hidden=s:maximize_hidden_save
unlet s:maximize_hidden_save
else
let s:maximize_hidden_save = &hidden
let s:maximize_session = tempname()
set hidden
exec "mksession! " . s:maximize_session
only
endif
endfunction
function! DeleteBuffer()
let l:buflisted = getbufinfo({'buflisted': 1})
let [l:cur_winnr, l:cur_bufnr] = [winnr(), bufnr()]
" There's a bug where if it's a help window, it'll kill everything, so
" remove this for now
" if len(l:buflisted) < 2 | confirm qall | return | endif
for l:winid in getbufinfo(l:cur_bufnr)[0].windows
execute(win_id2win(l:winid) . 'wincmd w')
if l:cur_bufnr == l:buflisted[-1].bufnr | bp | else | bn | endif
endfor
execute(l:cur_winnr . 'wincmd w')
let l:is_terminal = getbufvar(l:cur_bufnr, '&buftype') == 'terminal'
if l:is_terminal | bd! # | else | silent! confirm bd # | endif
endfunction