nvim: all settings are now in lua! (at least the ones that could be converted)
This commit is contained in:
parent
ff5310c1f6
commit
33ec6e6da7
1 changed files with 112 additions and 108 deletions
|
@ -1,111 +1,112 @@
|
||||||
-- TODO: translate this to lua
|
-- TODO: translat e this to lua
|
||||||
|
local set = vim.o
|
||||||
|
|
||||||
|
-- Settings
|
||||||
|
local tabsize = 3
|
||||||
|
set.tabstop = tabsize
|
||||||
|
set.softtabstop = tabsize
|
||||||
|
set.shiftwidth = tabsize
|
||||||
|
set.suffixes = '.bak,~,.o,.h,.info,.swp,.obj,.aux,.bbl,.blg,.brf,.cb,.dvi,.idx,.ilg,.ind,.inx,.jpg,.log,.out,.png,.toc'
|
||||||
|
set.expandtab = true
|
||||||
|
set.smartindent = true
|
||||||
|
set.undofile = true
|
||||||
|
set.swapfile = true
|
||||||
|
set.hlsearch = true
|
||||||
|
set.hidden = true
|
||||||
|
set.backspace = 'indent,eol,start'
|
||||||
|
set.ignorecase = true
|
||||||
|
set.smartcase = true
|
||||||
|
set.wrap = false
|
||||||
|
set.linebreak = true
|
||||||
|
set.syntax = 'on'
|
||||||
|
set.redrawtime = 200
|
||||||
|
set.updatetime = 300
|
||||||
|
set.number = true --relativenumber
|
||||||
|
set.errorbells = false
|
||||||
|
set.encoding = 'UTF-8'
|
||||||
|
set.cursorline = true
|
||||||
|
set.mouse = 'a'
|
||||||
|
set.incsearch = true
|
||||||
|
set.scrolloff = 5
|
||||||
|
--set.wildmenu
|
||||||
|
--set.wildmode = full
|
||||||
|
set.hidden = true
|
||||||
|
set.shortmess = 'filnxtToOFc'
|
||||||
|
--set.spell = true
|
||||||
|
set.spelllang = 'en_us'
|
||||||
|
set.showcmd = true
|
||||||
|
set.signcolumn = 'auto'
|
||||||
|
|
||||||
|
-- Things that can't be translated to lua
|
||||||
|
vim.cmd 'syntax on'
|
||||||
|
vim.cmd "let g:markdown_fenced_languages = ['bash=sh', 'javascript', 'cpp=cpp', 'c++=cpp', 'js=javascript', 'json=javascript', 'typescript', 'ts=typescript', 'php', 'html', 'css']"
|
||||||
|
|
||||||
|
--- autocmd's
|
||||||
|
-- Spell check in git commits by default
|
||||||
|
vim.cmd 'autocmd Filetype gitcommit setlocal spell'
|
||||||
|
|
||||||
|
-- Disable spell check in help files
|
||||||
|
vim.cmd 'autocmd FileType help setlocal nospell'
|
||||||
|
vim.cmd 'filetype plugin on'
|
||||||
|
|
||||||
|
-- Automatically disable line numbers when in terminal mode
|
||||||
|
vim.cmd 'autocmd TermOpen * setlocal nospell nonumber norelativenumber'
|
||||||
|
|
||||||
|
-- Automatically toggle relative line numbers
|
||||||
|
--vim.cmd 'autocmd InsertEnter * :set norelativenumber '
|
||||||
|
--vim.cmd 'autocmd InsertLeave * :set relativenumber '
|
||||||
|
|
||||||
|
--- Key bindings
|
||||||
|
vim.cmd 'let mapleader = " "'
|
||||||
|
|
||||||
|
-- *sigh*...
|
||||||
vim.cmd [[
|
vim.cmd [[
|
||||||
""" Settings
|
command! Q q
|
||||||
set suffixes+=.aux,.bbl,.blg,.brf,.cb,.dvi,.idx,.ilg,.ind,.inx,.jpg,.log,.out,.png,.toc
|
command! W w
|
||||||
set suffixes-=.h
|
command! Wq wq
|
||||||
set suffixes-=.obj
|
command! WQ wq
|
||||||
set tabstop=3 softtabstop=3
|
command! Wa wa
|
||||||
set shiftwidth=3
|
command! WA wa
|
||||||
set expandtab
|
command! Qa qa
|
||||||
set smartindent
|
command! QA qa
|
||||||
"set foldmethod=indent
|
command! Wqa wqa
|
||||||
"set foldlevel=0
|
command! WQa wqa
|
||||||
set undofile
|
command! WQA wqa
|
||||||
set swapfile
|
|
||||||
set hlsearch
|
|
||||||
set hidden
|
|
||||||
set ignorecase
|
|
||||||
set smartcase
|
|
||||||
set nowrap
|
|
||||||
set linebreak
|
|
||||||
"set guicursor= " always use the block cursor
|
|
||||||
syntax enable
|
|
||||||
set syntax=on
|
|
||||||
" max syntax highlight time in ms
|
|
||||||
set redrawtime=200
|
|
||||||
set updatetime=300
|
|
||||||
set number "relativenumber
|
|
||||||
" Automatically toggle relative line numbers
|
|
||||||
"autocmd InsertEnter * :set norelativenumber
|
|
||||||
"autocmd InsertLeave * :set relativenumber
|
|
||||||
set noerrorbells
|
|
||||||
set encoding=UTF-8
|
|
||||||
set cursorline
|
|
||||||
set mouse=a
|
|
||||||
set incsearch
|
|
||||||
set scrolloff=5
|
|
||||||
"set wildmenu
|
|
||||||
"set wildmode=full
|
|
||||||
" TextEdit might fail if hidden is not set.
|
|
||||||
set hidden
|
|
||||||
set cmdheight=1 " Give more space for displaying messages.
|
|
||||||
" Don't pass messages to |ins-completion-menu|.
|
|
||||||
set shortmess+=c
|
|
||||||
" Spell check!
|
|
||||||
set spelllang=en_us
|
|
||||||
" spell check in git commits
|
|
||||||
autocmd Filetype gitcommit setlocal spell
|
|
||||||
set showcmd
|
|
||||||
set signcolumn=yes
|
|
||||||
|
|
||||||
""" autocmd's
|
|
||||||
" Disable spell check in help files
|
|
||||||
autocmd FileType help setlocal nospell
|
|
||||||
filetype plugin on
|
|
||||||
" Automatically disable line numbers when in terminal mode
|
|
||||||
autocmd TermOpen * setlocal nospell nonumber norelativenumber
|
|
||||||
|
|
||||||
""" Key bindings
|
|
||||||
let mapleader = " "
|
|
||||||
|
|
||||||
" *sigh*...
|
|
||||||
command! Q q
|
|
||||||
command! W w
|
|
||||||
command! Wq wq
|
|
||||||
command! WQ wq
|
|
||||||
command! Wa wa
|
|
||||||
command! WA wa
|
|
||||||
command! Qa qa
|
|
||||||
command! QA qa
|
|
||||||
command! Wqa wqa
|
|
||||||
command! WQa wqa
|
|
||||||
command! WQA wqa
|
|
||||||
|
|
||||||
" Macro for opening a new terminal
|
|
||||||
command! Term tabnew | term
|
|
||||||
|
|
||||||
" Press Alt h to toggle highlighting on/off, and show current value.
|
|
||||||
nnoremap <M-h> <cmd>noh<CR>
|
|
||||||
|
|
||||||
" Toggle spell check with alt S
|
|
||||||
nnoremap <M-S> <cmd>set spell! spell?<CR>
|
|
||||||
|
|
||||||
" find + replace with alt S
|
|
||||||
nnoremap <M-s> :%s//g<Left><Left>
|
|
||||||
|
|
||||||
" Escape to enter normal mode in the terminal
|
|
||||||
tnoremap <Esc> <C-\><C-n>
|
|
||||||
|
|
||||||
nnoremap <silent> <Leader>= :exe "resize " . (winheight(0) * 3/2)<CR>
|
|
||||||
nnoremap <silent> <Leader>+ :exe "resize " . (winheight(0) * 3/2)<CR>
|
|
||||||
nnoremap <silent> <Leader>- :exe "resize " . (winheight(0) * 2/3)<CR>
|
|
||||||
|
|
||||||
" Switch panes with ctrl hjkl
|
|
||||||
nnoremap <C-h> <C-w>h
|
|
||||||
nnoremap <C-j> <C-w>j
|
|
||||||
nnoremap <C-k> <C-w>k
|
|
||||||
nnoremap <C-l> <C-w>l
|
|
||||||
|
|
||||||
" Move lines around in visual mode with J and K
|
|
||||||
vnoremap J :m '>+1<CR>gv=gv
|
|
||||||
vnoremap K :m '<-2<CR>gv=gv
|
|
||||||
|
|
||||||
" Format text with Q, rather than gw
|
|
||||||
nnoremap Q gw
|
|
||||||
|
|
||||||
colorscheme slate
|
|
||||||
]]
|
]]
|
||||||
|
|
||||||
|
-- Macro for opening a new terminal
|
||||||
|
vim.cmd 'command! Term tabnew | term'
|
||||||
|
|
||||||
|
-- Press Alt h to toggle highlighting on/off, and show current value.
|
||||||
|
vim.cmd 'nnoremap <M-h> <cmd>noh<CR>'
|
||||||
|
|
||||||
|
-- Toggle spell check with alt S
|
||||||
|
vim.cmd 'nnoremap <M-S> <cmd>set spell! spell?<CR>'
|
||||||
|
|
||||||
|
-- find + replace with alt S
|
||||||
|
vim.cmd 'nnoremap <M-s> :%s//g<Left><Left>'
|
||||||
|
|
||||||
|
-- Escape to enter normal mode in the terminal
|
||||||
|
vim.cmd 'tnoremap <C-\\> <C-\\><C-n>'
|
||||||
|
|
||||||
|
vim.cmd 'nnoremap <silent> <Leader>= :exe "resize " . (winheight(0) * 3/2)<CR>'
|
||||||
|
vim.cmd 'nnoremap <silent> <Leader>+ :exe "resize " . (winheight(0) * 3/2)<CR>'
|
||||||
|
vim.cmd 'nnoremap <silent> <Leader>- :exe "resize " . (winheight(0) * 2/3)<CR>'
|
||||||
|
|
||||||
|
-- Switch panes with ctrl hjkl
|
||||||
|
vim.cmd 'nnoremap <C-h> <C-w>h'
|
||||||
|
vim.cmd 'nnoremap <C-j> <C-w>j'
|
||||||
|
vim.cmd 'nnoremap <C-k> <C-w>k'
|
||||||
|
vim.cmd 'nnoremap <C-l> <C-w>l'
|
||||||
|
|
||||||
|
-- Move lines around in visual mode with J and K
|
||||||
|
vim.cmd "vnoremap J :m '>+1<CR>gv=gv"
|
||||||
|
vim.cmd "vnoremap K :m '<-2<CR>gv=gv"
|
||||||
|
|
||||||
|
-- Format text with Q, rather than gw
|
||||||
|
vim.cmd 'nnoremap Q gw'
|
||||||
|
vim.cmd 'colorscheme slate'
|
||||||
|
|
||||||
-- 24-bit color
|
-- 24-bit color
|
||||||
vim.cmd [[
|
vim.cmd [[
|
||||||
"Use 24-bit (true-color) mode in Vim/Neovim when outside tmux.
|
"Use 24-bit (true-color) mode in Vim/Neovim when outside tmux.
|
||||||
|
@ -120,7 +121,7 @@ vim.cmd [[
|
||||||
"Based on Vim patch 7.4.1770 (`guicolors` option) < https://github.com/vim/vim/commit/8a633e3427b47286869aa4b96f2bfc1fe65b25cd >
|
"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 >
|
" < https://github.com/neovim/neovim/wiki/Following-HEAD#20160511 >
|
||||||
if (has("termguicolors"))
|
if (has("termguicolors"))
|
||||||
"set termguicolors
|
set termguicolors
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
]]
|
]]
|
||||||
|
@ -143,8 +144,8 @@ vim.cmd [[
|
||||||
]]
|
]]
|
||||||
|
|
||||||
-- 'Visual At' plugin (https://github.com/stoeffel/.dotfiles/blob/master/vim/visual-at.vim)
|
-- 'Visual At' plugin (https://github.com/stoeffel/.dotfiles/blob/master/vim/visual-at.vim)
|
||||||
-- basically, record a macro, select some lines, then run it, and the macro
|
-- Basically, record a macro that effects one line, select some lines, then run
|
||||||
-- will be executed on all visual selected lines individually
|
-- it, and the macro will be executed on all visual selected lines individually
|
||||||
vim.cmd [[
|
vim.cmd [[
|
||||||
xnoremap @ :<C-u>call ExecuteMacroOverVisualRange()<CR>
|
xnoremap @ :<C-u>call ExecuteMacroOverVisualRange()<CR>
|
||||||
function! ExecuteMacroOverVisualRange()
|
function! ExecuteMacroOverVisualRange()
|
||||||
|
@ -156,6 +157,9 @@ vim.cmd [[
|
||||||
-- Automatically jump to the last position in a file when opening
|
-- 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 ]]
|
vim.cmd [[ au BufReadPost * if expand('%:p') !~# '\m/\.git/' && line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif ]]
|
||||||
|
|
||||||
|
-- Highlight trailing whitespace in red
|
||||||
|
set.listchars = "eol:↵,trail:~,tab:>-,nbsp:␣"
|
||||||
|
|
||||||
-- Highlight trailing whitespace in red
|
-- Highlight trailing whitespace in red
|
||||||
vim.cmd [[
|
vim.cmd [[
|
||||||
highlight ExtraWhitespace ctermbg=red guibg=red
|
highlight ExtraWhitespace ctermbg=red guibg=red
|
||||||
|
|
Loading…
Add table
Reference in a new issue