From 66b491395d3e2cd9c4155e2cfc19a5adcc4663ff Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Tue, 16 Aug 2022 13:37:01 +0100 Subject: [PATCH] style(nvim): run stylua --- roles/neovim/files/lua/opdavies/options.lua | 13 +++---- roles/neovim/files/lua/opdavies/plugins.lua | 4 +-- .../files/lua/opdavies/snippets/ft/php.lua | 9 +++-- .../files/lua/opdavies/telescope/mappings.lua | 2 +- .../files/lua/opdavies/telescope/setup.lua | 34 +++++++++---------- 5 files changed, 30 insertions(+), 32 deletions(-) diff --git a/roles/neovim/files/lua/opdavies/options.lua b/roles/neovim/files/lua/opdavies/options.lua index a52e9cd..bf0ec9f 100644 --- a/roles/neovim/files/lua/opdavies/options.lua +++ b/roles/neovim/files/lua/opdavies/options.lua @@ -14,10 +14,7 @@ local function set_autocmd() ]] -- Automatically resize buffers when Vim is resized. - vim.api.nvim_create_autocmd( - "VimResized *", - { command = ":wincmd =" } - ) + vim.api.nvim_create_autocmd("VimResized *", { command = ":wincmd =" }) -- Cursorline highlighting control. -- Only have it on in the current buffer. @@ -75,13 +72,13 @@ local function set_key_mappings() vim.cmd [[ nnoremap {-> v:hlsearch ? ":nohl\" : "\"}() ]] map("n", "", ":silent !tmux neww tmux-sessioniser", { noremap = true, silent = true }) - + local keymap = require "opdavies.keymap" local imap = keymap.imap local nmap = keymap.nmap local vmap = keymap.vmap local xmap = keymap.xmap - + -- Easy insertion of a trailing ; or , from insert mode imap { ",,", "A," } imap { ";;", "A;" } @@ -90,10 +87,10 @@ local function set_key_mappings() xmap { "ga", "(EasyAlign)" } -- Focus on the current buffer. - nmap { "-", ":wincmd _:wincmd |", { noremap = true, silent = true }} + nmap { "-", ":wincmd _:wincmd |", { noremap = true, silent = true } } -- Automatically resize buffers. - nmap { "=", ":wincmd =", { noremap = true, silent = true }} + nmap { "=", ":wincmd =", { noremap = true, silent = true } } -- Move line(s) up and down. local opts = { noremap = true, silent = true } diff --git a/roles/neovim/files/lua/opdavies/plugins.lua b/roles/neovim/files/lua/opdavies/plugins.lua index 2a01d51..9dc0a2b 100644 --- a/roles/neovim/files/lua/opdavies/plugins.lua +++ b/roles/neovim/files/lua/opdavies/plugins.lua @@ -73,7 +73,7 @@ return packer.startup(function() "nvim-treesitter/nvim-treesitter", run = ":TSUpdate", } - use 'nvim-treesitter/nvim-treesitter-textobjects' + use "nvim-treesitter/nvim-treesitter-textobjects" -- Completion use { @@ -114,7 +114,7 @@ return packer.startup(function() use { "nvim-telescope/telescope-ui-select.nvim" } -- Git - use 'TimUntersberger/neogit' + use "TimUntersberger/neogit" -- Databases use "tpope/vim-dadbod" diff --git a/roles/neovim/files/lua/opdavies/snippets/ft/php.lua b/roles/neovim/files/lua/opdavies/snippets/ft/php.lua index 7475ed2..61e53cb 100644 --- a/roles/neovim/files/lua/opdavies/snippets/ft/php.lua +++ b/roles/neovim/files/lua/opdavies/snippets/ft/php.lua @@ -8,7 +8,8 @@ local t = ls.text_node local M = { - drupalclass = fmta([[ + drupalclass = fmta( + [[ <dl", "diagnostics") telescope_mapper("en", "edit_neovim") telescope_mapper("ez", "edit_zsh") -local nmap = require "opdavies.keymap".nmap +local nmap = require("opdavies.keymap").nmap nmap { "gm", telescope.extensions.git_worktree.create_git_worktree } nmap { "gw", telescope.extensions.git_worktree.git_worktrees } diff --git a/roles/neovim/files/lua/opdavies/telescope/setup.lua b/roles/neovim/files/lua/opdavies/telescope/setup.lua index ba0e126..c0abbf0 100644 --- a/roles/neovim/files/lua/opdavies/telescope/setup.lua +++ b/roles/neovim/files/lua/opdavies/telescope/setup.lua @@ -10,26 +10,24 @@ local Job = require "plenary.job" -- https://github.com/nvim-telescope/telescope.nvim/wiki/Configuration-Recipes#dont-preview-binaries local new_maker = function(filepath, bufnr, opts) filepath = vim.fn.expand(filepath) - Job - :new({ - command = "file", - args = { "--mime-type", "-b", filepath }, - on_exit = function(j) - local mime_type = vim.split(j:result()[1], "/")[1] - if mime_type == "text" then - previewers.buffer_previewer_maker(filepath, bufnr, opts) - else - vim.schedule(function() - vim.api.nvim_buf_set_lines(bufnr, 0, -1, false, { "BINARY" }) - end) - end - end, - }) - :sync() + Job:new({ + command = "file", + args = { "--mime-type", "-b", filepath }, + on_exit = function(j) + local mime_type = vim.split(j:result()[1], "/")[1] + if mime_type == "text" then + previewers.buffer_previewer_maker(filepath, bufnr, opts) + else + vim.schedule(function() + vim.api.nvim_buf_set_lines(bufnr, 0, -1, false, { "BINARY" }) + end) + end + end, + }):sync() end -local action_layout = require 'telescope.actions.layout' -local actions = require 'telescope.actions' +local action_layout = require "telescope.actions.layout" +local actions = require "telescope.actions" telescope.setup { defaults = {