dotfiles

$HOME is where the <3 is
git clone git://git.alexkarle.com/dotfiles.git
Log | Files | Refs | README | LICENSE

commit 97faf55d75674c5a51777d2b433e601e07845bb7 (patch)
parent 9f4e689bb67a90ec7f1344faec7ccf99cdf9c40f
Author: Alex Karle <alex@alexkarle.com>
Date:   Sun, 27 Feb 2022 11:32:54 -0500

nvim: Add space/tab/wrap settings for common filetypes

Unlike my previoius vim config, which was 4-spaces by default, I'm
piloting "TAB as TAB" by default, unless I'm in one of the filetypes I
usually work in (all of which use spaces).

With this, I like using linebreak and showing space via listchars (super
helpful with python!)

Diffstat:
M.config/nvim/init.lua | 12++++++++++++
1 file changed, 12 insertions(+), 0 deletions(-)

diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua @@ -4,6 +4,18 @@ vim.cmd [[colorscheme acme]] -- Persistent undo files in ~/.local/share/nvim/undo vim.opt.undofile = true +-- Characters to show non-visible whitespace via `:set list` +vim.opt.listchars = "tab:>-,trail:~,eol:$,space:." + +-- In general, softwrap at word boundaries +vim.opt.linebreak = true + +-- Space and Tab settings for various filetypes +vim.cmd [[autocmd FileType markdown setlocal et sw=4 sts=4 tw=80 ]] +vim.cmd [[autocmd FileType python setlocal et sw=4 sts=4]] +vim.cmd [[autocmd FileType javascript setlocal et sw=2 sts=2]] +vim.cmd [[autocmd FileType typescriptreact setlocal et sw=2 sts=2]] + -- Switch between windows with Ctrl-h/j/k/l vim.api.nvim_set_keymap("n", "<C-h>", "<C-w>h", { noremap = true }) vim.api.nvim_set_keymap("n", "<C-j>", "<C-w>j", { noremap = true })