refactor: combine with Ubuntu Provisioning repo
Combine with this repository with https://github.com/opdavies/ubuntu-provisioning so that everything can be managed in one place, and add a role for each piece of software.
This commit is contained in:
parent
e11cf61218
commit
8916e90050
73 changed files with 239 additions and 3783 deletions
14
roles/neovim/files/init.lua
Normal file
14
roles/neovim/files/init.lua
Normal file
|
@ -0,0 +1,14 @@
|
|||
require("opdavies.autopairs")
|
||||
require("opdavies.colours")
|
||||
require("opdavies.comment")
|
||||
require("opdavies.completion")
|
||||
require("opdavies.floaterm")
|
||||
require("opdavies.gitsigns")
|
||||
require("opdavies.indent-blankline")
|
||||
require("opdavies.lsp")
|
||||
require("opdavies.options").setup()
|
||||
require("opdavies.plugins")
|
||||
require("opdavies.seiya")
|
||||
require("opdavies.telescope")
|
||||
require("opdavies.treesitter")
|
||||
require("opdavies.vim-test")
|
16
roles/neovim/files/lua/opdavies/autopairs.lua
Normal file
16
roles/neovim/files/lua/opdavies/autopairs.lua
Normal file
|
@ -0,0 +1,16 @@
|
|||
local status_ok, autopairs = pcall(require, "nvim-autopairs")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
autopairs.setup {}
|
||||
|
||||
local cmp_status_ok, cmp_autopairs = pcall(require, "nvim-autopairs.completion.cmp")
|
||||
if not cmp_status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
local cmp = require('cmp')
|
||||
cmp.event:on('confirm_done', cmp_autopairs.on_confirm_done({
|
||||
map_char = { tex = '' }
|
||||
}))
|
13
roles/neovim/files/lua/opdavies/colours.lua
Normal file
13
roles/neovim/files/lua/opdavies/colours.lua
Normal file
|
@ -0,0 +1,13 @@
|
|||
local colorbuddy_status_ok, colorbuddy = pcall(require, "colorbuddy")
|
||||
if not colorbuddy_status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
local colorizer_status_ok, colorizer = pcall(require, "colorizer")
|
||||
if not colorizer_status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
colorbuddy.colorscheme("gruvbuddy")
|
||||
|
||||
colorizer.setup()
|
19
roles/neovim/files/lua/opdavies/comment.lua
Normal file
19
roles/neovim/files/lua/opdavies/comment.lua
Normal file
|
@ -0,0 +1,19 @@
|
|||
local status_ok, comment = pcall(require, "Comment")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
comment.setup {
|
||||
padding = true,
|
||||
|
||||
opleader = {
|
||||
line = 'gc',
|
||||
block = 'gb',
|
||||
},
|
||||
|
||||
mappings = {
|
||||
basic = true,
|
||||
extra = true,
|
||||
extended = false,
|
||||
},
|
||||
}
|
60
roles/neovim/files/lua/opdavies/completion.lua
Normal file
60
roles/neovim/files/lua/opdavies/completion.lua
Normal file
|
@ -0,0 +1,60 @@
|
|||
local cmp_status_ok, cmp = pcall(require, "cmp")
|
||||
if not cmp_status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
local snip_status_ok, luasnip = pcall(require, "luasnip")
|
||||
if not snip_status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
require("luasnip/loaders/from_vscode").lazy_load()
|
||||
|
||||
cmp.setup {
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
require('luasnip').lsp_expand(args.body)
|
||||
end
|
||||
},
|
||||
|
||||
mapping = {
|
||||
["<C-d>"] = cmp.mapping.scroll_docs(-4),
|
||||
["<C-f>"] = cmp.mapping.scroll_docs(4),
|
||||
["<C-e>"] = cmp.mapping.close(),
|
||||
["<c-y>"] = cmp.mapping.confirm {
|
||||
behavior = cmp.ConfirmBehavior.Insert,
|
||||
select = true,
|
||||
},
|
||||
},
|
||||
|
||||
sources = {
|
||||
{ name = "buffer", priority = 2, keyword_length = 5, max_item_count = 5 },
|
||||
{ name = "calc" },
|
||||
{ name = "path" },
|
||||
{ name = "spell" },
|
||||
{ name = "treesitter" },
|
||||
|
||||
-- Neovim
|
||||
{ name = "nvim_lsp", priority = 10 },
|
||||
{ name = "nvim_lua" },
|
||||
|
||||
-- Plugins
|
||||
{ name = "luasnip" },
|
||||
{ name = "cmp_tabnine" },
|
||||
},
|
||||
|
||||
formatting = {
|
||||
format = require("lspkind").cmp_format({with_text = true, menu = ({
|
||||
buffer = "[buf]",
|
||||
cmp_tabnine = "[tn]",
|
||||
luasnip = "[snip]",
|
||||
nvim_lsp = "[lsp]",
|
||||
nvim_lua = "[lua]",
|
||||
path = "[path]",
|
||||
})}),
|
||||
},
|
||||
|
||||
experimental = {
|
||||
ghost_text = true
|
||||
},
|
||||
}
|
8
roles/neovim/files/lua/opdavies/floaterm.lua
Normal file
8
roles/neovim/files/lua/opdavies/floaterm.lua
Normal file
|
@ -0,0 +1,8 @@
|
|||
local map = vim.api.nvim_set_keymap
|
||||
|
||||
local options = { noremap = true }
|
||||
|
||||
map('n', '<leader>ld', '<cmd>FloatermNew --autoclose=2 --height=0.9 --width=0.9 lazydocker<cr>', options)
|
||||
map('n', '<leader>lg', '<cmd>FloatermNew --autoclose=2 --height=0.9 --width=0.9 lazygit<cr>', options)
|
||||
map('n', '<leader>nn', '<cmd>FloatermNew --autoclose=2 --height=0.5 --width=0.5 nnn -Hde<cr>', options)
|
||||
map('n', '<leader>tt', '<cmd>FloatermNew --autoclose=2 --height=0.9 --width=0.9 zsh<cr>', options)
|
31
roles/neovim/files/lua/opdavies/gitsigns.lua
Normal file
31
roles/neovim/files/lua/opdavies/gitsigns.lua
Normal file
|
@ -0,0 +1,31 @@
|
|||
local colorbuddy_status_ok, colorbuddy = pcall(require, "colorbuddy")
|
||||
if not colorbuddy_status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
local gitsigns_status_ok, gitsigns = pcall(require, "gitsigns")
|
||||
if not gitsigns_status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
local c = require("colorbuddy.color").colors
|
||||
local Group = require("colorbuddy.group").Group
|
||||
|
||||
Group.new("GitSignsAdd", c.green)
|
||||
Group.new("GitSignsChange", c.yellow)
|
||||
Group.new("GitSignsDelete", c.red)
|
||||
|
||||
gitsigns.setup {
|
||||
linehl = false,
|
||||
numhl = true,
|
||||
|
||||
signs = {
|
||||
add = { hl = "GitSignsAdd", text = "│", numhl = "GitSignsAddNr" },
|
||||
change = { hl = "GitSignsChange", text = "│", numhl = "GitSignsChangeNr" },
|
||||
delete = { hl = "GitSignsDelete", text = "_", numhl = "GitSignsDeleteNr" },
|
||||
topdelete = { hl = "GitSignsDelete", text = "‾", numhl = "GitSignsDeleteNr" },
|
||||
changedelete = { hl = "GitSignsDelete", text = "~", numhl = "GitSignsChangeNr" },
|
||||
},
|
||||
|
||||
word_diff = false,
|
||||
}
|
18
roles/neovim/files/lua/opdavies/indent-blankline.lua
Normal file
18
roles/neovim/files/lua/opdavies/indent-blankline.lua
Normal file
|
@ -0,0 +1,18 @@
|
|||
local status_ok, indent_blankline = pcall(require, "indent_blankline")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
vim.opt.list = true
|
||||
vim.opt.listchars = {
|
||||
eol = "↴",
|
||||
}
|
||||
|
||||
vim.cmd [[highlight IndentBlanklineIndent1 guifg=#555555 gui=nocombine]]
|
||||
|
||||
indent_blankline.setup {
|
||||
char_highlight_list = {
|
||||
"IndentBlanklineIndent1",
|
||||
},
|
||||
show_end_of_line = true,
|
||||
}
|
47
roles/neovim/files/lua/opdavies/lsp/handlers.lua
Normal file
47
roles/neovim/files/lua/opdavies/lsp/handlers.lua
Normal file
|
@ -0,0 +1,47 @@
|
|||
local M = {}
|
||||
|
||||
M.setup = function()
|
||||
local config = {
|
||||
virtual_text = false,
|
||||
update_in_insert = true,
|
||||
underline = true,
|
||||
severity_sort = true,
|
||||
float = {
|
||||
focusable = false,
|
||||
style = "minimal",
|
||||
source = "always",
|
||||
header = "",
|
||||
prefix = "",
|
||||
}
|
||||
}
|
||||
|
||||
vim.diagnostic.config(config)
|
||||
end
|
||||
|
||||
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||
|
||||
local status_ok, cmp_nvim_lsp = pcall(require, "cmp_nvim_lsp")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
local function lsp_keymaps(bufnr)
|
||||
local opts = { noremap = true, silent = true }
|
||||
|
||||
local keymap = vim.api.nvim_buf_set_keymap
|
||||
|
||||
keymap(bufnr, "n", "gD", "<cmd>lua vim.lsp.buf.declaration()<CR>", opts)
|
||||
keymap(bufnr, "n", "gd", "<cmd>lua vim.lsp.buf.definition()<CR>", opts)
|
||||
keymap(bufnr, "n", "K", "<cmd>lua vim.lsp.buf.hover()<CR>", opts)
|
||||
keymap(bufnr, "n", "gi", "<cmd>lua vim.lsp.buf.implementation()<CR>", opts)
|
||||
keymap(bufnr, "n", "<C-k>", "<cmd>lua vim.lsp.buf.signature_help()<CR>", opts)
|
||||
keymap(bufnr, "n", "gr", "<cmd>lua vim.lsp.buf.references()<CR>", opts)
|
||||
end
|
||||
|
||||
M.on_attach = function(bufnr)
|
||||
lsp_keymaps(bufnr)
|
||||
end
|
||||
|
||||
M.capabilities = cmp_nvim_lsp.update_capabilities(capabilities)
|
||||
|
||||
return M
|
40
roles/neovim/files/lua/opdavies/lsp/init.lua
Normal file
40
roles/neovim/files/lua/opdavies/lsp/init.lua
Normal file
|
@ -0,0 +1,40 @@
|
|||
local status_ok, lspconfig = pcall(require, "lspconfig")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
local opts = {
|
||||
on_attach = require("opdavies.lsp.handlers").on_attach,
|
||||
capabilities = require("opdavies.lsp.handlers").capabilities,
|
||||
}
|
||||
|
||||
local servers = {
|
||||
"ansiblels",
|
||||
"bashls",
|
||||
"cssls",
|
||||
"html",
|
||||
"tsserver",
|
||||
"vuels",
|
||||
"yamlls",
|
||||
}
|
||||
|
||||
for _, lsp in ipairs(servers) do
|
||||
lspconfig[lsp].setup(opts)
|
||||
end
|
||||
|
||||
local intelephense_opts = require("opdavies.lsp.settings.intelephense")
|
||||
lspconfig.intelephense.setup {
|
||||
vim.tbl_deep_extend("force", intelephense_opts, opts)
|
||||
}
|
||||
|
||||
local sumneko_lua_opts = require("opdavies.lsp.settings.sumneko_lua")
|
||||
lspconfig.sumneko_lua.setup(
|
||||
vim.tbl_deep_extend("force", sumneko_lua_opts, opts)
|
||||
)
|
||||
|
||||
local tailwindcss_opts = require("opdavies.lsp.settings.tailwindcss")
|
||||
lspconfig.tailwindcss.setup {
|
||||
vim.tbl_deep_extend("force", tailwindcss_opts, opts)
|
||||
}
|
||||
|
||||
require("opdavies.lsp.handlers").setup()
|
13
roles/neovim/files/lua/opdavies/lsp/null-ls.lua
Normal file
13
roles/neovim/files/lua/opdavies/lsp/null-ls.lua
Normal file
|
@ -0,0 +1,13 @@
|
|||
local status_ok, null_ls = pcall(require, "null-ls")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
null_ls.setup({
|
||||
sources = {
|
||||
null_ls.builtins.formatting.prettier,
|
||||
null_ls.builtins.formatting.stylua,
|
||||
null_ls.builtins.diagnostics.eslint,
|
||||
null_ls.builtins.completion.spell,
|
||||
},
|
||||
})
|
|
@ -0,0 +1,3 @@
|
|||
return {
|
||||
filetypes = { "php", "module", "test", "inc" }
|
||||
}
|
15
roles/neovim/files/lua/opdavies/lsp/settings/sumneko_lua.lua
Normal file
15
roles/neovim/files/lua/opdavies/lsp/settings/sumneko_lua.lua
Normal file
|
@ -0,0 +1,15 @@
|
|||
return {
|
||||
settings = {
|
||||
Lua = {
|
||||
diagnostics = {
|
||||
globals = { "use", "vim" }
|
||||
},
|
||||
workspace = {
|
||||
library = {
|
||||
[vim.fn.expand("$VIMRUNTIME/lua")] = true,
|
||||
[vim.fn.stdpath("config") .. "/lua"] = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
return {
|
||||
filetypes = { "html", "html.twig", "lua" }
|
||||
}
|
119
roles/neovim/files/lua/opdavies/options.lua
Normal file
119
roles/neovim/files/lua/opdavies/options.lua
Normal file
|
@ -0,0 +1,119 @@
|
|||
local M = {}
|
||||
|
||||
local function set_autocmd()
|
||||
vim.cmd[[
|
||||
autocmd BufRead,BufNewFile *.test set filetype=php
|
||||
|
||||
autocmd BufWritePost plugins.lua luafile %
|
||||
autocmd BufWritePost plugins.lua PackerSync
|
||||
|
||||
autocmd FileType gitcommit highlight ColorColumn ctermbg=8
|
||||
autocmd FileType gitcommit setlocal colorcolumn=50,72
|
||||
autocmd FileType gitcommit setlocal spell
|
||||
autocmd FileType gitcommit setlocal textwidth=72
|
||||
]]
|
||||
end
|
||||
|
||||
local function set_filetypes()
|
||||
vim.cmd[[
|
||||
filetype indent on
|
||||
filetype on
|
||||
filetype plugin on
|
||||
]]
|
||||
end
|
||||
|
||||
local function set_key_mappings()
|
||||
local map = vim.api.nvim_set_keymap
|
||||
|
||||
local options = { noremap = true }
|
||||
|
||||
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)
|
||||
|
||||
-- Make the current file executable
|
||||
map('n', '<Leader>x', ':!chmod +x %<Cr>', options)
|
||||
|
||||
-- Yank from the current column to the end of the line
|
||||
map('n', 'Y', 'yg$', options)
|
||||
|
||||
-- Keep things centred
|
||||
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)
|
||||
|
||||
-- Clears hlsearch after doing a search, otherwise just does normal <CR> stuff
|
||||
vim.cmd[[ nnoremap <expr> <CR> {-> v:hlsearch ? ":nohl\<CR>" : "\<CR>"}() ]]
|
||||
|
||||
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]]
|
||||
end
|
||||
|
||||
local function set_vim_g()
|
||||
vim.g.mapleader = ' '
|
||||
end
|
||||
|
||||
local function set_vim_o()
|
||||
local settings = {
|
||||
autoindent = true,
|
||||
breakindent = true,
|
||||
conceallevel = 0,
|
||||
expandtab = true,
|
||||
foldlevel = 1,
|
||||
foldlevelstart = 1,
|
||||
foldmethod = 'indent',
|
||||
formatoptions = 'lm',
|
||||
linebreak = true,
|
||||
mouse = 'n',
|
||||
number = true,
|
||||
pumblend = 10,
|
||||
pumheight = 10,
|
||||
relativenumber = true,
|
||||
scrolloff = 10,
|
||||
shiftwidth = 2,
|
||||
showmode = false,
|
||||
smartindent = true,
|
||||
softtabstop = 2,
|
||||
splitbelow = true,
|
||||
splitright = true,
|
||||
swapfile = false,
|
||||
syntax = 'on',
|
||||
tabstop = 2,
|
||||
termguicolors = true,
|
||||
textwidth = 0,
|
||||
updatetime = 1000,
|
||||
wrap = true,
|
||||
}
|
||||
|
||||
for key, value in pairs(settings) do
|
||||
vim.o[key] = value
|
||||
end
|
||||
|
||||
vim.opt.clipboard:append 'unnamedplus'
|
||||
end
|
||||
|
||||
M.setup = function()
|
||||
set_vim_g()
|
||||
set_vim_o()
|
||||
set_key_mappings()
|
||||
set_autocmd()
|
||||
set_filetypes()
|
||||
set_highlights()
|
||||
end
|
||||
|
||||
return M
|
84
roles/neovim/files/lua/opdavies/plugins.lua
Normal file
84
roles/neovim/files/lua/opdavies/plugins.lua
Normal file
|
@ -0,0 +1,84 @@
|
|||
local status_ok, packer = pcall(require, "packer")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
packer.init {
|
||||
display = {
|
||||
open_fn = function()
|
||||
return require'packer.util'.float {}
|
||||
end,
|
||||
},
|
||||
}
|
||||
|
||||
return packer.startup(function()
|
||||
use 'wbthomason/packer.nvim'
|
||||
|
||||
-- Utilities
|
||||
use 'cakebaker/scss-syntax.vim'
|
||||
use 'christoomey/vim-sort-motion'
|
||||
use 'christoomey/vim-tmux-navigator'
|
||||
use 'editorconfig/editorconfig-vim'
|
||||
use 'icatalina/vim-case-change'
|
||||
use 'kyazdani42/nvim-web-devicons'
|
||||
use 'lewis6991/gitsigns.nvim'
|
||||
use 'lukas-reineke/indent-blankline.nvim'
|
||||
use 'machakann/vim-highlightedyank'
|
||||
use 'miyakogi/seiya.vim'
|
||||
use 'norcalli/nvim-colorizer.lua'
|
||||
use 'numToStr/Comment.nvim'
|
||||
use 'nvim-lua/plenary.nvim'
|
||||
use 'nvim-lua/popup.nvim'
|
||||
use 'sheerun/vim-polyglot'
|
||||
use 'tpope/vim-surround'
|
||||
use 'vim-test/vim-test'
|
||||
use 'voldikss/vim-floaterm'
|
||||
use 'windwp/nvim-autopairs'
|
||||
use { 'mg979/vim-visual-multi', branch = 'master' }
|
||||
|
||||
-- Themes
|
||||
use {
|
||||
'tjdevries/gruvbuddy.nvim',
|
||||
requires = {
|
||||
'tjdevries/colorbuddy.vim'
|
||||
},
|
||||
}
|
||||
|
||||
-- Navigation
|
||||
use 'ThePrimeagen/harpoon'
|
||||
|
||||
-- Treesitter
|
||||
use {
|
||||
'nvim-treesitter/nvim-treesitter',
|
||||
run = ':TSUpdate',
|
||||
}
|
||||
|
||||
-- Completion
|
||||
use {
|
||||
'hrsh7th/nvim-cmp',
|
||||
requires = {
|
||||
'L3MON4D3/LuaSnip',
|
||||
'hrsh7th/cmp-buffer',
|
||||
'hrsh7th/cmp-nvim-lsp',
|
||||
'hrsh7th/cmp-path',
|
||||
'onsails/lspkind-nvim',
|
||||
'saadparwaiz1/cmp_luasnip',
|
||||
{
|
||||
'tzachar/cmp-tabnine',
|
||||
run = './install.sh'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
-- Snippets
|
||||
use 'L3MON4D3/LuaSnip'
|
||||
use 'rafamadriz/friendly-snippets'
|
||||
|
||||
-- LSP
|
||||
use 'neovim/nvim-lspconfig'
|
||||
use 'jose-elias-alvarez/null-ls.nvim'
|
||||
|
||||
-- Telescope
|
||||
use 'nvim-telescope/telescope.nvim'
|
||||
use { 'nvim-telescope/telescope-fzf-native.nvim', run = 'make' }
|
||||
end)
|
3
roles/neovim/files/lua/opdavies/seiya.lua
Normal file
3
roles/neovim/files/lua/opdavies/seiya.lua
Normal file
|
@ -0,0 +1,3 @@
|
|||
vim.g.seiya_auto_enable = 1
|
||||
|
||||
vim.g.seiya_target_groups = { 'guibg' }
|
58
roles/neovim/files/lua/opdavies/telescope/init.lua
Normal file
58
roles/neovim/files/lua/opdavies/telescope/init.lua
Normal file
|
@ -0,0 +1,58 @@
|
|||
local status_ok, telescope = pcall(require, "telescope")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
local previewers = require('telescope.previewers')
|
||||
local Job = require('plenary.job')
|
||||
|
||||
-- Create a new maker that won't preview binary files
|
||||
-- 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()
|
||||
end
|
||||
|
||||
telescope.setup{
|
||||
defaults = {
|
||||
buffer_previewer_maker = new_maker,
|
||||
prompt_prefix = "$ "
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
telescope.load_extension("fzf")
|
||||
local map = vim.api.nvim_set_keymap
|
||||
|
||||
local options = {
|
||||
noremap = true,
|
||||
silent = true,
|
||||
}
|
||||
|
||||
-- Builtin
|
||||
map('n', '<leader>fb', '<CMD>lua require("telescope.builtin").buffers()<CR>', options)
|
||||
map('n', '<leader>fc', '<CMD>lua require("telescope.builtin").lsp_code_actions()<CR>', options)
|
||||
map('n', '<leader>fd', '<CMD>lua require("telescope.builtin").lsp_workspace_diagnostics()<CR>', options)
|
||||
map('n', '<leader>fe', '<CMD>lua require("telescope.builtin").file_browser{ cwd = vim.fn.expand("%:p:h") }<CR>', options)
|
||||
map('n', '<leader>fg', '<CMD>lua require("telescope.builtin").git_files{}<CR>', options)
|
||||
map('n', '<leader>fh', '<CMD>lua require("telescope.builtin").help_tags()<CR>', options)
|
||||
map('n', '<leader>fl', '<CMD>lua require("telescope.builtin").live_grep()<CR>', options)
|
||||
map('n', '<leader>fr', '<CMD>lua require("telescope.builtin").registers()<CR>', options)
|
||||
map('n', '<leader>fr', '<CMD>lua require("telescope.builtin").registers()<CR>', options)
|
||||
|
||||
-- Custom
|
||||
map("n", "<Leader>en", '<CMD>lua require("opdavies.telescope.mappings").edit_neovim()<Cr>', options)
|
||||
map("n", "<Leader>ff", '<CMD>lua require("opdavies.telescope.mappings").fd()<Cr>', options)
|
33
roles/neovim/files/lua/opdavies/telescope/mappings.lua
Normal file
33
roles/neovim/files/lua/opdavies/telescope/mappings.lua
Normal file
|
@ -0,0 +1,33 @@
|
|||
local M = {}
|
||||
|
||||
function M.edit_neovim()
|
||||
local opts = {
|
||||
prompt_title = "~ dotfiles ~",
|
||||
shorten_path = false,
|
||||
cwd = "~/.config/nvim",
|
||||
|
||||
layout_strategy = "flex",
|
||||
layout_config = {
|
||||
height = 0.8,
|
||||
prompt_position = "top",
|
||||
width = 0.9,
|
||||
|
||||
horizontal = {
|
||||
width = { padding = 0.15 },
|
||||
},
|
||||
vertical = {
|
||||
preview_height = 0.75,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
require("telescope.builtin").find_files(opts)
|
||||
end
|
||||
|
||||
function M.fd()
|
||||
local themes = require "telescope.themes"
|
||||
|
||||
require("telescope.builtin").find_files(themes.get_ivy())
|
||||
end
|
||||
|
||||
return M
|
18
roles/neovim/files/lua/opdavies/treesitter.lua
Normal file
18
roles/neovim/files/lua/opdavies/treesitter.lua
Normal file
|
@ -0,0 +1,18 @@
|
|||
local status_ok, configs = pcall(require, "nvim-treesitter.configs")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
configs.setup {
|
||||
context_commenting = {
|
||||
enable = true
|
||||
},
|
||||
ensure_installed = "maintained",
|
||||
highlight = {
|
||||
enable = true,
|
||||
},
|
||||
indent = {
|
||||
disable = { "yaml" },
|
||||
enable = true,
|
||||
}
|
||||
}
|
13
roles/neovim/files/lua/opdavies/vim-test.lua
Normal file
13
roles/neovim/files/lua/opdavies/vim-test.lua
Normal file
|
@ -0,0 +1,13 @@
|
|||
local map = vim.api.nvim_set_keymap
|
||||
|
||||
local options = {
|
||||
silent = true
|
||||
}
|
||||
|
||||
map('n', 't<C-f>', ':TestFile<CR>', options)
|
||||
map('n', 't<C-g>', ':TestVisit<CR>', options)
|
||||
map('n', 't<C-l>', ':TestLast<CR>', options)
|
||||
map('n', 't<C-n>', ':TestNearest<CR>', options)
|
||||
map('n', 't<C-s>', ':TestSuite<CR>', options)
|
||||
|
||||
vim.g['test#strategy'] = "neovim"
|
Loading…
Add table
Add a link
Reference in a new issue