~ntgg/dotfiles

cc44f843fba8cd3d287be6cfc578e588472d4927 — Noah Graff 7 months ago 50d28be
update init.vim to be more cross platform

I recently started work, and I have to use windows. Neovim kinda works
well on windows, but I still want to have a consistent config. I did
end up removing a lot of plugins, mainly because I really only use
neovim for super simple and fast editing. Kakoune is much nicer to use
in unix-like environments, and on windows stuff like vscode or onivim2
work better for editing in more complex scenarios. The new config is
completely cross platform as far as I can tell, and super minimal. If I
Ever get more time to just play around with configs I may do more, but
I don't know if I'll get the time soon or even care enough about my
neovim config to do it.
1 files changed, 8 insertions(+), 106 deletions(-)

M .config/nvim/init.vim
M .config/nvim/init.vim => .config/nvim/init.vim +8 -106
@@ 2,26 2,14 @@

set nocompatible

call plug#begin('~/.local/share/nvim/plugged')
call plug#begin(stdpath('data') . '/plugged')

Plug 'junegunn/fzf.vim'
Plug 'tpope/vim-surround'
Plug 'tpope/vim-commentary'

Plug 'morhetz/gruvbox'
Plug 'itchyny/lightline.vim'

" language specific
Plug 'rust-lang/rust.vim'
Plug 'dag/vim-fish'
Plug 'tikhomirov/vim-glsl'
Plug 'cespare/vim-toml'
Plug 'gluon-lang/vim-gluon'

Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
Plug 'sebastianmarkow/deoplete-rust'
Plug 'autozimu/LanguageClient-neovim', { 'branch': 'next', 'do': 'bash install.sh' }

call plug#end()

filetype plugin indent on


@@ 29,14 17,13 @@ syntax on


let g:gruvbox_italic=1
let g:gruvbox_contrast_dark='meduim'
let g:gruvbox_contrast_light='soft'
color gruvbox
colorscheme gruvbox

" GUI options:
set guifont='Fira\ Code:h10'
set guioptions-=m " removes the menu bar
set guioptions-=T " removes the toolbar
set guioptions-=r " removes right-hand scrollbar

" TUI options:
set termguicolors


@@ 54,11 41,12 @@ set relativenumber
set ruler
set list " Show Space, Tab, and EOL
set listchars=tab:▸\ ,eol:¬
set listchars +=space:·
set belloff=all " No annoying error sounds
set listchars+=space:·
set belloff=all " No annoying error sounds or visuals
set undofile
set undodir=~/.config/nvim/undodir
let &undodir=stdpath('data') . '/undodir'
set completeopt=menu

" Indent options:
set smarttab
set autoindent


@@ 70,57 58,17 @@ set expandtab
" Custom commands
let mapleader=","

" neovim integrated terminal options
" needed for fzf to be able to close window on <Esc>
" I'm sure there is a better way to do this, but it works
function TerminalMapQuit()
    if b:term_title!~"#FZF"
        tnoremap <buffer> <Esc> <C-\><C-n>
    endif
endfunction

augroup terminal_mapping
    autocmd!
    autocmd TermOpen * call TerminalMapQuit()
augroup end

tnoremap <C-\><Esc> <Esc>

inoremap jj <C-[>

" move between windows
nnoremap <leader>wh <C-W>h
nnoremap <leader>wl <C-W>l
nnoremap <leader>wj <C-W>j
nnoremap <leader>wk <C-W>k
" open a new split
nnoremap <leader>wv :vsplit<CR>
nnoremap <leader>ws :split<CR>
" clear search
nnoremap <silent> <leader>/ :let @/=""<CR>

" buffer stuff:
" normal mode:
" (b)uffer (e)xplorer
nnoremap <leader>be :Buffers<CR>
nnoremap <silent> <leader>be : ls<CR>:b 
" (b)uffer (p)revious
nnoremap <silent> <leader>bp :b#<CR>
" (b)uffer (t)erminal
" works iff one terminal is open
nnoremap <silent> <leader>bt :b term://<CR>

" FZF stuff:
function FindFilesFZF()
    if system("git rev-parse --is-inside-work-tree") =~ "true"
        :GFiles
    else
        :Files
    endif
endfunction

nnoremap <leader>ff :call FindFilesFZF()<CR>
nnoremap <leader>faf :Files<CR>
nnoremap <leader>fg :Rg<CR>

nnoremap Q @q



@@ 130,49 78,3 @@ nnoremap <silent> <CR> :pu _<CR>:'[-1<CR>
let g:lightline = {
  \ 'colorscheme': 'gruvbox',
  \ }

" LSP
let g:LanguageClient_serverCommands = {
  \ 'rust': ['rls'],
  \ 'gluon': ['gluon_language-server']
  \ }

" from fzf help page
let g:fzf_colors =
  \ { 'fg':      ['fg', 'Normal'],
    \ 'bg':      ['bg', 'Normal'],
    \ 'hl':      ['fg', 'Comment'],
    \ 'fg+':     ['fg', 'CursorLine', 'CursorColumn', 'Normal'],
    \ 'bg+':     ['bg', 'CursorLine', 'CursorColumn'],
    \ 'hl+':     ['fg', 'Statement'],
    \ 'info':    ['fg', 'PreProc'],
    \ 'border':  ['fg', 'Ignore'],
    \ 'prompt':  ['fg', 'Conditional'],
    \ 'pointer': ['fg', 'Exception'],
    \ 'marker':  ['fg', 'Keyword'],
    \ 'spinner': ['fg', 'Label'],
    \ 'header':  ['fg', 'Comment'] }

nnoremap <silent> K :call LanguageClient#textDocument_hover()<CR>
nnoremap <silent> gd :call LanguageClient#textDocument_definition()<CR>
nnoremap <silent> <F2> :call LanguageClient#textDocument_rename()<CR>
nnoremap <silent> <F5> :call LanguageClient_contextMenu()<CR>

" auto complete
augroup filetype_rust
    autocmd!
    autocmd FileType rust
    \ call deoplete#custom#buffer_option('auto_complete', v:true)
augroup end

augroup filetype_gluon
    autocmd!
    autocmd FileType gluon
    \ call deoplete#custom#buffer_option('auto_complete', v:true)
augroup end

let g:deoplete#enable_at_startup=1
call deoplete#custom#option('auto_complete', v:false)
let g:deoplete#sources#rust#racer_binary='which racer'
let g:deoplete#sources#rust#rust_source_path=$RUST_SRC_PATH.'/'
let g:deoplete#sources#rust#disable_keymap=1