dotfiles/.config/nvim/lua/settings.lua

148 lines
3.9 KiB
Lua
Raw Normal View History

2021-09-03 01:18:44 -07:00
vim.cmd [[
set suffixes+=.aux,.bbl,.blg,.brf,.cb,.dvi,.idx,.ilg,.ind,.inx,.jpg,.log,.out,.png,.toc
set suffixes-=.h
set suffixes-=.obj
set tabstop=3 softtabstop=3
set shiftwidth=3
set expandtab
set smartindent
" set foldmethod=indent
" set foldlevel=0
set undodir=~/.vim/undo
set undofile
set guifont=SauceCodePro\ NF\ Regular
set hlsearch
set hidden
set ignorecase
set smartcase
set wrap
set linebreak
" set guicursor= " always use the block cursor
syntax on
set redrawtime=1000 " max syntax highlight time
set number relativenumber
set noerrorbells
set encoding=UTF-8
set cursorline
set mouse=a
set incsearch
set scrolloff=6
" set wildmenu
" set wildmode=full
" TextEdit might fail if hidden is not set.
set hidden
set cmdheight=1 " Give more space for displaying messages.
" Having longer updatetime (default is 4000 ms = 4 s) leads to noticeable
" delays and poor user experience.
set updatetime=300
" Don't pass messages to |ins-completion-menu|.
set shortmess+=c
" Spell check!
set spell spelllang=en_us
" spell check in git commits
autocmd Filetype gitcommit setlocal spell
set showcmd
set signcolumn=yes
" disable spell check in help files
autocmd FileType help setlocal nospell
filetype plugin on
" Macro for opening a new terminal with spell check off
command! Term tabnew | setlocal nospell | term
autocmd FileType help setlocal nospell
" test whitespace ->
" more test whitespace ->
" Indented text
" even more test whitespace ->
" Key bindings
let mapleader = " "
" *sigh*...
command! Q q
command! W w
command! Wq wq
command! WQ wq
" nnoremap ; :
" vnoremap ; :
" Press Alt h to toggle highlighting on/off, and show current value.
noremap <M-h> :set hlsearch! hlsearch?<CR>
" Escape to enter normal mode in the terminal
tnoremap <Esc> <C-\><C-n>
" Replace with alt S
nnoremap <M-s> :%s//g<Left><Left>
" Wrapped line movement (hold ctrl to move like a word processor)
nmap <C-h> h
nmap <C-j> gj
nmap <C-k> gk
nmap <C-l> l
" nmap <C-4> g$
nmap <C>$ g$
nmap <C-6> g^
nmap <C-^> g^
nmap <C-0> g^
vmap <C-h> h
vmap <C-j> gj
vmap <C-k> gk
vmap <C-l> l
vmap <C-4> g$
vmap <C>$ g$
vmap <C-6> g^
vmap <C-^> g^
vmap <C-0> g^
" " Hold ctrl to move between windows, shift to reorder the windows
" nmap <C-h> <C-w>h
" nmap <C-j> <C-w>j
" nmap <C-k> <C-w>k
" nmap <C-l> <C-w>l
" nmap <C-H> <C-w>H
" nmap <C-J> <C-w>J
" nmap <C-K> <C-w>K
" nmap <C-L> <C-w>L
" " and for visual mode
" vmap <C-h> <C-w>h
" vmap <C-j> <C-w>j
" vmap <C-k> <C-w>k
" vmap <C-l> <C-w>l
" vmap <C-H> <C-w>H
" vmap <C-J> <C-w>J
" vmap <C-K> <C-w>K
" vmap <C-L> <C-w>L
colorscheme slate
]]
vim.cmd [[
""""""" Quality of life things that aren't one line (also from stack overflow and stuff)
"Use 24-bit (true-color) mode in Vim/Neovim when outside tmux.
"If you're using tmux version 2.2 or later, you can remove the outermost $TMUX check and use tmux's 24-bit color support
"(see < http://sunaku.github.io/tmux-24bit-color.html#usage > for more information.)
if (empty($TMUX))
if (has("nvim"))
"For Neovim 0.1.3 and 0.1.4 < https://github.com/neovim/neovim/pull/2198 >
let $NVIM_TUI_ENABLE_TRUE_COLOR=1
endif
"For Neovim > 0.1.5 and Vim > patch 7.4.1799 < https://github.com/vim/vim/commit/61be73bb0f965a895bfb064ea3e55476ac175162 >
"Based on Vim patch 7.4.1770 (`guicolors` option) < https://github.com/vim/vim/commit/8a633e3427b47286869aa4b96f2bfc1fe65b25cd >
" < https://github.com/neovim/neovim/wiki/Following-HEAD#20160511 >
if (has("termguicolors"))
set termguicolors
endif
endif
]]
-- 'Visual At' plugin (https://github.com/stoeffel/.dotfiles/blob/master/vim/visual-at.vim)
vim.cmd [[
xnoremap @ :<C-u>call ExecuteMacroOverVisualRange()<CR>
function! ExecuteMacroOverVisualRange()
echo "@".getcmdline()
execute ":'<,'>normal @".nr2char(getchar())
endfunction
]]
-- Automatically jump to the last position in a file when opening
vim.cmd [[ au BufReadPost * if expand('%:p') !~# '\m/\.git/' && line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif ]]