You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

69 lines
1.8 KiB

" Packer plugins
lua require('plugins')
" Gruvbox Theme (colorscheme applied from plugins.lua)
if has('termguicolors')
set termguicolors
" For dark version.
set background=dark
" We need to apply this here too to make sure the startup components work
colorscheme gruvbox
" Miscellaneous boilerplate
set nocompatible " Disable vi compatibility
set ignorecase
set cc=128 " 128 characters
set noswapfile
set backupdir=~/.cache/nvim
set cursorline " Highlight current line
set mouse=a " Mouse
set nofixendofline
set clipboard+=unnamedplus " System clipboard
" Default indentation
set softtabstop=4
set tabstop=4
set shiftwidth=4
set expandtab
set autoindent
" Syntax highlighting
set syntax=on
" LaTeX
let g:vimtex_view_general_viewer = 'okular'
let g:vimtex_view_general_options = '--unique file:@pdf\#src:@line@tex'
let g:special_filetype_pattern = 'neo-tree\|toggleterm\|minimap'
" Show line numbers on non-toolbar buffers
fun! ShowNumberIfNecessary()
if &ft =~ g:special_filetype_pattern
setlocal nu
autocmd BufEnter * call ShowNumberIfNecessary()
" Terminal remapping
lua << EOF
function _G.set_terminal_keymaps()
local opts = {buffer = 0}
vim.keymap.set('t', '<esc>', [[<C-\><C-n>]], opts)
vim.keymap.set('t', 'jk', [[<C-\><C-n>]], opts)
vim.keymap.set('t', '<C-h>', [[<Cmd>wincmd h<CR>]], opts)
vim.keymap.set('t', '<C-j>', [[<Cmd>wincmd j<CR>]], opts)
vim.keymap.set('t', '<C-k>', [[<Cmd>wincmd k<CR>]], opts)
vim.keymap.set('t', '<C-l>', [[<Cmd>wincmd l<CR>]], opts)
autocmd TermOpen term://* lua set_terminal_keymaps()
" Spell checking
autocmd FileType tex,markdown setlocal spell spelllang=en_us
" Editor integration
let $GIT_EDITOR = 'nvr -cc split --remote-wait --servername ' . v:servername
autocmd FileType gitcommit,gitrebase,gitconfig set bufhidden=delete