dotfiles/neovim/.config/nvim/init.vim

71 lines
1.8 KiB
VimL
Raw Normal View History

2019-03-24 15:03:56 +01:00
""Basic stuff
set number
2022-05-08 17:44:30 +02:00
set relativenumber
2019-10-16 22:24:12 +02:00
set encoding=utf8
2020-01-23 00:12:46 +01:00
set clipboard+=unnamedplus
2019-03-24 15:03:56 +01:00
set nofoldenable
2019-04-02 12:24:17 +02:00
""Spaces instead of tabs
set expandtab
2019-05-11 01:04:20 +02:00
set tabstop=2
set shiftwidth=2
2019-08-29 23:22:18 +02:00
""Don't litter swp files everywhere
2019-08-27 01:07:55 +02:00
set backupdir=~/.cache
set directory=~/.cache
2019-11-25 02:26:44 +01:00
""Ignore case and highlight matches when searching
2019-10-16 22:24:12 +02:00
set ignorecase
2019-11-25 02:26:44 +01:00
set hlsearch
2021-02-05 02:23:10 +01:00
""Persistent undo
set undofile
2019-11-23 02:13:02 +01:00
""Resize line number colum
set numberwidth=2
2019-03-24 15:03:56 +01:00
""Keybindings
set pastetoggle=<F2>
let mapleader="\<Space>"
nnoremap <leader>n :noh<cr>
"Move the current line up or down
nnoremap <leader>k :m-2<cr>==
nnoremap <leader>j :m+<cr>==
2019-08-29 23:22:18 +02:00
""Markdown
2021-02-22 01:56:08 +01:00
autocmd Filetype markdown Goyo
2019-06-10 04:36:12 +02:00
let g:markdown_fenced_languages = ['cpp', 'python', 'java', 'sql']
2019-03-24 15:03:56 +01:00
let g:vim_markdown_math=1
2019-08-29 23:22:18 +02:00
""Snippets
let g:UltiSnipsExpandTrigger = '<tab>'
let g:UltiSnipsJumpForwardTrigger = '<tab>'
let g:UltiSnipsJumpBackwardTrigger = '<s-tab>'
2019-08-29 23:22:18 +02:00
""Vim-plug
call plug#begin('~/.config/nvim/plugged')
2019-05-31 00:22:54 +02:00
Plug 'plasticboy/vim-markdown', { 'for': 'markdown' }
2021-02-22 01:56:08 +01:00
Plug 'junegunn/goyo.vim', {'for': 'markdown', 'on': 'Goyo' }
2019-05-31 00:22:54 +02:00
Plug 'SirVer/ultisnips', { 'for': 'markdown' }
Plug 'Raimondi/delimitMate'
2019-11-23 02:13:02 +01:00
Plug 'cocopon/iceberg.vim'
2022-05-03 20:00:43 +02:00
Plug 'LnL7/vim-nix'
2019-05-31 00:22:54 +02:00
call plug#end()
2019-11-23 02:13:02 +01:00
""Colors
colorscheme iceberg
set termguicolors
2020-01-14 13:44:11 +01:00
""Disabe status line
set laststatus=0
2020-01-18 16:35:19 +01:00
""Set Markdown filetype for neomutt
autocmd BufNewFile,BufRead /tmp/neomutt* set filetype=markdown
2020-04-08 12:51:57 +02:00
""Quit whether Goyo is active or not
2020-01-18 16:35:19 +01:00
function! s:goyo_enter()
2019-03-24 15:03:56 +01:00
let b:quitting = 0
let b:quitting_bang = 0
call feedkeys('jk')
2019-03-24 15:03:56 +01:00
autocmd QuitPre <buffer> let b:quitting = 1
cabbrev <buffer> q! let b:quitting_bang = 1 <bar> q!
endfunction
2020-01-18 16:35:19 +01:00
function! s:goyo_leave()
2020-04-08 12:51:57 +02:00
if b:quitting_bang
qa!
else
qa
2019-03-24 15:03:56 +01:00
endif
endfunction
2020-04-08 12:51:57 +02:00
autocmd! User GoyoEnter nested call <SID>goyo_enter()
autocmd! User GoyoLeave nested call <SID>goyo_leave()