Add stuff to neovim

This commit is contained in:
Oystein Kristoffer Tveit 2021-12-23 04:36:22 +01:00
parent 60158b4c81
commit 8749a26982

View File

@ -1,4 +1,4 @@
{ pkgs, home, colorTheme, ... }: { pkgs, home, ... }:
{ {
programs.neovim = { programs.neovim = {
enable = true; enable = true;
@ -8,6 +8,7 @@
vimdiffAlias = true; vimdiffAlias = true;
plugins = with pkgs.vimPlugins; [ plugins = with pkgs.vimPlugins; [
direnv-vim
vim-commentary vim-commentary
vim-gitgutter vim-gitgutter
fzf-vim fzf-vim
@ -17,7 +18,48 @@
vim-fugitive vim-fugitive
vim-css-color vim-css-color
semshi semshi
goyo-vim {
plugin = goyo-vim;
# TODO: The mapleader definition should be in extraConfig, but setting
# the mapleader before defining keymaps messes things up.
config = ''
let mapleader = " "
let g:goyo_width = '90%'
let g:goyo_height = '85%'
let g:goyo_linenr = 1
function! s:goyo_enter()
if executable('tmux') && strlen($TMUX)
silent !tmux set status off
silent !tmux list-panes -F '\#F' | grep -q Z || tmux resize-pane -Z
endif
set noshowmode
set noshowcmd
set scrolloff=999
Limelight
" ...
endfunction
function! s:goyo_leave()
if executable('tmux') && strlen($TMUX)
silent !tmux set status on
silent !tmux list-panes -F '\#F' | grep -q Z && tmux resize-pane -Z
endif
set showmode
set showcmd
set scrolloff=5
Limelight!
" ...
endfunction
autocmd! User GoyoEnter nested call <SID>goyo_enter()
autocmd! User GoyoLeave nested call <SID>goyo_leave()
nnoremap <leader>z :Goyo<CR>
'';
}
limelight-vim limelight-vim
vim-tmux-navigator vim-tmux-navigator
vim-polyglot vim-polyglot
@ -46,6 +88,16 @@
extraConfig = '' extraConfig = ''
set clipboard+=unnamedplus set clipboard+=unnamedplus
set number relativenumber set number relativenumber
set undofile
set undodir=~/.cache/vim/undodir
nnoremap <A-j> :m .+1<CR>==
nnoremap <A-k> :m .-2<CR>==
inoremap <A-j> <Esc>:m .+1<CR>==gi
inoremap <A-k> <Esc>:m .-2<CR>==gi
vnoremap <A-j> :m '>+1<CR>gv=gv
vnoremap <A-k> :m '<-2<CR>gv=gv
''; '';
}; };