init.lua (1801B) [raw]
1 -- init.lua ; my nvim config 2 vim.cmd [[colorscheme default]] 3 4 -- Line numbers essential for pairing 5 vim.opt.number = true 6 7 -- Persistent undo files in ~/.local/share/nvim/undo 8 vim.opt.undofile = true 9 10 -- Characters to show non-visible whitespace via `:set list` 11 vim.opt.listchars = "tab:>-,trail:~,eol:$,space:." 12 13 -- In general, softwrap at word boundaries 14 vim.opt.linebreak = true 15 16 -- Space and Tab settings for various filetypes 17 vim.cmd [[autocmd FileType markdown setlocal et sw=4 sts=4 tw=80 ]] 18 vim.cmd [[autocmd FileType python setlocal et sw=4 sts=4]] 19 vim.cmd [[autocmd FileType sql setlocal et sw=4 sts=4]] 20 vim.cmd [[autocmd FileType yaml setlocal et sw=2 sts=2]] 21 vim.cmd [[autocmd FileType javascript setlocal et sw=2 sts=2]] 22 vim.cmd [[autocmd FileType typescript setlocal et sw=2 sts=2]] 23 vim.cmd [[autocmd FileType typescriptreact setlocal et sw=2 sts=2]] 24 vim.cmd [[autocmd FileType scheme setlocal et sw=2 sts=2]] 25 vim.cmd [[autocmd FileType html setlocal et sw=2 sts=2]] 26 vim.cmd [[autocmd FileType css setlocal et sw=2 sts=2]] 27 vim.cmd [[autocmd FileType kotlin setlocal et sw=2 sts=2]] 28 vim.cmd [[autocmd BufRead,BufNewFile *.jsx set filetype=javascript]] 29 30 31 -- Switch between windows with Ctrl-h/j/k/l 32 vim.api.nvim_set_keymap("n", "<C-h>", "<C-w>h", { noremap = true }) 33 vim.api.nvim_set_keymap("n", "<C-j>", "<C-w>j", { noremap = true }) 34 vim.api.nvim_set_keymap("n", "<C-k>", "<C-w>k", { noremap = true }) 35 vim.api.nvim_set_keymap("n", "<C-l>", "<C-w>l", { noremap = true }) 36 37 -- Fast git-grepping 38 vim.cmd [[let mapleader = " "]] 39 vim.api.nvim_set_keymap("n", "<leader>G", ":Ggrep! <cword><CR>:copen<CR>", { noremap = true }) 40 41 -- Lastly, source a local config, if it exists 42 vim.cmd [[runtime! local.lua]]