Skip to content

Instantly share code, notes, and snippets.

@akiross
Created July 6, 2021 19:33
Show Gist options
  • Save akiross/e12892ea1e36a3d86a7f4a3307874440 to your computer and use it in GitHub Desktop.
Save akiross/e12892ea1e36a3d86a7f4a3307874440 to your computer and use it in GitHub Desktop.
Neovim config
" Enable
set list
" what character to display instead of spaces
set listchars=tab:»\ ,trail:-,precedes:←,extends:→,eol:↲,nbsp:␣,space:·
" number of spaces a Tab counts for
set tabstop=4
" how many spaces an (auto)indent operation will use
" this may mix tabs and spaces according to other settings
" e.g. if ts=4 and sw=6 with noexpandtab, >> will add <tab><sp><sp>
set shiftwidth=4
" expandtabs: convert tabs to spaces
set expandtab
" softtabstop: behaves as if tabs where of 4 spaces
set softtabstop=4
" Show number of lines
set number
" enable true colors
set termguicolors
" enable monoaki theme
syntax enable
colorscheme monoaki
" Highlight cursor position
set cursorline
set cursorcolumn
" vim-plug section
" :PlugInstall to install plugins
" :PlugUpdate to install/update plugins
" :PlugUpgrade to upgrade vim-plug
" :PlugStatus to see plugin status
" :PlugDiff to see pending changes
" :PlugClean to remove unused plugins
call plug#begin()
" vim-nix for writing nix-expressions
Plug 'LnL7/vim-nix'
" vim-floatterm
" :FloatermNew create new float term
" :FloatermToggle hide/show that
Plug 'voldikss/vim-floaterm'
" Async Lint Engine, provides some nice tools for various languages
Plug 'dense-analysis/ale'
" fzf support
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
Plug 'junegunn/fzf.vim'
" (Optional) Multi-entry selection UI.
" Plug 'junegunn/fzf'
" Skim (fzf alternative)
" Plug 'lotabout/skim', { 'dir': '~/.skim', 'do': './install' }
call plug#end()
" Floaterm settings
let g:floaterm_width = 0.9
let g:floaterm_height = 0.9
" Autoclose if job exited normally, otherwise stay open (0 open, 2 close)
let g:floaterm_autoclose = 1
" Open terminal with F4
let g:floaterm_keymap_toggle = '<F4>'
" Open file manager (ranger) with F3
nnoremap <silent> <F3> :FloatermNew ranger<CR>
" Exit terminal mode with Esc (I don't normally use Esc in terminal)
tnoremap <Esc> <C-\><C-n>
" Send Esc to terminal with "verbatim" C-v
tnoremap <C-v><Esc> <Esc>
" Enabled linters for ALE (added to the default)
let g:ale_linters = {
\ 'rust': ['analyzer', 'cargo', 'rustfmt'],
\ }
let g:ale_fixers = {
\ 'rust': ['rustfmt'],
\ 'javascript': ["prettify"],
\ 'html': ["prettify"],
\ 'css': ["prettify"],
\ }
" Enable completion support for ALE
let g:ale_completion_enabled = 1
" Enable fix on save
" let g:ale_fix_on_save = 1
" Automatic import
" let g:ale_completion_autoimport = 1
" Omni-completion with <C-x><C-o>
set omnifunc=ale#completion#OmniFunc
" Remap gd to use ALEGoToDefinition and open in a new tab
map gd :ALEGoToDefinition -tab<CR>
" Improve YAML editing
" Stolen from https://stackoverflow.com/a/37488992/168717
autocmd FileType yaml setlocal ts=2 sts=2 sw=2 expandtab
" Fzf settings
let g:fzf_command_prefix = 'Fzf'
" Ctrl-P to open file with fzf
map <C-p> :FzfFiles<CR>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment