style: format lua with StyLua

This commit is contained in:
Oliver Davies 2022-01-09 00:07:35 +00:00
parent f1171dbfc0
commit 5ff925c80c
21 changed files with 200 additions and 194 deletions

View file

@ -1,7 +1,7 @@
local M = {}
local function set_autocmd()
vim.cmd[[
vim.cmd [[
autocmd BufRead,BufNewFile *.test set filetype=php
autocmd BufWritePost plugins.lua luafile %
@ -15,7 +15,7 @@ local function set_autocmd()
end
local function set_filetypes()
vim.cmd[[
vim.cmd [[
filetype indent on
filetype on
filetype plugin on
@ -27,45 +27,40 @@ local function set_key_mappings()
local options = { noremap = true }
map('n', '<Leader>so', ':luafile ~/.config/nvim/init.lua<Cr>', options)
map("n", "<Leader>so", ":luafile ~/.config/nvim/init.lua<Cr>", options)
-- Format paragraphs to an 80 character line length.
map('n', '<Leader>g', 'gqap', options)
map('x', '<Leader>g', 'gqa', options)
map("n", "<Leader>g", "gqap", options)
map("x", "<Leader>g", "gqa", options)
-- Make the current file executable
map('n', '<Leader>x', ':!chmod +x %<Cr>', options)
map("n", "<Leader>x", ":!chmod +x %<Cr>", options)
-- Yank from the current column to the end of the line
map('n', 'Y', 'yg$', options)
map("n", "Y", "yg$", options)
-- Keep things centred
map('n', 'n', 'nzzzv', options)
map('n', 'N', 'Nzzzv', options)
map("n", "n", "nzzzv", options)
map("n", "N", "Nzzzv", options)
-- Remove arrow keys
map('v', '<down>', '<nop>', options)
map('v', '<left>', '<nop>', options)
map('v', '<right>', '<nop>', options)
map('v', '<up>', '<nop>', options)
map("v", "<down>", "<nop>", options)
map("v", "<left>", "<nop>", options)
map("v", "<right>", "<nop>", options)
map("v", "<up>", "<nop>", options)
-- Clears hlsearch after doing a search, otherwise just does normal <CR> stuff
vim.cmd[[ nnoremap <expr> <CR> {-> v:hlsearch ? ":nohl\<CR>" : "\<CR>"}() ]]
vim.cmd [[ nnoremap <expr> <CR> {-> v:hlsearch ? ":nohl\<CR>" : "\<CR>"}() ]]
map(
'n',
'<C-f>',
':silent !tmux neww tmux-sessioniser<CR>',
{ noremap = true, silent = true }
)
map("n", "<C-f>", ":silent !tmux neww tmux-sessioniser<CR>", { noremap = true, silent = true })
end
local function set_highlights()
vim.cmd[[highlight Comment cterm=italic gui=italic]]
vim.cmd [[highlight Comment cterm=italic gui=italic]]
end
local function set_vim_g()
vim.g.mapleader = ' '
vim.g.mapleader = " "
end
local function set_vim_o()
@ -76,10 +71,10 @@ local function set_vim_o()
expandtab = true,
foldlevel = 1,
foldlevelstart = 1,
foldmethod = 'indent',
formatoptions = 'lm',
foldmethod = "indent",
formatoptions = "lm",
linebreak = true,
mouse = 'n',
mouse = "n",
number = true,
pumblend = 10,
pumheight = 10,
@ -92,7 +87,7 @@ local function set_vim_o()
splitbelow = true,
splitright = true,
swapfile = false,
syntax = 'on',
syntax = "on",
tabstop = 2,
termguicolors = true,
textwidth = 0,
@ -104,7 +99,7 @@ local function set_vim_o()
vim.o[key] = value
end
vim.opt.clipboard:append 'unnamedplus'
vim.opt.clipboard:append "unnamedplus"
end
M.setup = function()