Initial commit

This commit is contained in:
2022-10-06 00:44:41 -04:00
commit 6ea6401f65
38 changed files with 1346 additions and 0 deletions

27
lua/user/keymaps.lua Normal file
View File

@@ -0,0 +1,27 @@
-- Pasting with Control-V because of muscle-memory
vim.keymap.set('n', '<C-v>', '"+p')
vim.keymap.set('n', '<C-s-v>', '"+p')
vim.keymap.set('i', '<C-v>', '<C-r>*')
vim.keymap.set('i', '<C-s-v>', '<C-r>*')
vim.keymap.set('t', '<C-v>', '<C-\\><C-n>"+pi')
vim.keymap.set('t', '<C-s-v>', '<C-\\><C-n>"+pi')
-- Faster window navigation
vim.keymap.set('n', '<C-j>', '<C-w>j')
vim.keymap.set('n', '<C-k>', '<C-w>k')
vim.keymap.set('n', '<C-h>', '<C-w>h')
vim.keymap.set('n', '<C-l>', '<C-w>l')
vim.keymap.set('n', '<leader>,', ':noh<CR>', { silent = true })
vim.keymap.set('n', '<leader>v', [[<Cmd>:e ~/.config/nvim/init.lua<CR>]], { silent = true })
-- URL handling (since I disabled netrw)
-- source: https://sbulav.github.io/vim/neovim-opening-urls/
if vim.fn.has('mac') == 1 then
vim.keymap.set('', 'gx', [[<Cmd>call jobstart(['open', expand('<cfile>')], { 'detach': v:true })<CR>]], { noremap = true, silent = true })
elseif vim.fn.has("unix") == 1 then
vim.keymap.set('', 'gx', [[<Cmd>call jobstart(['xdg-open', expand('<cfile>')], { 'detach': v:true })<CR>]], { noremap = true, silent = true })
else
vim.keymap.set[''].gx = {[[<Cmd>lua print("Error: gx is not supported on this OS!")<CR>]]}
end

69
lua/user/settings.lua Normal file
View File

@@ -0,0 +1,69 @@
-- Nubmer column
vim.opt.relativenumber = true
vim.opt.number = true
vim.opt.signcolumn = 'yes' -- remove jitter
-- Wrapping / indenting
vim.opt.wrap = true
vim.opt.breakindent = true
vim.opt.tabstop = 2
vim.opt.softtabstop=2
vim.opt.shiftwidth = 2
vim.opt.expandtab = true
vim.opt.autoindent = true
vim.opt.smarttab = true
vim.opt.textwidth = 120
vim.opt.colorcolumn = '+1'
-- Search
vim.opt.ignorecase = true
vim.opt.smartcase = true
vim.opt.incsearch = true
vim.opt.hlsearch = true
-- Scrolling
vim.opt.scrolloff = 3
vim.opt.sidescrolloff = 15
vim.opt.sidescroll = 1
-- Mouse
vim.opt.mouse = 'a'
-- Window decorations
vim.opt.title = true
-- Leader
vim.g.mapleader = ' '
-- Fonts
vim.opt.guifont = 'Hack:h9.3'
-- Swap / backup / undo
vim.opt.undofile = true
-- Shell (may speed up nvim)
vim.opt.shell = '/bin/bash'
-- Rendering
vim.opt.lazyredraw = true
-- Folding
vim.opt.foldmethod = 'expr'
vim.opt.foldexpr = vim.call('nvim_treesitter#foldexpr')
-- Completion settings
-- " Set completeopt to have a better completion experience
-- " :help completeopt
-- " menuone: popup even 'hen there's only one match
-- " noinsert: Do not insert text until a selection is made
-- " noselect: Do not select, force user to select one from the menu
vim.opt.completeopt = 'menuone,noinsert,noselect'
-- Avoid showing extra messages when using completion
vim.o.shortmess = vim.o.shortmess .. 'c'
-- Python
vim.g.python3_host_prog = '/usr/bin/python3'
-- Format options
vim.cmd([[set formatoptions+=wantrqlc]])