style(nvim): run stylua

This commit is contained in:
Oliver Davies 2022-08-16 13:37:01 +01:00
parent 2cee68f31d
commit 66b491395d
5 changed files with 30 additions and 32 deletions

View file

@ -14,10 +14,7 @@ local function set_autocmd()
]] ]]
-- Automatically resize buffers when Vim is resized. -- Automatically resize buffers when Vim is resized.
vim.api.nvim_create_autocmd( vim.api.nvim_create_autocmd("VimResized *", { command = ":wincmd =" })
"VimResized *",
{ command = ":wincmd =" }
)
-- Cursorline highlighting control. -- Cursorline highlighting control.
-- Only have it on in the current buffer. -- Only have it on in the current buffer.
@ -75,13 +72,13 @@ local function set_key_mappings()
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 })
local keymap = require "opdavies.keymap" local keymap = require "opdavies.keymap"
local imap = keymap.imap local imap = keymap.imap
local nmap = keymap.nmap local nmap = keymap.nmap
local vmap = keymap.vmap local vmap = keymap.vmap
local xmap = keymap.xmap local xmap = keymap.xmap
-- Easy insertion of a trailing ; or , from insert mode -- Easy insertion of a trailing ; or , from insert mode
imap { ",,", "<Esc>A,<Esc>" } imap { ",,", "<Esc>A,<Esc>" }
imap { ";;", "<Esc>A;<Esc>" } imap { ";;", "<Esc>A;<Esc>" }
@ -90,10 +87,10 @@ local function set_key_mappings()
xmap { "ga", "<Plug>(EasyAlign)" } xmap { "ga", "<Plug>(EasyAlign)" }
-- Focus on the current buffer. -- Focus on the current buffer.
nmap { "<leader>-", ":wincmd _<cr>:wincmd |<cr>", { noremap = true, silent = true }} nmap { "<leader>-", ":wincmd _<cr>:wincmd |<cr>", { noremap = true, silent = true } }
-- Automatically resize buffers. -- Automatically resize buffers.
nmap { "<leader>=", ":wincmd =<cr>", { noremap = true, silent = true }} nmap { "<leader>=", ":wincmd =<cr>", { noremap = true, silent = true } }
-- Move line(s) up and down. -- Move line(s) up and down.
local opts = { noremap = true, silent = true } local opts = { noremap = true, silent = true }

View file

@ -73,7 +73,7 @@ return packer.startup(function()
"nvim-treesitter/nvim-treesitter", "nvim-treesitter/nvim-treesitter",
run = ":TSUpdate", run = ":TSUpdate",
} }
use 'nvim-treesitter/nvim-treesitter-textobjects' use "nvim-treesitter/nvim-treesitter-textobjects"
-- Completion -- Completion
use { use {
@ -114,7 +114,7 @@ return packer.startup(function()
use { "nvim-telescope/telescope-ui-select.nvim" } use { "nvim-telescope/telescope-ui-select.nvim" }
-- Git -- Git
use 'TimUntersberger/neogit' use "TimUntersberger/neogit"
-- Databases -- Databases
use "tpope/vim-dadbod" use "tpope/vim-dadbod"

View file

@ -8,7 +8,8 @@ local t = ls.text_node
local M = { local M = {
drupalclass = fmta([[ drupalclass = fmta(
[[
<<?php <<?php
declare(strict_types=1); declare(strict_types=1);
@ -22,7 +23,7 @@ local M = {
}]], }]],
{ {
f(function() f(function()
local filepath = vim.fn.expand('%:h') local filepath = vim.fn.expand "%:h"
local filepath_parts = vim.fn.split(filepath, "/") local filepath_parts = vim.fn.split(filepath, "/")
if not vim.tbl_contains(filepath_parts, "src") then if not vim.tbl_contains(filepath_parts, "src") then
@ -54,7 +55,9 @@ local M = {
return table.concat(namespace_parts, "\\") return table.concat(namespace_parts, "\\")
end), end),
f(function() return vim.fn.expand("%:t:r"); end), f(function()
return vim.fn.expand "%:t:r"
end),
i(0), i(0),
} }
), ),

View file

@ -36,7 +36,7 @@ telescope_mapper("<leader>dl", "diagnostics")
telescope_mapper("<leader>en", "edit_neovim") telescope_mapper("<leader>en", "edit_neovim")
telescope_mapper("<leader>ez", "edit_zsh") telescope_mapper("<leader>ez", "edit_zsh")
local nmap = require "opdavies.keymap".nmap local nmap = require("opdavies.keymap").nmap
nmap { "<leader>gm", telescope.extensions.git_worktree.create_git_worktree } nmap { "<leader>gm", telescope.extensions.git_worktree.create_git_worktree }
nmap { "<leader>gw", telescope.extensions.git_worktree.git_worktrees } nmap { "<leader>gw", telescope.extensions.git_worktree.git_worktrees }

View file

@ -10,26 +10,24 @@ local Job = require "plenary.job"
-- https://github.com/nvim-telescope/telescope.nvim/wiki/Configuration-Recipes#dont-preview-binaries -- https://github.com/nvim-telescope/telescope.nvim/wiki/Configuration-Recipes#dont-preview-binaries
local new_maker = function(filepath, bufnr, opts) local new_maker = function(filepath, bufnr, opts)
filepath = vim.fn.expand(filepath) filepath = vim.fn.expand(filepath)
Job Job:new({
:new({ command = "file",
command = "file", args = { "--mime-type", "-b", filepath },
args = { "--mime-type", "-b", filepath }, on_exit = function(j)
on_exit = function(j) local mime_type = vim.split(j:result()[1], "/")[1]
local mime_type = vim.split(j:result()[1], "/")[1] if mime_type == "text" then
if mime_type == "text" then previewers.buffer_previewer_maker(filepath, bufnr, opts)
previewers.buffer_previewer_maker(filepath, bufnr, opts) else
else vim.schedule(function()
vim.schedule(function() vim.api.nvim_buf_set_lines(bufnr, 0, -1, false, { "BINARY" })
vim.api.nvim_buf_set_lines(bufnr, 0, -1, false, { "BINARY" }) end)
end) end
end end,
end, }):sync()
})
:sync()
end end
local action_layout = require 'telescope.actions.layout' local action_layout = require "telescope.actions.layout"
local actions = require 'telescope.actions' local actions = require "telescope.actions"
telescope.setup { telescope.setup {
defaults = { defaults = {