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.
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 <expr> <CR> {-> v:hlsearch ? ":nohl\<CR>" : "\<CR>"}() ]]
map("n", "<C-f>", ":silent !tmux neww tmux-sessioniser<CR>", { 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 { ",,", "<Esc>A,<Esc>" }
imap { ";;", "<Esc>A;<Esc>" }
@ -90,10 +87,10 @@ local function set_key_mappings()
xmap { "ga", "<Plug>(EasyAlign)" }
-- 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.
nmap { "<leader>=", ":wincmd =<cr>", { noremap = true, silent = true }}
nmap { "<leader>=", ":wincmd =<cr>", { noremap = true, silent = true } }
-- Move line(s) up and down.
local opts = { noremap = true, silent = true }

View file

@ -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"

View file

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

View file

@ -36,7 +36,7 @@ telescope_mapper("<leader>dl", "diagnostics")
telescope_mapper("<leader>en", "edit_neovim")
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>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
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 = {