💾 Archived View for ait.place › dot › neovim.vim.txt captured on 2023-05-24 at 17:53:21.

View Raw

More Information

⬅️ Previous capture (2023-01-29)

-=-=-=-=-=-=-

"map <Space> <Nop>
"let mapleader=","

if ! filereadable(system('echo -n "${XDG_CONFIG_HOME:-$HOME/.config}/nvim/autoload/plug.vim"'))
	echo "Downloading junegunn/vim-plug to manage plugins..."
	silent !curl --create-dirs -fLo  "${XDG_CONFIG_HOME:-$HOME/.config}/nvim/autoload/plug.vim" "https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim"
	autocmd VimEnter * PlugInstall
endif

call plug#begin(system('echo -n "${XDG_CONFIG_HOME:-$HOME/.config}/nvim/plugged"'))
	Plug 'jreybert/vimagit'
	Plug 'vimwiki/vimwiki'
	Plug 'tomasiser/vim-code-dark'
	Plug 'vim-airline/vim-airline'
call plug#end()


set go=a
set mouse=a
set nohlsearch
set clipboard+=unnamedplus

" Some basics
nnoremap c "_c
set nocompatible
filetype plugin indent on
syntax on
set title
set encoding=utf-8
set number relativenumber
set noruler noshowmode noshowcmd
set scrolloff=999
set laststatus=3
let g:indentLine_char = '▏'
set timeoutlen=0

" Transparent background
au ColorScheme * hi Normal ctermbg=none guibg=none
au ColorScheme * hi LineNr ctermbg=none guibg=none
au ColorScheme * hi EndOfBuffer ctermbg=none guibg=none

" Colors
set termguicolors
colorscheme codedark
let g:airline_theme = 'codedark'

" Automatic folding based on syntax
set foldmethod=syntax
set foldlevel=2
let g:sh_fold_enabled= 5
let g:vimsyn_folding='afP'

" Automatic folding with indent but allows indents to be made
"	augroup vimrc
"		au BufReadPre * setlocal foldmethod=indent
"		au BufWinEnter * if &fdm == 'indent' | setlocal foldmethod=manual | endif
"	augroup END

" Seach as character are enterd
set incsearch
set smartcase

" Tab Settings
set shiftwidth=2
set softtabstop=2
set tabstop=2

" Persistend undo
set undofile

" Enable autocompletion:
set wildmode=longest,list,full
set complete+=kspell

" Enable Japanese encoded files
set fileencodings=ucs-bom,utf-8,sjis,default

" Pyton and yaml coloumn
autocmd Filetype yaml set cursorcolumn
autocmd Filetype yml set cursorcolumn
autocmd Filetype python set cursorcolumn

" Disables automatic commenting on newline:
autocmd FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o

" Spell-check set to <leader>o, 'o' for 'orthography':
map <leader>e :setlocal spell! spelllang=en<CR>
map <leader>n :setlocal spell! spelllang=nb<CR>

" Replace ex mode with gq
map Q gq

" Check file in shellcheck:
map <leader>s :!clear && shellcheck %<CR>

" Replace all is aliased to S.
nnoremap S :%s//g<Left><Left>

" Compile document, be it groff/LaTeX/markdown/etc.
map <leader>c :w! \| !compiler <c-r>%<CR>

" Open corresponding .pdf/.html or preview
map <leader>p :!opout <c-r>%<CR><CR>

" Runs a script that cleans out tex build files whenever I close out of a .tex file.
autocmd VimLeave *.tex !texclear %

" Ensure files are read as what I want:
let g:vimwiki_ext2syntax = {'.Rmd': 'markdown', '.rmd': 'markdown','.md': 'markdown', '.markdown': 'markdown', '.mdown': 'markdown'}
map <leader>v :VimwikiIndex
let g:vimwiki_list = [{'path': '~/Documents/notes', 'syntax': 'markdown', 'ext': '.md'}]
autocmd BufRead,BufNewFile *.md set filetype=markdown
autocmd BufRead,BufNewFile *.ms,*.me,*.mom,*.man set filetype=groff
autocmd BufRead,BufNewFile *.tex set filetype=tex

" Save file as sudo on files that require root permission
cnoremap w!! execute 'silent! write !sudo tee % >/dev/null' <bar> edit!

" Automatically deletes all trailing whitespace and newlines at end of file on save.
autocmd BufWritePre * %s/\s\+$//e
autocmd BufWritepre * %s/\n\+\%$//e

" Turns off highlighting on the bits of code that are changed, so the line that is changed is highlighted but the actual text that has changed stands out on the line and is readable.
if &diff
		highlight! link DiffText MatchParen
endif

" Neovide options
" Have the application to render at 240hz
let g:neovide_refresh_rate=240