aboutsummaryrefslogtreecommitdiff
path: root/nvim/lua/config
diff options
context:
space:
mode:
Diffstat (limited to 'nvim/lua/config')
-rw-r--r--nvim/lua/config/keymaps.lua31
-rw-r--r--nvim/lua/config/lazy.lua26
-rw-r--r--nvim/lua/config/options.lua117
3 files changed, 174 insertions, 0 deletions
diff --git a/nvim/lua/config/keymaps.lua b/nvim/lua/config/keymaps.lua
new file mode 100644
index 0000000..073233f
--- /dev/null
+++ b/nvim/lua/config/keymaps.lua
@@ -0,0 +1,31 @@
+
+-- -- use system clipboard
+-- vim.o.clipboard = ''
+-- vim.keymap.set('n', '""y', '""y')
+-- vim.keymap.set('n', '""yy', '""yy')
+-- vim.keymap.set('n', '""p', '""p')
+-- vim.keymap.set('n', '""P', '""P')
+-- vim.keymap.set('n', 'y', function() return (vim.v.register == '"' and '"+' or '') .. 'y' end, { expr = true })
+-- vim.keymap.set('n', 'yy', function() return (vim.v.register == '"' and '"+' or '') .. 'yy' end, { expr = true })
+-- vim.keymap.set('n', 'p', function() return (vim.v.register == '"' and '"+' or '') .. 'p' end, { expr = true })
+-- vim.keymap.set('n', 'P', function() return (vim.v.register == '"' and '"+' or '') .. 'P' end, { expr = true })
+--
+-- -- copy/paste
+-- vim.keymap.set('n', '<C-x>', '"+dd')
+-- vim.keymap.set('v', '<C-x>', '"+d')
+-- vim.keymap.set('n', '<C-c>', '"+yy')
+-- vim.keymap.set('v', '<C-c>', '"+y')
+-- vim.keymap.set({'n', 'v'}, '<C-v>', '"+p')
+-- vim.keymap.set('i', '<C-v>', '<C-r>+')
+
+-- trim whitespace
+vim.keymap.set('n', '<leader>wt', [[:%s/\s\+$//e<cr>]], {desc = 'Trim whitespace'})
+
+
+
+-- toggle virtual text
+vim.keymap.set('n', '<leader>tv', function()
+ vim.diagnostic.config {virtual_text = not vim.diagnostic.config().virtual_text}
+end, {desc = 'Toggle diagnostics virtual text'})
+
+
diff --git a/nvim/lua/config/lazy.lua b/nvim/lua/config/lazy.lua
new file mode 100644
index 0000000..d604abf
--- /dev/null
+++ b/nvim/lua/config/lazy.lua
@@ -0,0 +1,26 @@
+local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
+if not (vim.uv or vim.loop).fs_stat(lazypath) then
+ local lazyrepo = "https://github.com/folke/lazy.nvim.git"
+ local out = vim.fn.system({
+ "git", "clone", "--filter=blob:none", "--branch=stable",
+ lazyrepo,
+ lazypath
+ })
+ if vim.v.shell_error ~= 0 then
+ vim.api.nvim_echo({
+ {"Failed to clone lazy.nvim:\n", "ErrorMsg"},
+ {out, "WarningMsg"},
+ {"\nPress any key to exit..."},
+ }, true, {})
+ vim.fn.getchar()
+ os.exit(1)
+ end
+end
+vim.opt.rtp:prepend(lazypath)
+
+require('lazy').setup {
+ spec = {
+ {import = 'plugins'}
+ },
+ lockfile = vim.fn.stdpath("data") .. "/lazy/lock.json"
+}
diff --git a/nvim/lua/config/options.lua b/nvim/lua/config/options.lua
new file mode 100644
index 0000000..48fcd65
--- /dev/null
+++ b/nvim/lua/config/options.lua
@@ -0,0 +1,117 @@
+-- use modern vim
+vim.o.compatible = false
+
+-- dont use backup files
+vim.o.backup = false
+vim.o.writebackup = false
+vim.o.swapfile = false
+
+-- allow unsaved buffers
+vim.o.hidden = true
+
+-- enable mouse
+vim.o.mouse = 'a'
+
+-- display tabs and trailing spaces
+vim.o.list = true
+vim.o.listchars = 'tab:»·,trail:·,nbsp:·'
+
+-- search options
+vim.o.incsearch = true
+vim.o.hlsearch = true
+
+-- backspace in insert mode
+vim.o.backspace = "indent,eol,start"
+
+-- no sound
+vim.o.visualbell = true
+
+-- set autoread
+vim.o.autoread = true
+
+-- set encoding
+vim.o.encoding = "utf-8"
+vim.o.fileencoding = "utf-8"
+
+-- show commands
+vim.o.showcmd = true
+
+-- file format
+vim.o.fileformats = "unix,dos"
+
+-- set leader
+vim.g.mapleader = " "
+vim.g.maplocalleader = "\\"
+
+-- set system clipboard
+vim.o.clipboard = 'unnamedplus'
+
+-- disable conceal
+vim.g.vim_json_conceal = 0
+vim.g.markdown_syntax_conceal = 0
+vim.o.conceallevel = 0
+vim.api.nvim_create_autocmd({"FileType"}, {
+ pattern = "json",
+ command = "set conceallevel=0"
+})
+
+-- show line numbers
+vim.o.number = true
+
+-- 80 character line length highlight
+vim.o.colorcolumn = "80"
+
+-- highlight current line
+vim.o.cursorline = true
+
+-- set tab width and use spaces for tabs
+vim.o.tabstop = 4
+vim.o.shiftwidth = 4
+vim.o.softtabstop = 4
+vim.o.expandtab = true
+
+-- disable netrw
+vim.g.loaded_netrw = 1
+vim.g.loaded_netrwPlugin = 1
+
+-- set colours
+vim.opt.termguicolors = true
+
+-- make files use regular tabs
+vim.api.nvim_create_autocmd({"FileType"}, {
+ pattern = "make",
+ command = "set tabstop=4 shiftwidth=8 softtabstop=0 noexpandtab"
+})
+
+-- reload vimrc on change
+vim.api.nvim_create_augroup("reload_vimrc", {})
+vim.api.nvim_create_autocmd({"BufWritePost"}, {
+ group = "reload_vimrc",
+ pattern = vim.env.MYVIMRC,
+ callback = function()
+ vim.cmd "source $MYVIMRC"
+ -- require('packer').sync()
+ -- require('packer').compile()
+ end
+})
+
+-- gui settings
+vim.o.linespace = 4
+-- vim.o.guifont = "monospace:h12"
+
+-- neovide settings
+if vim.g.neovide then
+ vim.g.neovide_cursor_animation_length = 0.01
+ vim.g.neovide_cursor_trail_length = 0.01
+ vim.g.neovide_cursor_vfx_mode = ""
+ vim.g.neovide_remember_window_size = true
+ vim.g.neovide_scale_factor = 1.0
+
+ vim.keymap.set('n', '<C-=>', function()
+ vim.g.neovide_scale_factor = vim.g.neovide_scale_factor * 1.1
+ end)
+
+ vim.keymap.set('n', '<C-->', function()
+ vim.g.neovide_scale_factor = vim.g.neovide_scale_factor / 1.1
+ end)
+end