Mastery of floating windows achieved
This commit is contained in:
parent
b95b05fc9a
commit
8b0f4e4d83
2 changed files with 85 additions and 15 deletions
13
nvim/nvim.symlink/colors/maxbucknell.vim
Normal file
13
nvim/nvim.symlink/colors/maxbucknell.vim
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
hi clear
|
||||||
|
if exists("syntax_on")
|
||||||
|
syntax reset
|
||||||
|
endif
|
||||||
|
|
||||||
|
runtime colors/gruvbox.vim
|
||||||
|
let g:colors_name = 'maxbucknell'
|
||||||
|
|
||||||
|
hi clear NormalFloat
|
||||||
|
hi link NormalFloat Normal
|
||||||
|
|
||||||
|
hi ActiveWindow guibg=#282828 ctermbg=235
|
||||||
|
hi InactiveWindow guibg=#32302f ctermbg=236
|
|
@ -134,6 +134,7 @@ set shiftwidth=4
|
||||||
set softtabstop=4
|
set softtabstop=4
|
||||||
set autoindent
|
set autoindent
|
||||||
|
|
||||||
|
|
||||||
" Enable highlighting for syntax
|
" Enable highlighting for syntax
|
||||||
syntax on
|
syntax on
|
||||||
|
|
||||||
|
@ -142,7 +143,12 @@ filetype plugin indent on
|
||||||
|
|
||||||
" Theme configuration
|
" Theme configuration
|
||||||
let g:gruvbox_italic = 1
|
let g:gruvbox_italic = 1
|
||||||
colorscheme gruvbox
|
colorscheme maxbucknell
|
||||||
|
|
||||||
|
" I want floating windows to have the same syntax highlighting as normal vim
|
||||||
|
" things.
|
||||||
|
" hi NormalFloat ctermbg=4
|
||||||
|
|
||||||
|
|
||||||
" Lead with the biggest button on the motherfucking keyboard
|
" Lead with the biggest button on the motherfucking keyboard
|
||||||
let mapleader = "\<space>"
|
let mapleader = "\<space>"
|
||||||
|
@ -192,6 +198,17 @@ let g:colorizer_auto_filetype='css,less,scss,sass'
|
||||||
let g:colorizer_colornames = 0
|
let g:colorizer_colornames = 0
|
||||||
let g:colorizer_use_virtual_text = 1
|
let g:colorizer_use_virtual_text = 1
|
||||||
|
|
||||||
|
" Gitgutter
|
||||||
|
let g:gitgutter_realtime = 1
|
||||||
|
let g:gitgutter_eager = 1
|
||||||
|
|
||||||
|
" Status line stuff
|
||||||
|
let g:airline_theme = 'gruvbox'
|
||||||
|
let g:airline#extensions#tabline#enabled = 1
|
||||||
|
|
||||||
|
" Input supports patched fonts already \o/
|
||||||
|
let g:airline_powerline_fonts = 1
|
||||||
|
|
||||||
" Remap semi-colon to colon.
|
" Remap semi-colon to colon.
|
||||||
"
|
"
|
||||||
" Colon is the starting point of a lot of actions in Vim. And I
|
" Colon is the starting point of a lot of actions in Vim. And I
|
||||||
|
@ -216,12 +233,8 @@ nnoremap _ :-1d<cr>pk
|
||||||
|
|
||||||
" Updating Vimrc
|
" Updating Vimrc
|
||||||
"
|
"
|
||||||
" A little mapping to edit my vimrc. I'd like to do this with a function, and
|
" Open my vimrc in a floating window over my workspace when I want to edit it.
|
||||||
" account for a few things:
|
nnoremap <leader>ev :call OpenFileWindow($MYVIMRC)<cr>
|
||||||
"
|
|
||||||
" + Is a buffer already open and visible?
|
|
||||||
" + Open in a floating window over everything to not disturb my workflow
|
|
||||||
nnoremap <leader>ev :vsp $MYVIMRC<cr>
|
|
||||||
|
|
||||||
" Second part, every time I write to $MYVIMRC, source it for me.
|
" Second part, every time I write to $MYVIMRC, source it for me.
|
||||||
augroup updateVimrc
|
augroup updateVimrc
|
||||||
|
@ -345,15 +358,14 @@ augroup AutoMkdir
|
||||||
autocmd BufNewFile * :call EnsureDirExists()
|
autocmd BufNewFile * :call EnsureDirExists()
|
||||||
augroup END
|
augroup END
|
||||||
|
|
||||||
" Gitgutter
|
function! HandleWinEnter()
|
||||||
let g:gitgutter_realtime = 1
|
setlocal winhighlight=Normal:ActiveWindow,NormalNC:InactiveWindow
|
||||||
let g:gitgutter_eager = 1
|
endfunc
|
||||||
|
|
||||||
" Status line stuff
|
augroup WindowManagement
|
||||||
let g:airline#extensions#ale#enabled = 1
|
autocmd!
|
||||||
let g:airline#extensions#tabline#enabled = 1
|
autocmd WinEnter * call HandleWinEnter()
|
||||||
" Input supports patched fonts already \o/
|
augroup END
|
||||||
let g:airline_powerline_fonts = 1
|
|
||||||
|
|
||||||
" Show syntax highlighting groups for word under cursor
|
" Show syntax highlighting groups for word under cursor
|
||||||
"
|
"
|
||||||
|
@ -367,3 +379,48 @@ function! <SID>SynStack()
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
nnoremap <leader>\ :call <SID>SynStack()<CR>
|
nnoremap <leader>\ :call <SID>SynStack()<CR>
|
||||||
|
|
||||||
|
" Open a file as a hidden buffer
|
||||||
|
"
|
||||||
|
" Because Vim is single threaded, we can open this in the foreground, and
|
||||||
|
" replace it with the old buffer, and the screen won't change until we finish
|
||||||
|
" executing, at which point we are back where we began.
|
||||||
|
function! OpenFileHidden(file)
|
||||||
|
" Store the current buffer number
|
||||||
|
let oldbufnr = bufnr('%')
|
||||||
|
|
||||||
|
" Open the given file for editing
|
||||||
|
execute 'edit ' . a:file
|
||||||
|
|
||||||
|
" Store the new buffer number, because we return it
|
||||||
|
let newbufnr = bufnr('%')
|
||||||
|
|
||||||
|
" If they are equal, it means it was an empty buffer before and we need to
|
||||||
|
" open a new buffer instead of restoring the old one.
|
||||||
|
if oldbufnr == newbufnr
|
||||||
|
enew
|
||||||
|
else
|
||||||
|
execute oldbufnr . 'buffer'
|
||||||
|
endif
|
||||||
|
|
||||||
|
return newbufnr
|
||||||
|
endfunc
|
||||||
|
|
||||||
|
function! OpenFileWindow(file)
|
||||||
|
let newbufnr = OpenFileHidden(a:file)
|
||||||
|
|
||||||
|
let width = &columns - 10 - 5
|
||||||
|
let height = &lines - 10 - 3
|
||||||
|
|
||||||
|
let window_options = {
|
||||||
|
\ 'relative': 'editor',
|
||||||
|
\ 'height': height,
|
||||||
|
\ 'width': width,
|
||||||
|
\ 'row': 6,
|
||||||
|
\ 'col': 9
|
||||||
|
\ }
|
||||||
|
|
||||||
|
let newwinnr = nvim_open_win(newbufnr, v:true, window_options)
|
||||||
|
|
||||||
|
return newwinnr
|
||||||
|
endfunc
|
||||||
|
|
Loading…
Add table
Reference in a new issue