From 1667293a833ce158b17c9dc2ff1b9bd7b25cdbbb Mon Sep 17 00:00:00 2001 From: Evie Litherland-Smith Date: Wed, 2 Nov 2022 16:11:38 +0000 Subject: [PATCH] Move various settings into dedicated files based on purpose --- init.lua | 45 ++++++-------------------- lua/config_filetypes/config_python.lua | 7 ++++ lua/config_plugins/config_nightfox.lua | 2 ++ lua/filetypes.lua | 1 + lua/options.lua | 15 +++++++++ lua/plugins.lua | 7 +++- lua/vimcommands.lua | 12 +++++++ 7 files changed, 52 insertions(+), 37 deletions(-) create mode 100644 lua/config_filetypes/config_python.lua create mode 100644 lua/filetypes.lua create mode 100644 lua/options.lua create mode 100644 lua/vimcommands.lua diff --git a/init.lua b/init.lua index 7285ecd9..1c2fe402 100644 --- a/init.lua +++ b/init.lua @@ -1,41 +1,14 @@ -vim.g.python3_host_prog = '~/.pyenv/versions/neovim3/bin/python' - +-- Load plugins as defined for Packer require 'plugins' + +-- Define custom keymappings require 'keymaps' + +-- Setup LSP configuration require 'config_lsp' -vim.notify = require("notify") -vim.cmd("colorscheme nightfox") -- TODO +-- Set additional vim.opt variables +require 'options' -vim.cmd("let &t_ut=''") -- For kitty background colour support -vim.opt.updatetime=500 -vim.opt.mouse="nv" -vim.opt.termguicolors=true - -vim.opt.shiftwidth=4 -vim.opt.number=true -vim.opt.relativenumber=true -vim.opt.listchars = { trail = '.', tab = '>_' } -vim.opt.list=true -vim.opt.wrap=true -vim.opt.linebreak=true -vim.opt.autoread=true - -vim.opt.expandtab=true -vim.opt.autoindent=true -vim.opt.smartindent=true - -vim.opt.splitbelow=true -vim.opt.splitright=true - --- TODO convert to lua -vim.cmd[[ -au BufRead,BufNewFile *.ipynb setlocal filetype=json -au BufRead,BufNewFile *.md setlocal spell -au BufRead,BufNewFile *.code-workspace setlocal filetype=json -au BufRead,BufNewFile *.csv setlocal nowrap -au BufRead,BufNewFile *.service[a-zA-Z0-9]* setlocal filetype=systemd -au TermOpen * setlocal nonumber norelativenumber -syntax on -filetype plugin indent on -]] +-- Remaining vim commands to be converted to lua +require 'vimcommands' diff --git a/lua/config_filetypes/config_python.lua b/lua/config_filetypes/config_python.lua new file mode 100644 index 00000000..500d361a --- /dev/null +++ b/lua/config_filetypes/config_python.lua @@ -0,0 +1,7 @@ +vim.g.python3_host_prog = '~/.pyenv/versions/neovim3/bin/python' +vim.g.python_indent = { + open_paren = 'shiftwidth()', + nested_paren = 'shiftwidth()', + continue = 'shiftwidth()', + closed_paren_align_last_line = 'v:false', +} diff --git a/lua/config_plugins/config_nightfox.lua b/lua/config_plugins/config_nightfox.lua index bb79eb60..0cda447c 100644 --- a/lua/config_plugins/config_nightfox.lua +++ b/lua/config_plugins/config_nightfox.lua @@ -1,3 +1,4 @@ +vim.opt.termguicolors=true require('nightfox').setup{ modules = { aerial = true, @@ -12,3 +13,4 @@ require('nightfox').setup{ treesitter = true, }, } +vim.cmd("colorscheme nightfox") diff --git a/lua/filetypes.lua b/lua/filetypes.lua new file mode 100644 index 00000000..49c3f857 --- /dev/null +++ b/lua/filetypes.lua @@ -0,0 +1 @@ +require 'config_filetypes.config_python' diff --git a/lua/options.lua b/lua/options.lua new file mode 100644 index 00000000..ac3a4007 --- /dev/null +++ b/lua/options.lua @@ -0,0 +1,15 @@ +vim.opt.mouse="nv" +vim.opt.shiftwidth=4 +vim.opt.number=true +vim.opt.relativenumber=true +vim.opt.listchars = {trail = '.', tab = '>_'} +vim.opt.list=true +vim.opt.wrap=true +vim.opt.linebreak=true +vim.opt.autoread=true +vim.opt.expandtab=true +vim.opt.autoindent=true +vim.opt.smartindent=true +vim.opt.splitbelow=true +vim.opt.splitright=true + diff --git a/lua/plugins.lua b/lua/plugins.lua index 45ddbe5e..bceeca15 100644 --- a/lua/plugins.lua +++ b/lua/plugins.lua @@ -7,7 +7,12 @@ vim.cmd([[ require('packer').startup(function(use) use 'wbthomason/packer.nvim' - use 'rcarriga/nvim-notify' + use { + 'rcarriga/nvim-notify', + config = function () + vim.notify = require("notify") + end + } use 'kyazdani42/nvim-web-devicons' use 'nvim-lua/plenary.nvim' use 'christoomey/vim-tmux-navigator' diff --git a/lua/vimcommands.lua b/lua/vimcommands.lua new file mode 100644 index 00000000..05437f1c --- /dev/null +++ b/lua/vimcommands.lua @@ -0,0 +1,12 @@ +-- TODO convert to lua +vim.cmd("let &t_ut=''") -- For kitty background colour support +vim.cmd[[ +au BufRead,BufNewFile *.ipynb setlocal filetype=json +au BufRead,BufNewFile *.md setlocal spell +au BufRead,BufNewFile *.code-workspace setlocal filetype=json +au BufRead,BufNewFile *.csv setlocal nowrap +au BufRead,BufNewFile *.service[a-zA-Z0-9]* setlocal filetype=systemd +au TermOpen * setlocal nonumber norelativenumber +syntax on +]] +