Browse Source

added floaterm and hy plugins

master
Micah Halter 1 month ago
parent
commit
12b51ba675
Signed by: mehalter <micah.halter@gtri.gatech.edu> GPG Key ID: 4224A6EA9A8CAAA8
1 changed files with 27 additions and 54 deletions
  1. +27
    -54
      neovim/.config/nvim/init.vim

+ 27
- 54
neovim/.config/nvim/init.vim View File

@@ -13,6 +13,7 @@ Plug 'https://github.com/edkolev/tmuxline.vim'
Plug 'https://github.com/fatih/vim-go', { 'do': ':GoUpdateBinaries' }
Plug 'https://github.com/glts/vim-textobj-comment'
Plug 'https://github.com/honza/vim-snippets'
Plug 'https://github.com/hylang/vim-hy'
Plug 'https://github.com/itchyny/lightline.vim'
Plug 'https://github.com/junegunn/fzf.vim'
Plug 'https://github.com/junegunn/goyo.vim'
@@ -34,6 +35,7 @@ Plug 'https://github.com/vim-pandoc/vim-pandoc'
Plug 'https://github.com/vim-pandoc/vim-pandoc-syntax'
Plug 'https://github.com/vim-pandoc/vim-rmarkdown'
Plug 'https://github.com/vim-scripts/ReplaceWithRegister'
Plug 'https://github.com/voldikss/vim-floaterm'
Plug 'https://github.com/wmvanvliet/jupyter-vim'
call plug#end()

@@ -88,6 +90,10 @@ augroup markdeep
autocmd BufNewFile,BufRead *.md.html setlocal filetype=markdown
augroup END

augroup hy
autocmd BufNewFile,BufRead *.hy setlocal filetype=hy
augroup END

" disable tab character showing in golang
"augroup golang
" autocmd FileType go setlocal listchars=tab:\ \ ,trail:·,extends:›,precedes:‹,nbsp:␣
@@ -156,7 +162,6 @@ augroup jupyter
autocmd Filetype python,julia inoremap ;mk # +<CR><BS><BS><CR><CR># -<esc>2ko
autocmd Filetype python,julia nnoremap <buffer> <silent> <leader>sb ?#\ +<CR>V/#\ -<CR>
autocmd Filetype python,julia nnoremap <buffer> <silent> <leader>cn :JupyterConnect<CR>
autocmd Filetype python,julia vmap <buffer> <silent> <leader>e <Plug>JupyterRunVisual
autocmd Filetype python,julia vmap <buffer> <silent> <leader><CR> <Plug>JupyterRunVisual
augroup END

@@ -171,6 +176,10 @@ map <leader>fh :History<CR>
map <leader>fg :Tags<CR>
map <leader>ft :BTags<CR>

" hy
let g:hy_enable_conceal=1
let g:hy_conceal_fancy=1

" goyo
let g:goyo_width=100
let g:goyo_margin_top=2
@@ -300,55 +309,19 @@ function! ToggleNetrw() abort
endfunction

" floatterm
map <leader>fn :call FloatTerm()<CR>
map <leader>gt :call FloatTerm('"lazygit"')<CR>
let s:float_term_border_win = 0
let s:float_term_win = 0
function! FloatTerm(...)
" Configuration
let height = float2nr((&lines - 2) * 0.75)
let row = float2nr((&lines - height) / 2)
let width = float2nr(&columns * 0.9)
let col = float2nr((&columns - width) / 2)
" Border Window
let border_opts = {
\ 'relative': 'editor',
\ 'row': row - 1,
\ 'col': col - 2,
\ 'width': width + 4,
\ 'height': height + 2,
\ 'style': 'minimal'
\ }
" Terminal Window
let opts = {
\ 'relative': 'editor',
\ 'row': row,
\ 'col': col,
\ 'width': width,
\ 'height': height,
\ 'style': 'minimal'
\ }
let top = "╭" . repeat("─", width + 2) . "╮"
let mid = "│" . repeat(" ", width + 2) . "│"
let bot = "╰" . repeat("─", width + 2) . "╯"
let lines = [top] + repeat([mid], height) + [bot]
let bbuf = nvim_create_buf(v:false, v:true)
call nvim_buf_set_lines(bbuf, 0, -1, v:true, lines)
let s:float_term_border_win = nvim_open_win(bbuf, v:true, border_opts)
let buf = nvim_create_buf(v:false, v:true)
let s:float_term_win = nvim_open_win(buf, v:true, opts)
" Styling
call setwinvar(s:float_term_border_win, '&winhl', 'Normal:Normal')
call setwinvar(s:float_term_win, '&winhl', 'Normal:Normal')
if a:0 == 0
terminal
else
call termopen(a:1)
endif
startinsert
" Close border window when terminal window close
autocmd TermClose * ++once :bd! | call nvim_win_close(s:float_term_border_win, v:true)
endfunction
let g:floaterm_autoclose = v:true
map <leader>fn :FloatermNew<CR>
map <leader>gt :FloatermNew name=git height=0.75 width=0.9 lazygit<CR>
nnoremap <silent> <F1> :FloatermToggle<CR>
tnoremap <silent> <F1> <C-\><C-n>:FloatermToggle<CR>
nnoremap <silent> <F2> :FloatermPrev<CR>
tnoremap <silent> <F2> <C-\><C-n>:FloatermPrev<CR>
nnoremap <silent> <F3> :FloatermNext<CR>
tnoremap <silent> <F3> <C-\><C-n>:FloatermNext<CR>
autocmd Filetype python map <leader>rp :FloatermNew name=repl wintype=normal position=right width=0.5 python<CR>
autocmd Filetype julia map <leader>rp :FloatermNew name=repl wintype=normal position=right width=0.5 julia<CR>
autocmd Filetype hy map <leader>rp :FloatermNew name=repl wintype=normal position=right width=0.5 hy<CR>
autocmd Filetype python,julia,hy vmap <buffer> <silent> <leader>e :FloatermSend! repl<CR>

""""""""""""""""""""""""""""
" => Remaps
@@ -434,10 +407,10 @@ augroup tabs
augroup END

" use arrow keys to resize
nnoremap <Up> :resize +5<CR>
nnoremap <Down> :resize -5<CR>
nnoremap <Left> :vertical resize -5<CR>
nnoremap <Right> :vertical resize +5<CR>
nnoremap <silent> <C-Up> :resize +3<CR>
nnoremap <silent> <C-Down> :resize -3<CR>
nnoremap <silent> <C-Left> :vertical resize +3<CR>
nnoremap <silent> <C-Right> :vertical resize -3<CR>

" terminal remaps
tnoremap <leader><ESC> <C-\><C-n>


Loading…
Cancel
Save