83 lines
2.1 KiB
VimL
83 lines
2.1 KiB
VimL
""Basic stuff
|
|
set number
|
|
set encoding=utf8
|
|
set clipboard+=unnamedplus
|
|
set nofoldenable
|
|
""Spaces instead of tabs
|
|
set expandtab
|
|
set tabstop=2
|
|
set shiftwidth=2
|
|
""Don't litter swp files everywhere
|
|
set backupdir=~/.cache
|
|
set directory=~/.cache
|
|
""Ignore case and highlight matches when searching
|
|
set ignorecase
|
|
set hlsearch
|
|
""Resize line number colum
|
|
set numberwidth=2
|
|
""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>==
|
|
""Markdown
|
|
au FileType markdown Goyo
|
|
let g:markdown_fenced_languages = ['cpp', 'python', 'java', 'sql']
|
|
let g:vim_markdown_math=1
|
|
""Snippets
|
|
let g:UltiSnipsExpandTrigger = '<tab>'
|
|
let g:UltiSnipsJumpForwardTrigger = '<tab>'
|
|
let g:UltiSnipsJumpBackwardTrigger = '<s-tab>'
|
|
""Vim-plug
|
|
call plug#begin('~/.config/nvim/plugged')
|
|
Plug 'plasticboy/vim-markdown', { 'for': 'markdown' }
|
|
Plug 'junegunn/goyo.vim', { 'on': 'Goyo' }
|
|
Plug 'SirVer/ultisnips', { 'for': 'markdown' }
|
|
Plug 'Raimondi/delimitMate'
|
|
Plug 'cocopon/iceberg.vim'
|
|
call plug#end()
|
|
""Colors
|
|
colorscheme iceberg
|
|
set termguicolors
|
|
""Sets the colorscheme in tmux
|
|
let &t_8f = "\<Esc>[38;2;%lu;%lu;%lum"
|
|
let &t_8b = "\<Esc>[48;2;%lu;%lu;%lum"
|
|
""Disabe status line
|
|
set laststatus=0
|
|
""Set Markdown filetype for neomutt
|
|
autocmd BufNewFile,BufRead /tmp/neomutt* set filetype=markdown
|
|
""Quit whether Goyo is active or not
|
|
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
|
|
let b:quitting = 0
|
|
let b:quitting_bang = 0
|
|
autocmd QuitPre <buffer> let b:quitting = 1
|
|
cabbrev <buffer> q! let b:quitting_bang = 1 <bar> q!
|
|
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
|
|
if b:quitting_bang
|
|
qa!
|
|
else
|
|
qa
|
|
endif
|
|
endfunction
|
|
|
|
autocmd! User GoyoEnter nested call <SID>goyo_enter()
|
|
autocmd! User GoyoLeave nested call <SID>goyo_leave()
|