Skip to content

Commit

Permalink
Convert nvim config to lua
Browse files Browse the repository at this point in the history
  • Loading branch information
steveno committed Nov 14, 2023
1 parent 4f954fc commit 2093a16
Show file tree
Hide file tree
Showing 5 changed files with 127 additions and 140 deletions.
7 changes: 7 additions & 0 deletions dot_config/nvim/init.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
-- Any copyright is dedicated to the Public Domain.
-- https://creativecommons.org/publicdomain/zero/1.0/

require('plugins')
require('settings')
require('autocmd')

140 changes: 0 additions & 140 deletions dot_config/nvim/init.vim

This file was deleted.

9 changes: 9 additions & 0 deletions dot_config/nvim/lua/autocmd.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
-- Any copyright is dedicated to the Public Domain.
-- https://creativecommons.org/publicdomain/zero/1.0/

-- Don't expand tabs for make files
vim.api.nvim_create_autocmd({ 'FileType' }, {
pattern = 'make',
command = 'setlocal noexpandtab',
})

39 changes: 39 additions & 0 deletions dot_config/nvim/lua/plugins.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
-- Any copyright is dedicated to the Public Domain.
-- https://creativecommons.org/publicdomain/zero/1.0/

-- Function to install lazy if it's not already installed
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
vim.fn.system({
"git",
"clone",
"--filter=blob:none",
"https://github.com/folke/lazy.nvim.git",
"--branch=stable", -- latest stable release
lazypath,
})
end
vim.opt.rtp:prepend(lazypath)

-- Make sure to set `mapleader` before lazy so your mappings are correct
vim.g.mapleader = " "

require("lazy").setup({
"bling/vim-airline",
"bhurlow/vim-parinfer",
{"yorickpeterse/vim-paper", lazy = true},
{"fatih/vim-go", cmd = "GoUpdateBinaries"},
})

------------------------------------------------------
-- Plugin settings
------------------------------------------------------

-- go
vim.cmd([[
autocmd BufWritePre *.go :call LanguageClient#textDocument_formatting_sync()
]])

vim.g.go_def_mode = "gopls"
vim.g.go_info_mode = "gopls"

72 changes: 72 additions & 0 deletions dot_config/nvim/lua/settings.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
-- Any copyright is dedicated to the Public Domain.
-- https://creativecommons.org/publicdomain/zero/1.0/

vim.opt.laststatus = 2

-- Show full tags when doing search completion
vim.opt.showfulltag = true
vim.opt.expandtab = true

-- Speed up macros
vim.opt.lazyredraw = true

-- No error noises
vim.opt.errorbells = false
vim.opt.visualbell = false

-- Try to show at least three lines and two columns of
-- context when scrolling
vim.opt.scrolloff = 3
vim.opt.sidescrolloff = 2

-- Wrap and match
vim.opt.whichwrap:append("<,>,[,]")
vim.opt.matchpairs:append("<:>")

-- Print with syntax highlighting and line numbers
vim.opt.shiftwidth = 4
vim.opt.smartindent = true

-- Turn off highlighting
vim.opt.hls = false

-- Disable line wrapping
vim.opt.wrap = false

-- Show us the command we're typing
vim.opt.showcmd = true

-- Highlight matching parens
vim.opt.showmatch = true

-- Set a dark background
vim.opt.number = true
vim.opt.numberwidth = 3

-- Allow hidden buffers
vim.opt.hidden = true

-- Create backups
vim.opt.backup = true
vim.cmd([[
try
set backupdir=$HOME/.local/share/nvim/backups/
set directory=$HOME/.local/share/nvim/backups/
catch
endtry
]])

-- color scheme
vim.cmd([[
if exists('+termguicolors')
let &t_8f = "\<Esc>[38:2;%lu;%lu;%lum"
let &t_8b = "\<Esc>[48:2;%lu;%lu;%lum"
set t_Co=256
set termguicolors
colorscheme paper
endif
]])

-- Python
vim.g.python3_host_prog = "/usr/bin/python3"

0 comments on commit 2093a16

Please sign in to comment.