Vim config CI #2
|
@ -18,6 +18,22 @@ jobs:
|
||||||
run: make bootstrap
|
run: make bootstrap
|
||||||
env:
|
env:
|
||||||
DOTFILES_CI: 1
|
DOTFILES_CI: 1
|
||||||
|
- name: Install neovim
|
||||||
|
uses: rhysd/action-setup-vim@v1
|
||||||
|
with:
|
||||||
|
neovim: true
|
||||||
|
- name: Install packer
|
||||||
|
if: ${{ matrix.platform != 'windows-latest' }}
|
||||||
|
run: |
|
||||||
|
git clone https://github.com/wbthomason/packer.nvim ~/.local/share/nvim/site/pack/packer/start/packer.nvim
|
||||||
|
- name: Install packer on Windows
|
||||||
|
if: ${{ matrix.platform == 'windows-latest' }}
|
||||||
|
run: |
|
||||||
|
git clone https://github.com/wbthomason/packer.nvim "$env:LOCALAPPDATA\nvim-data\site\pack\packer\start\packer.nvim"
|
||||||
|
- name: Run neovim checks
|
||||||
|
run: make check_neovim
|
||||||
|
env:
|
||||||
|
DOTFILES_CI: 1
|
||||||
create-key:
|
create-key:
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
|
@ -29,3 +45,12 @@ jobs:
|
||||||
run: echo "test\n\n" | make create_personal_ssh_github_key
|
run: echo "test\n\n" | make create_personal_ssh_github_key
|
||||||
env:
|
env:
|
||||||
DOTFILES_CI: 1
|
DOTFILES_CI: 1
|
||||||
|
stylua:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: Run stylua
|
||||||
|
uses: JohnnyMorganz/stylua-action@1.0.0
|
||||||
|
with:
|
||||||
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
args: --check .
|
||||||
|
|
|
@ -0,0 +1,31 @@
|
||||||
|
name: Neovim Nightly compatibility test
|
||||||
|
on:
|
||||||
|
schedule:
|
||||||
|
- cron: '0 12 * * *'
|
||||||
|
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
bootstrap-and-check-nightly:
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
platform: [ubuntu-latest, macos-latest, windows-latest]
|
||||||
|
runs-on: ${{ matrix.platform }}
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: Run bootstrap
|
||||||
|
run: make bootstrap
|
||||||
|
env:
|
||||||
|
DOTFILES_CI: 1
|
||||||
|
- name: Install neovim
|
||||||
|
uses: rhysd/action-setup-vim@v1
|
||||||
|
with:
|
||||||
|
neovim: true
|
||||||
|
version: nightly
|
||||||
|
- name: Install packer
|
||||||
|
run: git clone https://github.com/wbthomason/packer.nvim $HOME/.local/share/nvim/site/pack/packer/start/packer.nvim
|
||||||
|
- name: Run neovim checks
|
||||||
|
run: make check_neovim
|
||||||
|
env:
|
||||||
|
DOTFILES_CI: 1
|
12
Makefile
12
Makefile
|
@ -262,8 +262,8 @@ install_brew_basics: homebrew check_os
|
||||||
.PHONY: install_asdf
|
.PHONY: install_asdf
|
||||||
install_asdf: check_os
|
install_asdf: check_os
|
||||||
@echo "Installing ASDF VM..."
|
@echo "Installing ASDF VM..."
|
||||||
@git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.8.0
|
@git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.10.0
|
||||||
@echo "Installed ASDF Version 0.8.0"
|
@echo "Installed ASDF Version 0.10.0"
|
||||||
@echo "To install latest version:"
|
@echo "To install latest version:"
|
||||||
@echo ""
|
@echo ""
|
||||||
@echo "cd ~/.asdf"
|
@echo "cd ~/.asdf"
|
||||||
|
@ -312,6 +312,14 @@ install_vim: check_os link_vim
|
||||||
@echo "For NeoVim: :PackerInstall"
|
@echo "For NeoVim: :PackerInstall"
|
||||||
@echo "For Vim: :PlugInstall"
|
@echo "For Vim: :PlugInstall"
|
||||||
|
|
||||||
|
.PHONY: check_neovim
|
||||||
|
check_neovim: check_os
|
||||||
|
@echo "This expects that packer is already installed"
|
||||||
|
@echo "Installing packer packages"
|
||||||
|
@nvim --headless -c 'autocmd User PackerComplete quitall' -c 'PackerInstall'
|
||||||
|
@echo "Doing a basic neovim startup and quit"
|
||||||
|
@nvim --headless -c 'quitall'
|
||||||
|
|
||||||
.PHONY: oh_my_zsh
|
.PHONY: oh_my_zsh
|
||||||
oh_my_zsh: check_os
|
oh_my_zsh: check_os
|
||||||
@echo "Installing oh-my-zsh..."
|
@echo "Installing oh-my-zsh..."
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
if require("init.first_load")() then
|
if require("init.first_load")() then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Allow `require('impatient')` to fail, in case plugins are not yet installed
|
-- Allow `require('impatient')` to fail, in case plugins are not yet installed
|
||||||
_ = pcall(require, "impatient")
|
_ = pcall(require, "impatient")
|
||||||
|
|
||||||
vim.cmd [[filetype plugin indent on]]
|
vim.cmd([[filetype plugin indent on]])
|
||||||
|
|
||||||
vim.api.nvim_exec('let $OVIMHOME = $HOME."/.vim"', false)
|
vim.api.nvim_exec('let $OVIMHOME = $HOME."/.vim"', false)
|
||||||
vim.api.nvim_exec('let $VIMHOME = $HOME."/.config/nvim"', false)
|
vim.api.nvim_exec('let $VIMHOME = $HOME."/.config/nvim"', false)
|
||||||
|
@ -25,7 +25,7 @@ require("lsp")
|
||||||
vim.cmd("syntax on")
|
vim.cmd("syntax on")
|
||||||
require("init.colors")
|
require("init.colors")
|
||||||
|
|
||||||
vim.keymap.set("n", "Q", "gq", {noremap = false})
|
vim.keymap.set("n", "Q", "gq", { noremap = false })
|
||||||
vim.keymap.set("i", "<C-U>", "<C-G>u<C-U>")
|
vim.keymap.set("i", "<C-U>", "<C-G>u<C-U>")
|
||||||
|
|
||||||
vim.cmd("command! Wq :wq")
|
vim.cmd("command! Wq :wq")
|
||||||
|
|
|
@ -6,14 +6,14 @@ local M = {}
|
||||||
|
|
||||||
-- Gets project root directory based on projectionist
|
-- Gets project root directory based on projectionist
|
||||||
function M.get_project_root()
|
function M.get_project_root()
|
||||||
return vim.fn['projectionist#path']()
|
return vim.fn["projectionist#path"]()
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Get unique project ID based on git repository
|
-- Get unique project ID based on git repository
|
||||||
function M.get_project_id()
|
function M.get_project_id()
|
||||||
local remote_url = vim.fn['fugitive#RemoteUrl']()
|
local remote_url = vim.fn["fugitive#RemoteUrl"]()
|
||||||
remote_url = remote_url:gsub("/", ":")
|
remote_url = remote_url:gsub("/", ":")
|
||||||
return remote_url
|
return remote_url
|
||||||
end
|
end
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
|
|
@ -4,32 +4,32 @@
|
||||||
local M = {}
|
local M = {}
|
||||||
|
|
||||||
function M.get_local_vimrc()
|
function M.get_local_vimrc()
|
||||||
local extra_vimrc_location = vim.env.DIRENV_EXTRA_VIMRC
|
local extra_vimrc_location = vim.env.DIRENV_EXTRA_VIMRC
|
||||||
|
|
||||||
return extra_vimrc_location
|
return extra_vimrc_location
|
||||||
end
|
end
|
||||||
|
|
||||||
function M.open_local_vimrc()
|
function M.open_local_vimrc()
|
||||||
local local_vimrc = M.get_local_vimrc()
|
local local_vimrc = M.get_local_vimrc()
|
||||||
|
|
||||||
if local_vimrc == nil then
|
if local_vimrc == nil then
|
||||||
local_vimrc = vim.fn.input("Local vimrc filename: ", ".vimrc")
|
local_vimrc = vim.fn.input("Local vimrc filename: ", ".vimrc")
|
||||||
local save = vim.fn.input("Save to .envrc? [y/N]", "y")
|
local save = vim.fn.input("Save to .envrc? [y/N]", "y")
|
||||||
if save == "y" then
|
if save == "y" then
|
||||||
local existing_envrc = vim.fn.readfile(".envrc")
|
local existing_envrc = vim.fn.readfile(".envrc")
|
||||||
local write = true
|
local write = true
|
||||||
for line in existing_envrc do
|
for line in existing_envrc do
|
||||||
if string.find(line, "export DIRENV_EXTRA_VIMRC") then
|
if string.find(line, "export DIRENV_EXTRA_VIMRC") then
|
||||||
write = false
|
write = false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if write then
|
if write then
|
||||||
vim.fn.writefile({"export DIRENV_EXTRA_VIMRC=" .. local_vimrc}, ".envrc", "a")
|
vim.fn.writefile({ "export DIRENV_EXTRA_VIMRC=" .. local_vimrc }, ".envrc", "a")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
vim.cmd("edit " .. local_vimrc)
|
vim.cmd("edit " .. local_vimrc)
|
||||||
end
|
end
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
|
|
@ -7,28 +7,28 @@
|
||||||
-- Works regardless of ssh or https for origin config
|
-- Works regardless of ssh or https for origin config
|
||||||
-- Hardcoded to use 'origin' remote
|
-- Hardcoded to use 'origin' remote
|
||||||
local function get_pr_url(...)
|
local function get_pr_url(...)
|
||||||
local origin_url = vim.fn["fugitive#RemoteUrl"]("origin")
|
local origin_url = vim.fn["fugitive#RemoteUrl"]("origin")
|
||||||
origin_url = string.gsub(origin_url, ".git$", "")
|
origin_url = string.gsub(origin_url, ".git$", "")
|
||||||
origin_url = string.gsub(origin_url, ":", "/")
|
origin_url = string.gsub(origin_url, ":", "/")
|
||||||
origin_url = string.gsub(origin_url, "git@", "https://")
|
origin_url = string.gsub(origin_url, "git@", "https://")
|
||||||
|
|
||||||
-- Remove prefix if it is available, for some of common git services
|
-- Remove prefix if it is available, for some of common git services
|
||||||
local common_services = {"github.com", "bitbucket.org", "gitlab.com"}
|
local common_services = { "github.com", "bitbucket.org", "gitlab.com" }
|
||||||
for k, service in pairs(common_services) do
|
for k, service in pairs(common_services) do
|
||||||
if (string.find(origin_url, service, 1, true)) then
|
if string.find(origin_url, service, 1, true) then
|
||||||
-- Common mechanism for managing multiple SSH keys
|
-- Common mechanism for managing multiple SSH keys
|
||||||
origin_url = string.gsub(origin_url, "://.*" .. service, "://" .. service)
|
origin_url = string.gsub(origin_url, "://.*" .. service, "://" .. service)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- This part probably only works on github
|
-- This part probably only works on github
|
||||||
local pr_url
|
local pr_url
|
||||||
if (select("#", ...) == 0) then
|
if select("#", ...) == 0 then
|
||||||
pr_url = origin_url .. "/compare/" .. vim.fn.FugitiveHead() .. "?expand=1"
|
pr_url = origin_url .. "/compare/" .. vim.fn.FugitiveHead() .. "?expand=1"
|
||||||
else
|
else
|
||||||
pr_url = origin_url .. "/compare/" .. select(1, ...) .. "..." .. vim.fn.FugitiveHead() .. "?expand=1"
|
pr_url = origin_url .. "/compare/" .. select(1, ...) .. "..." .. vim.fn.FugitiveHead() .. "?expand=1"
|
||||||
end
|
end
|
||||||
return pr_url
|
return pr_url
|
||||||
end
|
end
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
|
@ -40,41 +40,41 @@ local M = {}
|
||||||
-- Shorcut to push directly to current branch on origin
|
-- Shorcut to push directly to current branch on origin
|
||||||
-- Similar to `ggpush` in fish config
|
-- Similar to `ggpush` in fish config
|
||||||
function M.push_origin()
|
function M.push_origin()
|
||||||
vim.cmd("Git push origin " .. vim.fn.FugitiveHead())
|
vim.cmd("Git push origin " .. vim.fn.FugitiveHead())
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Shorcut to pull directly from current branch on origin
|
-- Shorcut to pull directly from current branch on origin
|
||||||
-- Similar to `ggpull` in fish config
|
-- Similar to `ggpull` in fish config
|
||||||
function M.pull_origin()
|
function M.pull_origin()
|
||||||
vim.cmd("Git pull origin " .. vim.fn.FugitiveHead())
|
vim.cmd("Git pull origin " .. vim.fn.FugitiveHead())
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Prints current branches PR url (not saved to :messages)
|
-- Prints current branches PR url (not saved to :messages)
|
||||||
-- Makes it easy to use terminal for opening url on click
|
-- Makes it easy to use terminal for opening url on click
|
||||||
function M.print_pr_url(...)
|
function M.print_pr_url(...)
|
||||||
vim.cmd('echo "' .. get_pr_url(...) .. '"')
|
vim.cmd('echo "' .. get_pr_url(...) .. '"')
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Copies current branches PR url to system clipboard
|
-- Copies current branches PR url to system clipboard
|
||||||
function M.copy_pr_url(...)
|
function M.copy_pr_url(...)
|
||||||
vim.cmd('let @+ = "' .. get_pr_url(...) .. '"')
|
vim.cmd('let @+ = "' .. get_pr_url(...) .. '"')
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Opens current banches PR url in default browser
|
-- Opens current banches PR url in default browser
|
||||||
-- Utilizes netrw browse, meaning it should behave same as netrw
|
-- Utilizes netrw browse, meaning it should behave same as netrw
|
||||||
function M.open_new_pr(...)
|
function M.open_new_pr(...)
|
||||||
vim.fn["netrw#BrowseX"](get_pr_url(...), 0)
|
vim.fn["netrw#BrowseX"](get_pr_url(...), 0)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Creates new branch and checks out to it
|
-- Creates new branch and checks out to it
|
||||||
-- Similar to `gcb` in fish config
|
-- Similar to `gcb` in fish config
|
||||||
function M.create_branch(branch)
|
function M.create_branch(branch)
|
||||||
vim.cmd("Git checkout -b " .. branch)
|
vim.cmd("Git checkout -b " .. branch)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Switches to branch
|
-- Switches to branch
|
||||||
function M.checkout_branch(branch)
|
function M.checkout_branch(branch)
|
||||||
vim.cmd("Git checkout " .. branch)
|
vim.cmd("Git checkout " .. branch)
|
||||||
end
|
end
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
|
|
@ -1,31 +1,30 @@
|
||||||
-- Adopted from https://github.com/tjdevries/config_manager/blob/master/xdg_config/nvim/lua/tj/first_load.lua
|
-- Adopted from https://github.com/tjdevries/config_manager/blob/master/xdg_config/nvim/lua/tj/first_load.lua
|
||||||
local download_packer = function()
|
local download_packer = function()
|
||||||
if vim.fn.input("Download Packer? (y for yes)") ~= "y" then
|
if vim.fn.input("Download Packer? (y for yes)") ~= "y" then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
local directory = string.format("%s/site/pack/packer/start/", vim.fn.stdpath("data"))
|
local directory = string.format("%s/site/pack/packer/start/", vim.fn.stdpath("data"))
|
||||||
|
|
||||||
vim.fn.mkdir(directory, "p")
|
vim.fn.mkdir(directory, "p")
|
||||||
|
|
||||||
local out =
|
local out = vim.fn.system(
|
||||||
vim.fn.system(
|
string.format("git clone %s %s", "https://github.com/wbthomason/packer.nvim", directory .. "/packer.nvim")
|
||||||
string.format("git clone %s %s", "https://github.com/wbthomason/packer.nvim", directory .. "/packer.nvim")
|
)
|
||||||
)
|
|
||||||
|
|
||||||
print(out)
|
print(out)
|
||||||
print("Downloading packer.nvim...")
|
print("Downloading packer.nvim...")
|
||||||
vim.api.nvim_command("PackerCompile")
|
vim.api.nvim_command("PackerCompile")
|
||||||
vim.api.nvim_command("PackerInstall")
|
vim.api.nvim_command("PackerInstall")
|
||||||
print("( You'll need to restart now )")
|
print("( You'll need to restart now )")
|
||||||
end
|
end
|
||||||
|
|
||||||
return function()
|
return function()
|
||||||
if not pcall(require, "packer") then
|
if not pcall(require, "packer") then
|
||||||
download_packer()
|
download_packer()
|
||||||
|
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
local opt = vim.opt
|
local opt = vim.opt
|
||||||
|
|
||||||
opt.wildignore = "__pycache__"
|
opt.wildignore = "__pycache__"
|
||||||
opt.wildignore = opt.wildignore + {"*.o", "*~", "*.pyc", "*pycache*"}
|
opt.wildignore = opt.wildignore + { "*.o", "*~", "*.pyc", "*pycache*" }
|
||||||
|
|
||||||
-- Indentation config
|
-- Indentation config
|
||||||
opt.tabstop = 2
|
opt.tabstop = 2
|
||||||
|
|
|
@ -1,95 +1,95 @@
|
||||||
return require("packer").startup {
|
return require("packer").startup({
|
||||||
function(use)
|
function(use)
|
||||||
use "wbthomason/packer.nvim"
|
use("wbthomason/packer.nvim")
|
||||||
|
|
||||||
-- Tpope general improvements
|
-- Tpope general improvements
|
||||||
use "tpope/vim-sensible" -- Sane defaults
|
use("tpope/vim-sensible") -- Sane defaults
|
||||||
use "tpope/vim-endwise" -- Add closing statements automatically for if, function etc
|
use("tpope/vim-endwise") -- Add closing statements automatically for if, function etc
|
||||||
use "tpope/vim-surround" -- Surround with ', ", etc
|
use("tpope/vim-surround") -- Surround with ', ", etc
|
||||||
use "tpope/vim-fugitive" -- Git integration
|
use("tpope/vim-fugitive") -- Git integration
|
||||||
use "tpope/vim-vinegar" -- Netrw improvements
|
use("tpope/vim-vinegar") -- Netrw improvements
|
||||||
use "tpope/vim-obsession" -- Session.vim management
|
use("tpope/vim-obsession") -- Session.vim management
|
||||||
use "tpope/vim-dadbod" -- Database access
|
use("tpope/vim-dadbod") -- Database access
|
||||||
use "kristijanhusak/vim-dadbod-ui" -- UI For Dadbod
|
use("kristijanhusak/vim-dadbod-ui") -- UI For Dadbod
|
||||||
use "tpope/vim-speeddating" -- <C-A> and <C-X> for dates
|
use("tpope/vim-speeddating") -- <C-A> and <C-X> for dates
|
||||||
use "tpope/vim-dispatch" -- Dispatch command
|
use("tpope/vim-dispatch") -- Dispatch command
|
||||||
use "tpope/vim-projectionist" -- Project config file!
|
use("tpope/vim-projectionist") -- Project config file!
|
||||||
use "tpope/vim-unimpaired" -- Additional [ and ] mappings
|
use("tpope/vim-unimpaired") -- Additional [ and ] mappings
|
||||||
use "tpope/vim-repeat" -- Better . repeat
|
use("tpope/vim-repeat") -- Better . repeat
|
||||||
use "tpope/vim-commentary" -- Commenting motion
|
use("tpope/vim-commentary") -- Commenting motion
|
||||||
use "tpope/vim-sleuth" -- Intendation heuristics
|
use("tpope/vim-sleuth") -- Intendation heuristics
|
||||||
|
|
||||||
-- General improvements
|
-- General improvements
|
||||||
use "lewis6991/gitsigns.nvim" -- Git signs
|
use("lewis6991/gitsigns.nvim") -- Git signs
|
||||||
use "godlygeek/tabular" -- Tabular command for alignment
|
use("godlygeek/tabular") -- Tabular command for alignment
|
||||||
use "vim-scripts/utl.vim" -- Universal text linking
|
use("vim-scripts/utl.vim") -- Universal text linking
|
||||||
use {"mbbill/undotree", cmd = "UndotreeToggle"} -- Undos in a tree for easy access
|
use({ "mbbill/undotree", cmd = "UndotreeToggle" }) -- Undos in a tree for easy access
|
||||||
use "mhinz/vim-grepper" -- Grepper command - improved grepping throughout project
|
use("mhinz/vim-grepper") -- Grepper command - improved grepping throughout project
|
||||||
use "radenling/vim-dispatch-neovim" -- vim-dispatch for neovim - uses terminal
|
use("radenling/vim-dispatch-neovim") -- vim-dispatch for neovim - uses terminal
|
||||||
use "wellle/targets.vim" -- Additional targets for inside and around motions
|
use("wellle/targets.vim") -- Additional targets for inside and around motions
|
||||||
use "flazz/vim-colorschemes" -- All popular colorschemes
|
use("flazz/vim-colorschemes") -- All popular colorschemes
|
||||||
use "romainl/vim-qf" -- Quickfix list upgrades
|
use("romainl/vim-qf") -- Quickfix list upgrades
|
||||||
use "romainl/vim-devdocs" -- Quick DevDocs.io search using :DD
|
use("romainl/vim-devdocs") -- Quick DevDocs.io search using :DD
|
||||||
use "gpanders/editorconfig.nvim" -- .editorconfig support
|
use("gpanders/editorconfig.nvim") -- .editorconfig support
|
||||||
use "lewis6991/impatient.nvim" -- Caching lua modules for faster startup
|
use("lewis6991/impatient.nvim") -- Caching lua modules for faster startup
|
||||||
|
|
||||||
-- Tools
|
-- Tools
|
||||||
use "direnv/direnv.vim" -- Integration with Direnv
|
use("direnv/direnv.vim") -- Integration with Direnv
|
||||||
use "vim-test/vim-test" -- Running tests from vim
|
use("vim-test/vim-test") -- Running tests from vim
|
||||||
use "mfussenegger/nvim-dap" -- Debug Adapter Protocol
|
use("mfussenegger/nvim-dap") -- Debug Adapter Protocol
|
||||||
use "rcarriga/nvim-dap-ui" -- UI components for DAP
|
use("rcarriga/nvim-dap-ui") -- UI components for DAP
|
||||||
use "theHamsta/nvim-dap-virtual-text" -- Virtual text display for DAP
|
use("theHamsta/nvim-dap-virtual-text") -- Virtual text display for DAP
|
||||||
use "diepm/vim-rest-console" -- REST console for vim
|
use("diepm/vim-rest-console") -- REST console for vim
|
||||||
use "jamestthompson3/nvim-remote-containers" -- devcontainer.json support
|
use("jamestthompson3/nvim-remote-containers") -- devcontainer.json support
|
||||||
use "jbyuki/one-small-step-for-vimkind" -- Debugger for Nvim-Lua
|
use("jbyuki/one-small-step-for-vimkind") -- Debugger for Nvim-Lua
|
||||||
|
|
||||||
-- Snippets
|
-- Snippets
|
||||||
use "L3MON4D3/LuaSnip" -- snippets support
|
use("L3MON4D3/LuaSnip") -- snippets support
|
||||||
use "rafamadriz/friendly-snippets" -- Collection of snippets
|
use("rafamadriz/friendly-snippets") -- Collection of snippets
|
||||||
use "saadparwaiz1/cmp_luasnip" -- cmp snippets support
|
use("saadparwaiz1/cmp_luasnip") -- cmp snippets support
|
||||||
|
|
||||||
-- Language support
|
-- Language support
|
||||||
use "tpope/vim-rails" -- Enables all rails command through vim and integrates with projectionist
|
use("tpope/vim-rails") -- Enables all rails command through vim and integrates with projectionist
|
||||||
use "c-brenn/phoenix.vim" -- Similar to vim-rails, but for phoenix
|
use("c-brenn/phoenix.vim") -- Similar to vim-rails, but for phoenix
|
||||||
use "tpope/vim-salve" -- Clojure integration with projectionist
|
use("tpope/vim-salve") -- Clojure integration with projectionist
|
||||||
use "tpope/vim-fireplace" -- Clojure REPL and integration
|
use("tpope/vim-fireplace") -- Clojure REPL and integration
|
||||||
use "vimwiki/vimwiki" -- Vimwiki - personal wiki in vim
|
use("vimwiki/vimwiki") -- Vimwiki - personal wiki in vim
|
||||||
use "esensar/vimwiki-reviews-lua" -- Vimwiki extension for periodic reviews
|
use("esensar/vimwiki-reviews-lua") -- Vimwiki extension for periodic reviews
|
||||||
use "ledger/vim-ledger" -- Support for ledger-cli format
|
use("ledger/vim-ledger") -- Support for ledger-cli format
|
||||||
use "tandrewnichols/vim-docile" -- Support for vim doc.txt format
|
use("tandrewnichols/vim-docile") -- Support for vim doc.txt format
|
||||||
use "habamax/vim-godot" -- Godot engine (and script) support
|
use("habamax/vim-godot") -- Godot engine (and script) support
|
||||||
use "guns/vim-sexp" -- Precision editing for S-expressions
|
use("guns/vim-sexp") -- Precision editing for S-expressions
|
||||||
use("tpope/vim-sexp-mappings-for-regular-people") -- Simpler keymaps for vim-sexp
|
use("tpope/vim-sexp-mappings-for-regular-people") -- Simpler keymaps for vim-sexp
|
||||||
use "tridactyl/vim-tridactyl" -- Tridactyl config file support
|
use("tridactyl/vim-tridactyl") -- Tridactyl config file support
|
||||||
use "aklt/plantuml-syntax" -- PlantUML support
|
use("aklt/plantuml-syntax") -- PlantUML support
|
||||||
use "cdelledonne/vim-cmake" -- CMake integration
|
use("cdelledonne/vim-cmake") -- CMake integration
|
||||||
|
|
||||||
-- Treesitter
|
-- Treesitter
|
||||||
use {"nvim-treesitter/nvim-treesitter", run = ":TSUpdate"} -- Treesitter integration
|
use({ "nvim-treesitter/nvim-treesitter", run = ":TSUpdate" }) -- Treesitter integration
|
||||||
use "nvim-treesitter/playground" -- TSPlaygroundToggle - access treesitter data
|
use("nvim-treesitter/playground") -- TSPlaygroundToggle - access treesitter data
|
||||||
|
|
||||||
-- LSP
|
-- LSP
|
||||||
use "neovim/nvim-lspconfig" -- Easy LSP Config
|
use("neovim/nvim-lspconfig") -- Easy LSP Config
|
||||||
use "alexaandru/nvim-lspupdate" -- Easy install and update for many LSP servers
|
use("alexaandru/nvim-lspupdate") -- Easy install and update for many LSP servers
|
||||||
use "hrsh7th/cmp-nvim-lsp" -- LSP source for cmp
|
use("hrsh7th/cmp-nvim-lsp") -- LSP source for cmp
|
||||||
use "hrsh7th/cmp-buffer" -- Buffer source for nvim-cmp
|
use("hrsh7th/cmp-buffer") -- Buffer source for nvim-cmp
|
||||||
use "hrsh7th/cmp-path" -- Path source for nvim-cmp
|
use("hrsh7th/cmp-path") -- Path source for nvim-cmp
|
||||||
use "hrsh7th/cmp-nvim-lua" -- Nvim-Lua source for nvim-cmp
|
use("hrsh7th/cmp-nvim-lua") -- Nvim-Lua source for nvim-cmp
|
||||||
use "hrsh7th/nvim-cmp" -- completion integration
|
use("hrsh7th/nvim-cmp") -- completion integration
|
||||||
use "nvim-lua/lsp_extensions.nvim" -- LSP extensions (like closing labels for Dart)
|
use("nvim-lua/lsp_extensions.nvim") -- LSP extensions (like closing labels for Dart)
|
||||||
use "jose-elias-alvarez/null-ls.nvim" -- Linting and formatting
|
use("jose-elias-alvarez/null-ls.nvim") -- Linting and formatting
|
||||||
|
|
||||||
-- LSP language specific
|
-- LSP language specific
|
||||||
use "tjdevries/nlua.nvim" -- Built-in Lua integration with LSP
|
use("tjdevries/nlua.nvim") -- Built-in Lua integration with LSP
|
||||||
use "akinsho/flutter-tools.nvim" -- Additional flutter integrations
|
use("akinsho/flutter-tools.nvim") -- Additional flutter integrations
|
||||||
use "mfussenegger/nvim-jdtls" -- Additional java integrations
|
use("mfussenegger/nvim-jdtls") -- Additional java integrations
|
||||||
|
|
||||||
-- Lua support
|
-- Lua support
|
||||||
use "nvim-lua/popup.nvim" -- Popup API integration - needed for some plugins
|
use("nvim-lua/popup.nvim") -- Popup API integration - needed for some plugins
|
||||||
use "nvim-lua/plenary.nvim" -- Lua helpers
|
use("nvim-lua/plenary.nvim") -- Lua helpers
|
||||||
|
|
||||||
-- Telescope
|
-- Telescope
|
||||||
use "nvim-telescope/telescope.nvim" -- Fuzzy searcher
|
use("nvim-telescope/telescope.nvim") -- Fuzzy searcher
|
||||||
use "nvim-telescope/telescope-dap.nvim" -- DAP integration for Telescope
|
use("nvim-telescope/telescope-dap.nvim") -- DAP integration for Telescope
|
||||||
end
|
end,
|
||||||
}
|
})
|
||||||
|
|
|
@ -4,50 +4,55 @@
|
||||||
-- Set completeopt to have a better completion experience
|
-- Set completeopt to have a better completion experience
|
||||||
vim.o.completeopt = "menu,menuone,noselect"
|
vim.o.completeopt = "menu,menuone,noselect"
|
||||||
|
|
||||||
local cmp = require "cmp"
|
local cmp = require("cmp")
|
||||||
local luasnip = require("luasnip")
|
local luasnip = require("luasnip")
|
||||||
|
|
||||||
cmp.setup {
|
cmp.setup({
|
||||||
snippet = {
|
snippet = {
|
||||||
expand = function(args) require'luasnip'.lsp_expand(args.body) end
|
expand = function(args)
|
||||||
},
|
require("luasnip").lsp_expand(args.body)
|
||||||
mapping = {
|
end,
|
||||||
["<C-d>"] = cmp.mapping.scroll_docs(-4),
|
},
|
||||||
["<C-f>"] = cmp.mapping.scroll_docs(4),
|
mapping = {
|
||||||
["<C-Space>"] = cmp.mapping.complete(),
|
["<C-d>"] = cmp.mapping.scroll_docs(-4),
|
||||||
["<C-e>"] = cmp.mapping.close(),
|
["<C-f>"] = cmp.mapping.scroll_docs(4),
|
||||||
["<C-y>"] = cmp.mapping.confirm({select = true}),
|
["<C-Space>"] = cmp.mapping.complete(),
|
||||||
["<C-n>"] = function(fallback)
|
["<C-e>"] = cmp.mapping.close(),
|
||||||
if cmp.visible() then
|
["<C-y>"] = cmp.mapping.confirm({ select = true }),
|
||||||
cmp.select_next_item()
|
["<C-n>"] = function(fallback)
|
||||||
else
|
if cmp.visible() then
|
||||||
fallback()
|
cmp.select_next_item()
|
||||||
end
|
else
|
||||||
end,
|
fallback()
|
||||||
["<C-p>"] = function(fallback)
|
end
|
||||||
if cmp.visible() then
|
end,
|
||||||
cmp.select_prev_item()
|
["<C-p>"] = function(fallback)
|
||||||
else
|
if cmp.visible() then
|
||||||
fallback()
|
cmp.select_prev_item()
|
||||||
end
|
else
|
||||||
end,
|
fallback()
|
||||||
["<C-j>"] = cmp.mapping(function(fallback)
|
end
|
||||||
if luasnip.jumpable(1) then
|
end,
|
||||||
luasnip.jump(1)
|
["<C-j>"] = cmp.mapping(function(fallback)
|
||||||
else
|
if luasnip.jumpable(1) then
|
||||||
fallback()
|
luasnip.jump(1)
|
||||||
end
|
else
|
||||||
end, {"i", "s"}),
|
fallback()
|
||||||
["<C-k>"] = cmp.mapping(function(fallback)
|
end
|
||||||
if luasnip.jumpable(-1) then
|
end, { "i", "s" }),
|
||||||
luasnip.jump(-1)
|
["<C-k>"] = cmp.mapping(function(fallback)
|
||||||
else
|
if luasnip.jumpable(-1) then
|
||||||
fallback()
|
luasnip.jump(-1)
|
||||||
end
|
else
|
||||||
end, {"i", "s"})
|
fallback()
|
||||||
},
|
end
|
||||||
sources = {
|
end, { "i", "s" }),
|
||||||
{name = "nvim_lsp"}, {name = "nvim_lua"}, {name = "path"},
|
},
|
||||||
{name = "luasnip"}, {name = "buffer"}
|
sources = {
|
||||||
}
|
{ name = "nvim_lsp" },
|
||||||
}
|
{ name = "nvim_lua" },
|
||||||
|
{ name = "path" },
|
||||||
|
{ name = "luasnip" },
|
||||||
|
{ name = "buffer" },
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
|
@ -2,56 +2,56 @@
|
||||||
-- - LSP diagnostics config -
|
-- - LSP diagnostics config -
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
|
|
||||||
local null_ls = require('null-ls')
|
local null_ls = require("null-ls")
|
||||||
|
|
||||||
null_ls.setup({
|
null_ls.setup({
|
||||||
sources = {
|
sources = {
|
||||||
-- Python
|
-- Python
|
||||||
null_ls.builtins.diagnostics.flake8,
|
null_ls.builtins.diagnostics.flake8,
|
||||||
null_ls.builtins.formatting.isort,
|
null_ls.builtins.formatting.isort,
|
||||||
null_ls.builtins.formatting.autopep8,
|
null_ls.builtins.formatting.autopep8,
|
||||||
|
|
||||||
-- Kotlin
|
-- Kotlin
|
||||||
null_ls.builtins.formatting.ktlint,
|
null_ls.builtins.formatting.ktlint,
|
||||||
null_ls.builtins.diagnostics.ktlint,
|
null_ls.builtins.diagnostics.ktlint,
|
||||||
|
|
||||||
-- C++ and C
|
-- C++ and C
|
||||||
null_ls.builtins.formatting.clang_format,
|
null_ls.builtins.formatting.clang_format,
|
||||||
|
|
||||||
-- Cmake
|
-- Cmake
|
||||||
null_ls.builtins.formatting.cmake_format,
|
null_ls.builtins.formatting.cmake_format,
|
||||||
|
|
||||||
-- Lua
|
-- Lua
|
||||||
null_ls.builtins.formatting.lua_format,
|
null_ls.builtins.formatting.stylua,
|
||||||
|
|
||||||
-- Dart
|
-- Dart
|
||||||
null_ls.builtins.formatting.dart_format,
|
null_ls.builtins.formatting.dart_format,
|
||||||
|
|
||||||
-- Go
|
-- Go
|
||||||
null_ls.builtins.formatting.gofmt,
|
null_ls.builtins.formatting.gofmt,
|
||||||
|
|
||||||
-- Rust
|
-- Rust
|
||||||
null_ls.builtins.formatting.rustfmt,
|
null_ls.builtins.formatting.rustfmt,
|
||||||
|
|
||||||
-- Java
|
-- Java
|
||||||
null_ls.builtins.formatting.google_java_format,
|
null_ls.builtins.formatting.google_java_format,
|
||||||
|
|
||||||
-- General
|
-- General
|
||||||
null_ls.builtins.formatting.trim_newlines,
|
null_ls.builtins.formatting.trim_newlines,
|
||||||
null_ls.builtins.formatting.trim_whitespace,
|
null_ls.builtins.formatting.trim_whitespace,
|
||||||
null_ls.builtins.hover.dictionary,
|
null_ls.builtins.hover.dictionary,
|
||||||
null_ls.builtins.code_actions.gitsigns,
|
null_ls.builtins.code_actions.gitsigns,
|
||||||
},
|
},
|
||||||
on_attach = function(client)
|
on_attach = function(client)
|
||||||
if client.resolved_capabilities.document_formatting then
|
if client.resolved_capabilities.document_formatting then
|
||||||
vim.cmd([[
|
vim.cmd([[
|
||||||
augroup LspFormatting
|
augroup LspFormatting
|
||||||
autocmd! * <buffer>
|
autocmd! * <buffer>
|
||||||
autocmd BufWritePre <buffer> lua vim.lsp.buf.formatting_seq_sync()
|
autocmd BufWritePre <buffer> lua vim.lsp.buf.formatting_seq_sync()
|
||||||
augroup END
|
augroup END
|
||||||
]])
|
]])
|
||||||
end
|
end
|
||||||
end
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
vim.keymap.set("n", "]w", vim.diagnostic.goto_next)
|
vim.keymap.set("n", "]w", vim.diagnostic.goto_next)
|
||||||
|
|
|
@ -6,56 +6,56 @@ local common_config = require("lsp.server_config")
|
||||||
local M = {}
|
local M = {}
|
||||||
|
|
||||||
function M.setup()
|
function M.setup()
|
||||||
require "jdtls".setup_dap()
|
require("jdtls").setup_dap()
|
||||||
require "jdtls.setup".add_commands()
|
require("jdtls.setup").add_commands()
|
||||||
local on_attach = function(client, bufnr)
|
local on_attach = function(client, bufnr)
|
||||||
vim.bo.omnifunc = "v:lua.vim.lsp.omnifunc"
|
vim.bo.omnifunc = "v:lua.vim.lsp.omnifunc"
|
||||||
|
|
||||||
common_config.on_attach(client, bufnr)
|
common_config.on_attach(client, bufnr)
|
||||||
|
|
||||||
local code_action_fun = function()
|
local code_action_fun = function()
|
||||||
require "jdtls".code_action()
|
require("jdtls").code_action()
|
||||||
end
|
end
|
||||||
vim.keymap.set("n", "<A-CR>", code_action_fun)
|
vim.keymap.set("n", "<A-CR>", code_action_fun)
|
||||||
vim.keymap.set("n", "<Leader>ac", code_action_fun)
|
vim.keymap.set("n", "<Leader>ac", code_action_fun)
|
||||||
end
|
end
|
||||||
|
|
||||||
local root_markers = {"gradlew", "pom.xml"}
|
local root_markers = { "gradlew", "pom.xml" }
|
||||||
local root_dir = require("jdtls.setup").find_root(root_markers)
|
local root_dir = require("jdtls.setup").find_root(root_markers)
|
||||||
local home = os.getenv("HOME")
|
local home = os.getenv("HOME")
|
||||||
|
|
||||||
local workspace_folder = home .. "/.workspace" .. vim.fn.fnamemodify(root_dir, ":p:h:t")
|
local workspace_folder = home .. "/.workspace" .. vim.fn.fnamemodify(root_dir, ":p:h:t")
|
||||||
local config = {
|
local config = {
|
||||||
flags = {
|
flags = {
|
||||||
allow_incremental_sync = true
|
allow_incremental_sync = true,
|
||||||
},
|
},
|
||||||
on_attach = on_attach
|
on_attach = on_attach,
|
||||||
}
|
}
|
||||||
config.settings = {
|
config.settings = {
|
||||||
java = {
|
java = {
|
||||||
signatureHelp = {enabled = true},
|
signatureHelp = { enabled = true },
|
||||||
sources = {
|
sources = {
|
||||||
organizeImports = {
|
organizeImports = {
|
||||||
starThreshold = 9999,
|
starThreshold = 9999,
|
||||||
staticStarThreshold = 9999
|
staticStarThreshold = 9999,
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
config.cmd = {"jdtls-start.sh", workspace_folder}
|
config.cmd = { "jdtls-start.sh", workspace_folder }
|
||||||
config.on_init = function(client, _)
|
config.on_init = function(client, _)
|
||||||
client.notify("workspace/didChangeConfiguration", {settings = config.settings})
|
client.notify("workspace/didChangeConfiguration", { settings = config.settings })
|
||||||
end
|
end
|
||||||
|
|
||||||
local extendedClientCapabilities = require "jdtls".extendedClientCapabilities
|
local extendedClientCapabilities = require("jdtls").extendedClientCapabilities
|
||||||
extendedClientCapabilities.resolveAdditionalTextEditsSupport = true
|
extendedClientCapabilities.resolveAdditionalTextEditsSupport = true
|
||||||
config.init_options = {
|
config.init_options = {
|
||||||
-- bundles = bundles;
|
-- bundles = bundles;
|
||||||
extendedClientCapabilities = extendedClientCapabilities
|
extendedClientCapabilities = extendedClientCapabilities,
|
||||||
}
|
}
|
||||||
|
|
||||||
-- Server
|
-- Server
|
||||||
require("jdtls").start_or_attach(config)
|
require("jdtls").start_or_attach(config)
|
||||||
end
|
end
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
|
|
@ -5,64 +5,19 @@
|
||||||
local M = {}
|
local M = {}
|
||||||
|
|
||||||
M.on_attach = function(client, bufnr)
|
M.on_attach = function(client, bufnr)
|
||||||
vim.bo.omnifunc = "v:lua.vim.lsp.omnifunc"
|
vim.bo.omnifunc = "v:lua.vim.lsp.omnifunc"
|
||||||
|
|
||||||
-- Lsp keymaps
|
-- Lsp keymaps
|
||||||
local opts = {buffer = bufnr}
|
local opts = { buffer = bufnr }
|
||||||
vim.keymap.set(
|
vim.keymap.set("n", "<C-]>", vim.lsp.buf.definition, opts)
|
||||||
"n",
|
vim.keymap.set("n", "gD", vim.lsp.buf.declaration, opts)
|
||||||
"<C-]>",
|
vim.keymap.set("n", "gr", vim.lsp.buf.references, opts)
|
||||||
vim.lsp.buf.definition,
|
vim.keymap.set("n", "gi", vim.lsp.buf.implementation, opts)
|
||||||
opts
|
vim.keymap.set("n", "<Leader>rn", vim.lsp.buf.rename, opts)
|
||||||
)
|
vim.keymap.set("n", "<C-k>", vim.lsp.buf.signature_help, opts)
|
||||||
vim.keymap.set(
|
vim.keymap.set("n", "K", vim.lsp.buf.hover, opts)
|
||||||
"n",
|
vim.keymap.set("n", "<A-CR>", vim.lsp.buf.code_action, opts)
|
||||||
"gD",
|
vim.keymap.set("n", "<Leader>ac", vim.lsp.buf.code_action, opts)
|
||||||
vim.lsp.buf.declaration,
|
|
||||||
opts
|
|
||||||
)
|
|
||||||
vim.keymap.set(
|
|
||||||
"n",
|
|
||||||
"gr",
|
|
||||||
vim.lsp.buf.references,
|
|
||||||
opts
|
|
||||||
)
|
|
||||||
vim.keymap.set(
|
|
||||||
"n",
|
|
||||||
"gi",
|
|
||||||
vim.lsp.buf.implementation,
|
|
||||||
opts
|
|
||||||
)
|
|
||||||
vim.keymap.set(
|
|
||||||
"n",
|
|
||||||
"<Leader>rn",
|
|
||||||
vim.lsp.buf.rename,
|
|
||||||
opts
|
|
||||||
)
|
|
||||||
vim.keymap.set(
|
|
||||||
"n",
|
|
||||||
"<C-k>",
|
|
||||||
vim.lsp.buf.signature_help,
|
|
||||||
opts
|
|
||||||
)
|
|
||||||
vim.keymap.set(
|
|
||||||
"n",
|
|
||||||
"K",
|
|
||||||
vim.lsp.buf.hover,
|
|
||||||
opts
|
|
||||||
)
|
|
||||||
vim.keymap.set(
|
|
||||||
"n",
|
|
||||||
"<A-CR>",
|
|
||||||
vim.lsp.buf.code_action,
|
|
||||||
opts
|
|
||||||
)
|
|
||||||
vim.keymap.set(
|
|
||||||
"n",
|
|
||||||
"<Leader>ac",
|
|
||||||
vim.lsp.buf.code_action,
|
|
||||||
opts
|
|
||||||
)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
|
|
@ -9,72 +9,69 @@ local capabilities = require("cmp_nvim_lsp").update_capabilities(vim.lsp.protoco
|
||||||
|
|
||||||
-- Lsp default language servers
|
-- Lsp default language servers
|
||||||
local servers = {
|
local servers = {
|
||||||
"bashls",
|
"bashls",
|
||||||
"clangd",
|
"clangd",
|
||||||
"clojure_lsp",
|
"clojure_lsp",
|
||||||
"cmake",
|
"cmake",
|
||||||
"crystalline",
|
"crystalline",
|
||||||
"cucumber_language_server",
|
"cucumber_language_server",
|
||||||
"dockerls",
|
"dockerls",
|
||||||
"gopls",
|
"gopls",
|
||||||
"hls",
|
"hls",
|
||||||
"jsonls",
|
"jsonls",
|
||||||
"kotlin_language_server",
|
"kotlin_language_server",
|
||||||
"mint",
|
"mint",
|
||||||
"pyright",
|
"pyright",
|
||||||
"rust_analyzer",
|
"rust_analyzer",
|
||||||
"solang",
|
"solang",
|
||||||
"terraformls",
|
"terraformls",
|
||||||
"tsserver",
|
"tsserver",
|
||||||
"vimls",
|
"vimls",
|
||||||
}
|
}
|
||||||
for _, lsp in ipairs(servers) do
|
for _, lsp in ipairs(servers) do
|
||||||
lspconfig[lsp].setup {
|
lspconfig[lsp].setup({
|
||||||
on_attach = common_config.on_attach,
|
on_attach = common_config.on_attach,
|
||||||
capabilities = capabilities
|
capabilities = capabilities,
|
||||||
}
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
lspconfig["gdscript"].setup {
|
lspconfig["gdscript"].setup({
|
||||||
on_attach = common_config.on_attach,
|
on_attach = common_config.on_attach,
|
||||||
capabilities = capabilities,
|
capabilities = capabilities,
|
||||||
flags = {
|
flags = {
|
||||||
-- Slow Godot LS
|
-- Slow Godot LS
|
||||||
debounce_text_changes = 600
|
debounce_text_changes = 600,
|
||||||
}
|
},
|
||||||
}
|
})
|
||||||
|
|
||||||
-- Lua bultin lsp
|
-- Lua bultin lsp
|
||||||
require("nlua.lsp.nvim").setup(
|
require("nlua.lsp.nvim").setup(lspconfig, {
|
||||||
lspconfig,
|
on_attach = common_config.on_attach,
|
||||||
{
|
capabilities = capabilities,
|
||||||
on_attach = common_config.on_attach,
|
-- Include globals you want to tell the LSP are real :)
|
||||||
capabilities = capabilities,
|
globals = {},
|
||||||
-- Include globals you want to tell the LSP are real :)
|
})
|
||||||
globals = {}
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
-- Flutter tools
|
-- Flutter tools
|
||||||
require("flutter-tools").setup {
|
require("flutter-tools").setup({
|
||||||
lsp = {
|
lsp = {
|
||||||
on_attach = common_config.on_attach,
|
on_attach = common_config.on_attach,
|
||||||
capabilities = capabilities
|
capabilities = capabilities,
|
||||||
}
|
},
|
||||||
}
|
})
|
||||||
|
|
||||||
-- Dotnet LS
|
-- Dotnet LS
|
||||||
local pid = vim.fn.getpid()
|
local pid = vim.fn.getpid()
|
||||||
local omnisharp_bin = vim.fn.glob("$HOME") .. "/lsp/dotnet/omnisharp/run"
|
local omnisharp_bin = vim.fn.glob("$HOME") .. "/lsp/dotnet/omnisharp/run"
|
||||||
lspconfig.omnisharp.setup {
|
lspconfig.omnisharp.setup({
|
||||||
cmd = {omnisharp_bin, "--languageserver", "--hostPID", tostring(pid)},
|
cmd = { omnisharp_bin, "--languageserver", "--hostPID", tostring(pid) },
|
||||||
on_attach = common_config.on_attach,
|
on_attach = common_config.on_attach,
|
||||||
capabilities = capabilities
|
capabilities = capabilities,
|
||||||
}
|
})
|
||||||
|
|
||||||
-- Leminx (XML Language server)
|
-- Leminx (XML Language server)
|
||||||
lspconfig.lemminx.setup {
|
lspconfig.lemminx.setup({
|
||||||
cmd = {"lemminx"},
|
cmd = { "lemminx" },
|
||||||
on_attach = common_config.on_attach,
|
on_attach = common_config.on_attach,
|
||||||
capabilities = capabilities
|
capabilities = capabilities,
|
||||||
}
|
})
|
||||||
|
|
|
@ -3,30 +3,30 @@
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
|
|
||||||
local function get_vim_rest_home_dir()
|
local function get_vim_rest_home_dir()
|
||||||
vim.fn.mkdir(vim.env.NVIMHOME .. "/vim-rest-console", "p")
|
vim.fn.mkdir(vim.env.NVIMHOME .. "/vim-rest-console", "p")
|
||||||
return vim.env.NVIMHOME .. "/vim-rest-console"
|
return vim.env.NVIMHOME .. "/vim-rest-console"
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Opens up a new tab if current buffer is not empty
|
-- Opens up a new tab if current buffer is not empty
|
||||||
local function new_tab_if_needed()
|
local function new_tab_if_needed()
|
||||||
if vim.api.nvim_buf_get_name("%") ~= "" then
|
if vim.api.nvim_buf_get_name("%") ~= "" then
|
||||||
-- Current buffer is not empty, open up a new tab
|
-- Current buffer is not empty, open up a new tab
|
||||||
vim.cmd("tabnew")
|
vim.cmd("tabnew")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function open_rest_console(file)
|
local function open_rest_console(file)
|
||||||
new_tab_if_needed()
|
new_tab_if_needed()
|
||||||
local ending = ".rest"
|
local ending = ".rest"
|
||||||
if file:sub(-(#ending)) ~= ending then
|
if file:sub(-#ending) ~= ending then
|
||||||
file = file .. ".rest"
|
file = file .. ".rest"
|
||||||
end
|
end
|
||||||
vim.cmd("e " .. file)
|
vim.cmd("e " .. file)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function open_cached_rest_console(name)
|
local function open_cached_rest_console(name)
|
||||||
local dir = get_vim_rest_home_dir()
|
local dir = get_vim_rest_home_dir()
|
||||||
open_rest_console(dir .. "/" .. name)
|
open_rest_console(dir .. "/" .. name)
|
||||||
end
|
end
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
|
@ -37,32 +37,32 @@ local M = {}
|
||||||
|
|
||||||
-- Opens us a scratch rest console (not saved)
|
-- Opens us a scratch rest console (not saved)
|
||||||
function M.open_scratch_rest_console()
|
function M.open_scratch_rest_console()
|
||||||
new_tab_if_needed()
|
new_tab_if_needed()
|
||||||
vim.cmd("set ft=rest")
|
vim.cmd("set ft=rest")
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Opens up a rest console which can be saved -- cached by name
|
-- Opens up a rest console which can be saved -- cached by name
|
||||||
function M.open_cached_rest_console(...)
|
function M.open_cached_rest_console(...)
|
||||||
local name = select(1, ...)
|
local name = select(1, ...)
|
||||||
if (select("#", ...) == 0) then
|
if select("#", ...) == 0 then
|
||||||
name = require "common.projects".get_project_id()
|
name = require("common.projects").get_project_id()
|
||||||
end
|
end
|
||||||
open_cached_rest_console(name)
|
open_cached_rest_console(name)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Opens up a rest console which can be saved -- cached by name
|
-- Opens up a rest console which can be saved -- cached by name
|
||||||
function M.open_named_cached_rest_console(name)
|
function M.open_named_cached_rest_console(name)
|
||||||
name = require "common.projects".get_project_id() .. name
|
name = require("common.projects").get_project_id() .. name
|
||||||
open_cached_rest_console(name)
|
open_cached_rest_console(name)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Opens up a rest console based on local file path
|
-- Opens up a rest console based on local file path
|
||||||
function M.open_local_rest_console(...)
|
function M.open_local_rest_console(...)
|
||||||
local file = select(1, ...)
|
local file = select(1, ...)
|
||||||
if (select("#", ...) == 0) then
|
if select("#", ...) == 0 then
|
||||||
file = "default"
|
file = "default"
|
||||||
end
|
end
|
||||||
open_rest_console(file)
|
open_rest_console(file)
|
||||||
end
|
end
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
|
|
@ -12,69 +12,65 @@ local M = {}
|
||||||
|
|
||||||
-- Gets path to any dir of provided vimwiki (by index)
|
-- Gets path to any dir of provided vimwiki (by index)
|
||||||
function M.get_vimwiki_subdir(vimwiki_index, directory)
|
function M.get_vimwiki_subdir(vimwiki_index, directory)
|
||||||
vimwiki_index = api.normalize_vimwiki_index(vimwiki_index)
|
vimwiki_index = api.normalize_vimwiki_index(vimwiki_index)
|
||||||
local vimwiki = vim.g.vimwiki_list[vimwiki_index]
|
local vimwiki = vim.g.vimwiki_list[vimwiki_index]
|
||||||
|
|
||||||
return vimwiki.path .. directory .. "/"
|
return vimwiki.path .. directory .. "/"
|
||||||
end
|
end
|
||||||
|
|
||||||
function M.get_directory_index(vimwiki_index, directory)
|
function M.get_directory_index(vimwiki_index, directory)
|
||||||
local dir = M.get_vimwiki_subdir(vimwiki_index, directory)
|
local dir = M.get_vimwiki_subdir(vimwiki_index, directory)
|
||||||
local path = Path:new(dir):expand()
|
local path = Path:new(dir):expand()
|
||||||
|
|
||||||
local entries =
|
local entries = scandir.scan_dir(path, {
|
||||||
scandir.scan_dir(
|
hidden = false,
|
||||||
path,
|
add_dirs = false,
|
||||||
{
|
respect_gitignore = true,
|
||||||
hidden = false,
|
depth = 1,
|
||||||
add_dirs = false,
|
})
|
||||||
respect_gitignore = true,
|
|
||||||
depth = 1
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
local index = {}
|
local index = {}
|
||||||
|
|
||||||
for _, entry in pairs(entries) do
|
for _, entry in pairs(entries) do
|
||||||
local filename = utils.get_filename_from_path(entry)
|
local filename = utils.get_filename_from_path(entry)
|
||||||
local ext = api.get_vimwiki_extension(vimwiki_index)
|
local ext = api.get_vimwiki_extension(vimwiki_index)
|
||||||
local noext = string.gsub(filename, ext, "")
|
local noext = string.gsub(filename, ext, "")
|
||||||
|
|
||||||
index[noext] = filename
|
index[noext] = filename
|
||||||
end
|
end
|
||||||
|
|
||||||
table.sort(index)
|
table.sort(index)
|
||||||
return index
|
return index
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Open subdirectory index file
|
-- Open subdirectory index file
|
||||||
function M.open_subdirectory_index_file(vimwiki_index, subdirectory)
|
function M.open_subdirectory_index_file(vimwiki_index, subdirectory)
|
||||||
local dir = M.get_vimwiki_subdir(vimwiki_index, subdirectory)
|
local dir = M.get_vimwiki_subdir(vimwiki_index, subdirectory)
|
||||||
local ext = api.get_vimwiki_extension(vimwiki_index)
|
local ext = api.get_vimwiki_extension(vimwiki_index)
|
||||||
local filename = dir .. "index" .. ext
|
local filename = dir .. "index" .. ext
|
||||||
vim.cmd("edit " .. filename)
|
vim.cmd("edit " .. filename)
|
||||||
|
|
||||||
local index = M.get_directory_index(vimwiki_index, subdirectory)
|
local index = M.get_directory_index(vimwiki_index, subdirectory)
|
||||||
|
|
||||||
local builder = templates.for_vimwiki(vimwiki_index)
|
local builder = templates.for_vimwiki(vimwiki_index)
|
||||||
|
|
||||||
local lines = {
|
local lines = {
|
||||||
builder.header(1, subdirectory:sub(1, 1):upper() .. subdirectory:sub(2)),
|
builder.header(1, subdirectory:sub(1, 1):upper() .. subdirectory:sub(2)),
|
||||||
""
|
"",
|
||||||
}
|
}
|
||||||
|
|
||||||
-- Add items
|
-- Add items
|
||||||
for title, fname in pairs(index) do
|
for title, fname in pairs(index) do
|
||||||
if (title ~= "index") then
|
if title ~= "index" then
|
||||||
title = string.gsub(title, "-", " ")
|
title = string.gsub(title, "-", " ")
|
||||||
title = title:sub(1, 1):upper() .. title:sub(2)
|
title = title:sub(1, 1):upper() .. title:sub(2)
|
||||||
table.insert(lines, builder.list_item(builder.link(fname, title)))
|
table.insert(lines, builder.list_item(builder.link(fname, title)))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local buf = vim.api.nvim_get_current_buf()
|
local buf = vim.api.nvim_get_current_buf()
|
||||||
vim.api.nvim_buf_set_lines(buf, 0, -1, false, {}) -- Clear out
|
vim.api.nvim_buf_set_lines(buf, 0, -1, false, {}) -- Clear out
|
||||||
vim.api.nvim_buf_set_lines(buf, 0, -1, false, lines) -- Put new contents
|
vim.api.nvim_buf_set_lines(buf, 0, -1, false, lines) -- Put new contents
|
||||||
end
|
end
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
|
|
@ -4,40 +4,21 @@
|
||||||
|
|
||||||
local dap = require("dap")
|
local dap = require("dap")
|
||||||
|
|
||||||
vim.api.nvim_create_autocmd(
|
vim.api.nvim_create_autocmd("FileType", {
|
||||||
"FileType",
|
pattern = "dap-repl",
|
||||||
{
|
callback = function(args)
|
||||||
pattern = "dap-repl",
|
require("dap.ext.autocompl").attach()
|
||||||
callback = function(args)
|
end,
|
||||||
require("dap.ext.autocompl").attach()
|
})
|
||||||
end
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
-- Nvim DAP Treesitter integration
|
-- Nvim DAP Treesitter integration
|
||||||
require("nvim-dap-virtual-text").setup()
|
require("nvim-dap-virtual-text").setup()
|
||||||
|
|
||||||
-- Keymaps
|
-- Keymaps
|
||||||
vim.keymap.set(
|
vim.keymap.set("n", "<leader>db", dap.toggle_breakpoint)
|
||||||
"n",
|
vim.keymap.set("n", "<leader>dc", dap.continue)
|
||||||
"<leader>db",
|
vim.keymap.set("n", "<leader>dso", dap.step_over)
|
||||||
dap.toggle_breakpoint
|
vim.keymap.set("n", "<leader>dsi", dap.step_into)
|
||||||
)
|
|
||||||
vim.keymap.set(
|
|
||||||
"n",
|
|
||||||
"<leader>dc",
|
|
||||||
dap.continue
|
|
||||||
)
|
|
||||||
vim.keymap.set(
|
|
||||||
"n",
|
|
||||||
"<leader>dso",
|
|
||||||
dap.step_over
|
|
||||||
)
|
|
||||||
vim.keymap.set(
|
|
||||||
"n",
|
|
||||||
"<leader>dsi",
|
|
||||||
dap.step_into
|
|
||||||
)
|
|
||||||
|
|
||||||
-- Nvim DAP UI
|
-- Nvim DAP UI
|
||||||
local dapui = require("dapui")
|
local dapui = require("dapui")
|
||||||
|
@ -47,111 +28,107 @@ dapui.setup()
|
||||||
local api = vim.api
|
local api = vim.api
|
||||||
local keymap_restore = {}
|
local keymap_restore = {}
|
||||||
dap.listeners.after["event_initialized"]["me"] = function()
|
dap.listeners.after["event_initialized"]["me"] = function()
|
||||||
for _, buf in pairs(api.nvim_list_bufs()) do
|
for _, buf in pairs(api.nvim_list_bufs()) do
|
||||||
local keymaps = api.nvim_buf_get_keymap(buf, "n")
|
local keymaps = api.nvim_buf_get_keymap(buf, "n")
|
||||||
for _, keymap in pairs(keymaps) do
|
for _, keymap in pairs(keymaps) do
|
||||||
if keymap.lhs == "K" then
|
if keymap.lhs == "K" then
|
||||||
table.insert(keymap_restore, keymap)
|
table.insert(keymap_restore, keymap)
|
||||||
vim.keymap.del("n", "K", {buffer = buf})
|
vim.keymap.del("n", "K", { buffer = buf })
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
vim.keymap.set(
|
vim.keymap.set({ "n", "v" }, "K", function()
|
||||||
{"n", "v"},
|
dapui.eval()
|
||||||
"K",
|
end)
|
||||||
function()
|
|
||||||
dapui.eval()
|
|
||||||
end
|
|
||||||
)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
dap.listeners.after["event_terminated"]["me"] = function()
|
dap.listeners.after["event_terminated"]["me"] = function()
|
||||||
for _, keymap in pairs(keymap_restore) do
|
for _, keymap in pairs(keymap_restore) do
|
||||||
vim.keymap.set(keymap.mode, keymap.lhs, keymap.rhs, {silent = keymap.silent == 1, buffer = keymap.buffer})
|
vim.keymap.set(keymap.mode, keymap.lhs, keymap.rhs, { silent = keymap.silent == 1, buffer = keymap.buffer })
|
||||||
end
|
end
|
||||||
keymap_restore = {}
|
keymap_restore = {}
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Additional servers
|
-- Additional servers
|
||||||
dap.adapters.lldb = {
|
dap.adapters.lldb = {
|
||||||
type = "executable",
|
type = "executable",
|
||||||
command = "lldb-vscode",
|
command = "lldb-vscode",
|
||||||
name = "lldb"
|
name = "lldb",
|
||||||
}
|
}
|
||||||
|
|
||||||
dap.configurations.cpp = {
|
dap.configurations.cpp = {
|
||||||
{
|
{
|
||||||
name = "Launch",
|
name = "Launch",
|
||||||
type = "lldb",
|
type = "lldb",
|
||||||
request = "launch",
|
request = "launch",
|
||||||
program = function()
|
program = function()
|
||||||
return vim.fn.input("Path to executable: ", vim.fn.getcwd() .. "/", "file")
|
return vim.fn.input("Path to executable: ", vim.fn.getcwd() .. "/", "file")
|
||||||
end,
|
end,
|
||||||
cwd = "${workspaceFolder}",
|
cwd = "${workspaceFolder}",
|
||||||
stopOnEntry = false,
|
stopOnEntry = false,
|
||||||
args = {},
|
args = {},
|
||||||
-- 💀
|
-- 💀
|
||||||
-- if you change `runInTerminal` to true, you might need to change the yama/ptrace_scope setting:
|
-- if you change `runInTerminal` to true, you might need to change the yama/ptrace_scope setting:
|
||||||
--
|
--
|
||||||
-- echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope
|
-- echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope
|
||||||
--
|
--
|
||||||
-- Otherwise you might get the following error:
|
-- Otherwise you might get the following error:
|
||||||
--
|
--
|
||||||
-- Error on launch: Failed to attach to the target process
|
-- Error on launch: Failed to attach to the target process
|
||||||
--
|
--
|
||||||
-- But you should be aware of the implications:
|
-- But you should be aware of the implications:
|
||||||
-- https://www.kernel.org/doc/html/latest/admin-guide/LSM/Yama.html
|
-- https://www.kernel.org/doc/html/latest/admin-guide/LSM/Yama.html
|
||||||
|
|
||||||
runInTerminal = false,
|
runInTerminal = false,
|
||||||
-- 💀
|
-- 💀
|
||||||
-- If you use `runInTerminal = true` and resize the terminal window,
|
-- If you use `runInTerminal = true` and resize the terminal window,
|
||||||
-- lldb-vscode will receive a `SIGWINCH` signal which can cause problems
|
-- lldb-vscode will receive a `SIGWINCH` signal which can cause problems
|
||||||
-- To avoid that uncomment the following option
|
-- To avoid that uncomment the following option
|
||||||
-- See https://github.com/mfussenegger/nvim-dap/issues/236#issuecomment-1066306073
|
-- See https://github.com/mfussenegger/nvim-dap/issues/236#issuecomment-1066306073
|
||||||
postRunCommands = {"process handle -p true -s false -n false SIGWINCH"}
|
postRunCommands = { "process handle -p true -s false -n false SIGWINCH" },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name = "Launch with args",
|
name = "Launch with args",
|
||||||
type = "lldb",
|
type = "lldb",
|
||||||
request = "launch",
|
request = "launch",
|
||||||
program = function()
|
program = function()
|
||||||
return vim.fn.input("Path to executable: ", vim.fn.getcwd() .. "/", "file")
|
return vim.fn.input("Path to executable: ", vim.fn.getcwd() .. "/", "file")
|
||||||
end,
|
end,
|
||||||
cwd = "${workspaceFolder}",
|
cwd = "${workspaceFolder}",
|
||||||
stopOnEntry = false,
|
stopOnEntry = false,
|
||||||
args = function()
|
args = function()
|
||||||
return vim.split(vim.fn.input("Args: "), " ")
|
return vim.split(vim.fn.input("Args: "), " ")
|
||||||
end,
|
end,
|
||||||
runInTerminal = false,
|
runInTerminal = false,
|
||||||
postRunCommands = {"process handle -p true -s false -n false SIGWINCH"}
|
postRunCommands = { "process handle -p true -s false -n false SIGWINCH" },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name = "Attach to process",
|
name = "Attach to process",
|
||||||
type = "lldb",
|
type = "lldb",
|
||||||
request = "attach",
|
request = "attach",
|
||||||
pid = require("dap.utils").pick_process,
|
pid = require("dap.utils").pick_process,
|
||||||
args = {}
|
args = {},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name = "Attach to PID",
|
name = "Attach to PID",
|
||||||
type = "lldb",
|
type = "lldb",
|
||||||
request = "attach",
|
request = "attach",
|
||||||
pid = function()
|
pid = function()
|
||||||
return tonumber(vim.fn.input("PID: "))
|
return tonumber(vim.fn.input("PID: "))
|
||||||
end,
|
end,
|
||||||
args = {}
|
args = {},
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
dap.configurations.c = dap.configurations.cpp
|
dap.configurations.c = dap.configurations.cpp
|
||||||
dap.configurations.rust = dap.configurations.cpp
|
dap.configurations.rust = dap.configurations.cpp
|
||||||
|
|
||||||
dap.listeners.after.event_initialized["dapui_config"] = function()
|
dap.listeners.after.event_initialized["dapui_config"] = function()
|
||||||
dapui.open()
|
dapui.open()
|
||||||
end
|
end
|
||||||
dap.listeners.before.event_terminated["dapui_config"] = function()
|
dap.listeners.before.event_terminated["dapui_config"] = function()
|
||||||
dapui.close()
|
dapui.close()
|
||||||
end
|
end
|
||||||
dap.listeners.before.event_exited["dapui_config"] = function()
|
dap.listeners.before.event_exited["dapui_config"] = function()
|
||||||
dapui.close()
|
dapui.close()
|
||||||
end
|
end
|
||||||
|
|
|
@ -2,15 +2,15 @@
|
||||||
-- - Fugitive.vim setup and extra commands -
|
-- - Fugitive.vim setup and extra commands -
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
|
|
||||||
vim.cmd [[command! -nargs=0 Ggpush :lua require('fugitive_extensions').push_origin()]]
|
vim.cmd([[command! -nargs=0 Ggpush :lua require('fugitive_extensions').push_origin()]])
|
||||||
vim.cmd [[command! -nargs=0 Ggpull :lua require('fugitive_extensions').pull_origin()]]
|
vim.cmd([[command! -nargs=0 Ggpull :lua require('fugitive_extensions').pull_origin()]])
|
||||||
vim.cmd [[command! -nargs=? Gpropen :lua require('fugitive_extensions').open_new_pr(<f-args>)]]
|
vim.cmd([[command! -nargs=? Gpropen :lua require('fugitive_extensions').open_new_pr(<f-args>)]])
|
||||||
vim.cmd [[command! -nargs=? Gpr Gpropen <args>]]
|
vim.cmd([[command! -nargs=? Gpr Gpropen <args>]])
|
||||||
vim.cmd [[command! -nargs=? Gprprint :lua require('fugitive_extensions').print_pr_url(<f-args>)]]
|
vim.cmd([[command! -nargs=? Gprprint :lua require('fugitive_extensions').print_pr_url(<f-args>)]])
|
||||||
vim.cmd [[command! -nargs=? Gprcopy :lua require('fugitive_extensions').copy_pr_url(<f-args>)]]
|
vim.cmd([[command! -nargs=? Gprcopy :lua require('fugitive_extensions').copy_pr_url(<f-args>)]])
|
||||||
vim.cmd [[command! -nargs=1 Gcbranch :lua require('fugitive_extensions').create_branch(<f-args>)]]
|
vim.cmd([[command! -nargs=1 Gcbranch :lua require('fugitive_extensions').create_branch(<f-args>)]])
|
||||||
vim.cmd [[command! -nargs=0 Gcmaster :lua require('fugitive_extensions').checkout_branch('main')]]
|
vim.cmd([[command! -nargs=0 Gcmaster :lua require('fugitive_extensions').checkout_branch('main')]])
|
||||||
vim.cmd [[command! -nargs=0 Gcm Gcmaster]]
|
vim.cmd([[command! -nargs=0 Gcm Gcmaster]])
|
||||||
vim.cmd [[command! -nargs=0 Gcdev :lua require('fugitive_extensions').checkout_branch('develop')]]
|
vim.cmd([[command! -nargs=0 Gcdev :lua require('fugitive_extensions').checkout_branch('develop')]])
|
||||||
vim.cmd [[command! -nargs=1 Gcheckout :lua require('fugitive_extensions').checkout_branch(<f-args>)]]
|
vim.cmd([[command! -nargs=1 Gcheckout :lua require('fugitive_extensions').checkout_branch(<f-args>)]])
|
||||||
vim.cmd [[command! -nargs=1 Gc Gcheckout <args>]]
|
vim.cmd([[command! -nargs=1 Gc Gcheckout <args>]])
|
||||||
|
|
|
@ -1,40 +1,52 @@
|
||||||
require('gitsigns').setup {
|
require("gitsigns").setup({
|
||||||
on_attach = function(bufnr)
|
on_attach = function(bufnr)
|
||||||
local gs = package.loaded.gitsigns
|
local gs = package.loaded.gitsigns
|
||||||
|
|
||||||
local function map(mode, l, r, opts)
|
local function map(mode, l, r, opts)
|
||||||
opts = opts or {}
|
opts = opts or {}
|
||||||
opts.buffer = bufnr
|
opts.buffer = bufnr
|
||||||
vim.keymap.set(mode, l, r, opts)
|
vim.keymap.set(mode, l, r, opts)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Navigation
|
-- Navigation
|
||||||
map('n', ']c', function()
|
map("n", "]c", function()
|
||||||
if vim.wo.diff then return ']c' end
|
if vim.wo.diff then
|
||||||
vim.schedule(function() gs.next_hunk() end)
|
return "]c"
|
||||||
return '<Ignore>'
|
end
|
||||||
end, {expr=true})
|
vim.schedule(function()
|
||||||
|
gs.next_hunk()
|
||||||
|
end)
|
||||||
|
return "<Ignore>"
|
||||||
|
end, { expr = true })
|
||||||
|
|
||||||
map('n', '[c', function()
|
map("n", "[c", function()
|
||||||
if vim.wo.diff then return '[c' end
|
if vim.wo.diff then
|
||||||
vim.schedule(function() gs.prev_hunk() end)
|
return "[c"
|
||||||
return '<Ignore>'
|
end
|
||||||
end, {expr=true})
|
vim.schedule(function()
|
||||||
|
gs.prev_hunk()
|
||||||
|
end)
|
||||||
|
return "<Ignore>"
|
||||||
|
end, { expr = true })
|
||||||
|
|
||||||
-- Actions
|
-- Actions
|
||||||
map({'n', 'v'}, '<leader>hs', ':Gitsigns stage_hunk<CR>')
|
map({ "n", "v" }, "<leader>hs", ":Gitsigns stage_hunk<CR>")
|
||||||
map({'n', 'v'}, '<leader>hr', ':Gitsigns reset_hunk<CR>')
|
map({ "n", "v" }, "<leader>hr", ":Gitsigns reset_hunk<CR>")
|
||||||
map('n', '<leader>hS', gs.stage_buffer)
|
map("n", "<leader>hS", gs.stage_buffer)
|
||||||
map('n', '<leader>hu', gs.undo_stage_hunk)
|
map("n", "<leader>hu", gs.undo_stage_hunk)
|
||||||
map('n', '<leader>hR', gs.reset_buffer)
|
map("n", "<leader>hR", gs.reset_buffer)
|
||||||
map('n', '<leader>hp', gs.preview_hunk)
|
map("n", "<leader>hp", gs.preview_hunk)
|
||||||
map('n', '<leader>hb', function() gs.blame_line{full=true} end)
|
map("n", "<leader>hb", function()
|
||||||
map('n', '<leader>tb', gs.toggle_current_line_blame)
|
gs.blame_line({ full = true })
|
||||||
map('n', '<leader>hd', gs.diffthis)
|
end)
|
||||||
map('n', '<leader>hD', function() gs.diffthis('~') end)
|
map("n", "<leader>tb", gs.toggle_current_line_blame)
|
||||||
map('n', '<leader>td', gs.toggle_deleted)
|
map("n", "<leader>hd", gs.diffthis)
|
||||||
|
map("n", "<leader>hD", function()
|
||||||
|
gs.diffthis("~")
|
||||||
|
end)
|
||||||
|
map("n", "<leader>td", gs.toggle_deleted)
|
||||||
|
|
||||||
-- Text object
|
-- Text object
|
||||||
map({'o', 'x'}, 'ih', ':<C-U>Gitsigns select_hunk<CR>')
|
map({ "o", "x" }, "ih", ":<C-U>Gitsigns select_hunk<CR>")
|
||||||
end
|
end,
|
||||||
}
|
})
|
||||||
|
|
|
@ -2,4 +2,6 @@
|
||||||
-- - Local vimrc commands -
|
-- - Local vimrc commands -
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
|
|
||||||
vim.api.nvim_create_user_command("EditLocalVimrc", function(_) require"direnv_vimrc_local".open_local_vimrc() end, { nargs = 0 })
|
vim.api.nvim_create_user_command("EditLocalVimrc", function(_)
|
||||||
|
require("direnv_vimrc_local").open_local_vimrc()
|
||||||
|
end, { nargs = 0 })
|
||||||
|
|
|
@ -1,481 +1,481 @@
|
||||||
local vim_readme_template = {
|
local vim_readme_template = {
|
||||||
"# Name",
|
"# Name",
|
||||||
"",
|
"",
|
||||||
"## Requirements",
|
"## Requirements",
|
||||||
"",
|
"",
|
||||||
"## Installation",
|
"## Installation",
|
||||||
"",
|
"",
|
||||||
"## Usage",
|
"## Usage",
|
||||||
"",
|
"",
|
||||||
"### Commands",
|
"### Commands",
|
||||||
"",
|
"",
|
||||||
"### Keymaps",
|
"### Keymaps",
|
||||||
"",
|
"",
|
||||||
"## License",
|
"## License",
|
||||||
"",
|
"",
|
||||||
"[LICENSE NAME](LICENSE)"
|
"[LICENSE NAME](LICENSE)",
|
||||||
}
|
}
|
||||||
|
|
||||||
local vim_doc_template = {
|
local vim_doc_template = {
|
||||||
"*{}.txt* Description",
|
"*{}.txt* Description",
|
||||||
"",
|
"",
|
||||||
"INTRODUCTION *{}*",
|
"INTRODUCTION *{}*",
|
||||||
"",
|
"",
|
||||||
"Description",
|
"Description",
|
||||||
"",
|
"",
|
||||||
"CONTENTS *{}-contents*",
|
"CONTENTS *{}-contents*",
|
||||||
"",
|
"",
|
||||||
" 1. Overview |{}-overview|",
|
" 1. Overview |{}-overview|",
|
||||||
" 2. Requirements |{}-requirements|",
|
" 2. Requirements |{}-requirements|",
|
||||||
" 3. Installation |{}-installation|",
|
" 3. Installation |{}-installation|",
|
||||||
" 4. Usage |{}-usage|",
|
" 4. Usage |{}-usage|",
|
||||||
" 5. Commands |{}-commands|",
|
" 5. Commands |{}-commands|",
|
||||||
" 6. Functions |{}-functions|",
|
" 6. Functions |{}-functions|",
|
||||||
" 7. Mappings |{}-mappings|",
|
" 7. Mappings |{}-mappings|",
|
||||||
" 8. Plugs |{}-plugs|",
|
" 8. Plugs |{}-plugs|",
|
||||||
" 9. Options |{}-options|",
|
" 9. Options |{}-options|",
|
||||||
" 10. Issues |{}-issues|",
|
" 10. Issues |{}-issues|",
|
||||||
" 11. Contributing |{}-contributing|",
|
" 11. Contributing |{}-contributing|",
|
||||||
" 12. Version |{}-version|",
|
" 12. Version |{}-version|",
|
||||||
" 13. License |{}-license|",
|
" 13. License |{}-license|",
|
||||||
"",
|
"",
|
||||||
"OVERVIEW *{}-overview*",
|
"OVERVIEW *{}-overview*",
|
||||||
"",
|
"",
|
||||||
"REQUIREMENTS *{}-requirements*",
|
"REQUIREMENTS *{}-requirements*",
|
||||||
"",
|
"",
|
||||||
"INSTALLATION *{}-installation*",
|
"INSTALLATION *{}-installation*",
|
||||||
"",
|
"",
|
||||||
" 1. Plug <https://github.com/junegunn/vim-plug>",
|
" 1. Plug <https://github.com/junegunn/vim-plug>",
|
||||||
"",
|
"",
|
||||||
" Add the following to your vimrc, or something sourced therein: >",
|
" Add the following to your vimrc, or something sourced therein: >",
|
||||||
"",
|
"",
|
||||||
" Plug 'esensar/{}'",
|
" Plug 'esensar/{}'",
|
||||||
"<",
|
"<",
|
||||||
" Then install via `:PlugInstall`",
|
" Then install via `:PlugInstall`",
|
||||||
"",
|
"",
|
||||||
" 2. Pathogen <https://github.com/tpope/vim-pathogen> >",
|
" 2. Pathogen <https://github.com/tpope/vim-pathogen> >",
|
||||||
"",
|
"",
|
||||||
" cd ~/.vim/bundle",
|
" cd ~/.vim/bundle",
|
||||||
" git clone https://github.com/esensar/{}.git",
|
" git clone https://github.com/esensar/{}.git",
|
||||||
"<",
|
"<",
|
||||||
" Then run `:Helptags`",
|
" Then run `:Helptags`",
|
||||||
"",
|
"",
|
||||||
" 3. Manual",
|
" 3. Manual",
|
||||||
"",
|
"",
|
||||||
" Clone this repository and copy the files in plugin/, autoload/, and doc/",
|
" Clone this repository and copy the files in plugin/, autoload/, and doc/",
|
||||||
" to their respective directories in your vimfiles, or copy the text from",
|
" to their respective directories in your vimfiles, or copy the text from",
|
||||||
" the github repository into new files in those directories. Make sure to",
|
" the github repository into new files in those directories. Make sure to",
|
||||||
" run `:helptags`.",
|
" run `:helptags`.",
|
||||||
"",
|
"",
|
||||||
"USAGE *{}-usage*",
|
"USAGE *{}-usage*",
|
||||||
"",
|
"",
|
||||||
"COMMANDS *{}-commands*",
|
"COMMANDS *{}-commands*",
|
||||||
"",
|
"",
|
||||||
"FUNCTIONS *{}-functions*",
|
"FUNCTIONS *{}-functions*",
|
||||||
"",
|
"",
|
||||||
"MAPPINGS *{}-mappings*",
|
"MAPPINGS *{}-mappings*",
|
||||||
"",
|
"",
|
||||||
"PLUGS *{}-plugs*",
|
"PLUGS *{}-plugs*",
|
||||||
"",
|
"",
|
||||||
"OPTIONS *{}-options*",
|
"OPTIONS *{}-options*",
|
||||||
"",
|
"",
|
||||||
"ISSUES *{}-issues*",
|
"ISSUES *{}-issues*",
|
||||||
"",
|
"",
|
||||||
"If you experience issues using {}, please report them at",
|
"If you experience issues using {}, please report them at",
|
||||||
"<https://github.com/esensar/{}/issues>.",
|
"<https://github.com/esensar/{}/issues>.",
|
||||||
"",
|
"",
|
||||||
"CONTRIBUTING *{}-contributing*",
|
"CONTRIBUTING *{}-contributing*",
|
||||||
"",
|
"",
|
||||||
"Feel free to look at already reported issues at ",
|
"Feel free to look at already reported issues at ",
|
||||||
"<https://github.com/esensar/{}/issues>.",
|
"<https://github.com/esensar/{}/issues>.",
|
||||||
"If available, check out CONTRIBUTING.md in the repository.",
|
"If available, check out CONTRIBUTING.md in the repository.",
|
||||||
"Otherwise, feel free to create a new issue or pull request.",
|
"Otherwise, feel free to create a new issue or pull request.",
|
||||||
"",
|
"",
|
||||||
"VERSION *{}-version*",
|
"VERSION *{}-version*",
|
||||||
"",
|
"",
|
||||||
"Version 1.0.0",
|
"Version 1.0.0",
|
||||||
"",
|
"",
|
||||||
"LICENSE *{}-license*",
|
"LICENSE *{}-license*",
|
||||||
"",
|
"",
|
||||||
"vim:tw=78:ts=2:ft=help:norl:"
|
"vim:tw=78:ts=2:ft=help:norl:",
|
||||||
}
|
}
|
||||||
|
|
||||||
local flutter_config = {
|
local flutter_config = {
|
||||||
["*"] = {
|
["*"] = {
|
||||||
start = "flutter run"
|
start = "flutter run",
|
||||||
},
|
},
|
||||||
["lib/*.dart"] = {
|
["lib/*.dart"] = {
|
||||||
alternate = "test/{}_test.dart",
|
alternate = "test/{}_test.dart",
|
||||||
type = "source"
|
type = "source",
|
||||||
},
|
},
|
||||||
["test/*_test.dart"] = {
|
["test/*_test.dart"] = {
|
||||||
alternate = "lib/{}.dart",
|
alternate = "lib/{}.dart",
|
||||||
type = "test",
|
type = "test",
|
||||||
template = {
|
template = {
|
||||||
"import 'package:flutter_test/flutter_test.dart';",
|
"import 'package:flutter_test/flutter_test.dart';",
|
||||||
"",
|
"",
|
||||||
"import 'package:flutter_template/{}.dart';",
|
"import 'package:flutter_template/{}.dart';",
|
||||||
"",
|
"",
|
||||||
"void main() {",
|
"void main() {",
|
||||||
" testWidgets('', (WidgetTester tester) async {",
|
" testWidgets('', (WidgetTester tester) async {",
|
||||||
" });",
|
" });",
|
||||||
"}"
|
"}",
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
local python_config = {
|
local python_config = {
|
||||||
["*.py"] = {
|
["*.py"] = {
|
||||||
alternate = "tests/{dirname}/test_{basename}.py",
|
alternate = "tests/{dirname}/test_{basename}.py",
|
||||||
type = "source"
|
type = "source",
|
||||||
},
|
},
|
||||||
["tests/**/test_*.py"] = {
|
["tests/**/test_*.py"] = {
|
||||||
alternate = "{dirname}/{basename}.py",
|
alternate = "{dirname}/{basename}.py",
|
||||||
type = "test",
|
type = "test",
|
||||||
template = {
|
template = {
|
||||||
"import unittest",
|
"import unittest",
|
||||||
"from unittest import mock",
|
"from unittest import mock",
|
||||||
"",
|
"",
|
||||||
"class {dirname|underscore|camelcase|capitalize}{basename|camelcase|capitalize}Test(unittest.TestCase):",
|
"class {dirname|underscore|camelcase|capitalize}{basename|camelcase|capitalize}Test(unittest.TestCase):",
|
||||||
" pass",
|
" pass",
|
||||||
"",
|
"",
|
||||||
"",
|
"",
|
||||||
'if __name__ == "__main__":',
|
'if __name__ == "__main__":',
|
||||||
" unittest.main()"
|
" unittest.main()",
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
local dotnet_solution_config = {
|
local dotnet_solution_config = {
|
||||||
["src/**/Controllers/*.cs"] = {
|
["src/**/Controllers/*.cs"] = {
|
||||||
type = "controller",
|
type = "controller",
|
||||||
alternate = {
|
alternate = {
|
||||||
"tests/{dirname}.Tests/Controllers/{basename}Tests.cs",
|
"tests/{dirname}.Tests/Controllers/{basename}Tests.cs",
|
||||||
"tests/{dirname}.IntegrationTests/Controllers/{basename}Tests.cs"
|
"tests/{dirname}.IntegrationTests/Controllers/{basename}Tests.cs",
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
["src/**/Models/*.cs"] = {
|
["src/**/Models/*.cs"] = {
|
||||||
type = "model",
|
type = "model",
|
||||||
alternate = "tests/{dirname}.Tests/Models/{basename}Tests.cs"
|
alternate = "tests/{dirname}.Tests/Models/{basename}Tests.cs",
|
||||||
},
|
},
|
||||||
["src/**/Views/*.cshtml"] = {
|
["src/**/Views/*.cshtml"] = {
|
||||||
type = "view",
|
type = "view",
|
||||||
alternate = "tests/{dirname}.Tests/Views/{basename}Tests.cs"
|
alternate = "tests/{dirname}.Tests/Views/{basename}Tests.cs",
|
||||||
},
|
},
|
||||||
["src/**/Services/*.cs"] = {
|
["src/**/Services/*.cs"] = {
|
||||||
type = "service",
|
type = "service",
|
||||||
alternate = "tests/{dirname}.Tests/Services/{basename}Tests.cs"
|
alternate = "tests/{dirname}.Tests/Services/{basename}Tests.cs",
|
||||||
},
|
},
|
||||||
["src/**/Extensions/*.cs"] = {
|
["src/**/Extensions/*.cs"] = {
|
||||||
type = "extension",
|
type = "extension",
|
||||||
alternate = "tests/{dirname}.Tests/Extensions/{basename}Tests.cs"
|
alternate = "tests/{dirname}.Tests/Extensions/{basename}Tests.cs",
|
||||||
},
|
},
|
||||||
["*.csproj"] = {
|
["*.csproj"] = {
|
||||||
type = "project"
|
type = "project",
|
||||||
},
|
},
|
||||||
["src/**/appsettings*json"] = {
|
["src/**/appsettings*json"] = {
|
||||||
type = "appsettings"
|
type = "appsettings",
|
||||||
},
|
},
|
||||||
["src/*.cs"] = {
|
["src/*.cs"] = {
|
||||||
type = "source",
|
type = "source",
|
||||||
alternate = "tests/{dirname}.Tests/{basename}Tests.cs",
|
alternate = "tests/{dirname}.Tests/{basename}Tests.cs",
|
||||||
template = {
|
template = {
|
||||||
"using System;",
|
"using System;",
|
||||||
"",
|
"",
|
||||||
"namespace {dirname|dot}",
|
"namespace {dirname|dot}",
|
||||||
"{",
|
"{",
|
||||||
" public class {basename}",
|
" public class {basename}",
|
||||||
" {",
|
" {",
|
||||||
" }",
|
" }",
|
||||||
"}"
|
"}",
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
["tests/**.IntegrationTests/Controllers/*Tests.cs"] = {
|
["tests/**.IntegrationTests/Controllers/*Tests.cs"] = {
|
||||||
type = "test",
|
type = "test",
|
||||||
alternate = "src/{dirname}/Controllers/{basename}.cs"
|
alternate = "src/{dirname}/Controllers/{basename}.cs",
|
||||||
},
|
},
|
||||||
["tests/**.Tests/Controllers/*Tests.cs"] = {
|
["tests/**.Tests/Controllers/*Tests.cs"] = {
|
||||||
type = "test",
|
type = "test",
|
||||||
alternate = "src/{dirname}/Controllers/{basename}.cs"
|
alternate = "src/{dirname}/Controllers/{basename}.cs",
|
||||||
},
|
},
|
||||||
["tests/**.Tests/Views/*Tests.cs"] = {
|
["tests/**.Tests/Views/*Tests.cs"] = {
|
||||||
type = "test",
|
type = "test",
|
||||||
alternate = "src/{dirname}/Views/{basename}.cs"
|
alternate = "src/{dirname}/Views/{basename}.cs",
|
||||||
},
|
},
|
||||||
["tests/**.Tests/Models/*Tests.cs"] = {
|
["tests/**.Tests/Models/*Tests.cs"] = {
|
||||||
type = "test",
|
type = "test",
|
||||||
alternate = "src/{dirname}/Models/{basename}.cs"
|
alternate = "src/{dirname}/Models/{basename}.cs",
|
||||||
},
|
},
|
||||||
["tests/**.Tests/Services/*Tests.cs"] = {
|
["tests/**.Tests/Services/*Tests.cs"] = {
|
||||||
type = "test",
|
type = "test",
|
||||||
alternate = "src/{dirname}/Services/{basename}.cs"
|
alternate = "src/{dirname}/Services/{basename}.cs",
|
||||||
},
|
},
|
||||||
["tests/**.Tests/Extensions/*Tests.cs"] = {
|
["tests/**.Tests/Extensions/*Tests.cs"] = {
|
||||||
type = "test",
|
type = "test",
|
||||||
alternate = "src/{dirname}/Extensions/{basename}.cs"
|
alternate = "src/{dirname}/Extensions/{basename}.cs",
|
||||||
},
|
},
|
||||||
["tests/*Tests.cs"] = {
|
["tests/*Tests.cs"] = {
|
||||||
type = "test",
|
type = "test",
|
||||||
alternate = "src/{dirname}/{basename}.cs",
|
alternate = "src/{dirname}/{basename}.cs",
|
||||||
template = {
|
template = {
|
||||||
"using System;",
|
"using System;",
|
||||||
"",
|
"",
|
||||||
"namespace {dirname|dot}",
|
"namespace {dirname|dot}",
|
||||||
"{",
|
"{",
|
||||||
" public class {basename}Tests",
|
" public class {basename}Tests",
|
||||||
" {",
|
" {",
|
||||||
" }",
|
" }",
|
||||||
"}"
|
"}",
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
local vim_plugin_config = {
|
local vim_plugin_config = {
|
||||||
["doc/*.txt"] = {
|
["doc/*.txt"] = {
|
||||||
type = "help",
|
type = "help",
|
||||||
template = vim_doc_template
|
template = vim_doc_template,
|
||||||
},
|
},
|
||||||
["autoload/*.vim"] = {
|
["autoload/*.vim"] = {
|
||||||
type = "autoload",
|
type = "autoload",
|
||||||
alternate = "test/{}.vader"
|
alternate = "test/{}.vader",
|
||||||
},
|
},
|
||||||
["test/*.vader"] = {
|
["test/*.vader"] = {
|
||||||
type = "test",
|
type = "test",
|
||||||
altername = "autoload/{}.vim"
|
altername = "autoload/{}.vim",
|
||||||
},
|
},
|
||||||
["plugin/*.vim"] = {
|
["plugin/*.vim"] = {
|
||||||
type = "plugin",
|
type = "plugin",
|
||||||
template = {
|
template = {
|
||||||
'if exists("g:loaded_{}") || &cp | finish | endif',
|
'if exists("g:loaded_{}") || &cp | finish | endif',
|
||||||
"",
|
"",
|
||||||
"let g:loaded_{} = 1"
|
"let g:loaded_{} = 1",
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
["README.md"] = {
|
["README.md"] = {
|
||||||
template = vim_readme_template
|
template = vim_readme_template,
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
local lua_vim_plugin_config = {
|
local lua_vim_plugin_config = {
|
||||||
["doc/*.txt"] = {
|
["doc/*.txt"] = {
|
||||||
type = "help",
|
type = "help",
|
||||||
template = vim_doc_template
|
template = vim_doc_template,
|
||||||
},
|
},
|
||||||
["plugin/*.vim"] = {
|
["plugin/*.vim"] = {
|
||||||
type = "plugin",
|
type = "plugin",
|
||||||
template = {
|
template = {
|
||||||
'if exists("g:loaded_{}") || &cp | finish | endif',
|
'if exists("g:loaded_{}") || &cp | finish | endif',
|
||||||
"",
|
"",
|
||||||
"let g:loaded_{} = 1"
|
"let g:loaded_{} = 1",
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
["lua/*.lua"] = {
|
["lua/*.lua"] = {
|
||||||
type = "source",
|
type = "source",
|
||||||
alternate = "test/{}.lua"
|
alternate = "test/{}.lua",
|
||||||
},
|
},
|
||||||
["test/*.lua"] = {
|
["test/*.lua"] = {
|
||||||
type = "test",
|
type = "test",
|
||||||
alternate = "lua/{}.lua"
|
alternate = "lua/{}.lua",
|
||||||
},
|
},
|
||||||
["README.md"] = {
|
["README.md"] = {
|
||||||
template = vim_readme_template
|
template = vim_readme_template,
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
local csharp_project_config = {
|
local csharp_project_config = {
|
||||||
["*"] = {
|
["*"] = {
|
||||||
start = "dotnet run",
|
start = "dotnet run",
|
||||||
console = "dotnet fsi"
|
console = "dotnet fsi",
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
local java_project_config = {
|
local java_project_config = {
|
||||||
["src/main/java/*.java"] = {
|
["src/main/java/*.java"] = {
|
||||||
type = "source",
|
type = "source",
|
||||||
template = {
|
template = {
|
||||||
"package {dirname|dot};",
|
"package {dirname|dot};",
|
||||||
"",
|
"",
|
||||||
"public class {basename} {open}",
|
"public class {basename} {open}",
|
||||||
"{close}"
|
"{close}",
|
||||||
},
|
},
|
||||||
alternate = "src/test/java/{}Test.java"
|
alternate = "src/test/java/{}Test.java",
|
||||||
},
|
},
|
||||||
["src/test/java/*Test.java"] = {
|
["src/test/java/*Test.java"] = {
|
||||||
type = "test",
|
type = "test",
|
||||||
template = {
|
template = {
|
||||||
"package {dirname|dot};",
|
"package {dirname|dot};",
|
||||||
"",
|
"",
|
||||||
"public class {basename}Test {open}",
|
"public class {basename}Test {open}",
|
||||||
"{close}"
|
"{close}",
|
||||||
},
|
},
|
||||||
alternate = "src/main/java/{}.java"
|
alternate = "src/main/java/{}.java",
|
||||||
},
|
},
|
||||||
["src/main/java/module-info.java"] = {
|
["src/main/java/module-info.java"] = {
|
||||||
type = "moduleinfo"
|
type = "moduleinfo",
|
||||||
},
|
},
|
||||||
["src/main/java/**/package-info.java"] = {
|
["src/main/java/**/package-info.java"] = {
|
||||||
type = "packageinfo"
|
type = "packageinfo",
|
||||||
},
|
},
|
||||||
["src/main/resources/*"] = {
|
["src/main/resources/*"] = {
|
||||||
type = "resource"
|
type = "resource",
|
||||||
},
|
},
|
||||||
["src/test/resources/*"] = {
|
["src/test/resources/*"] = {
|
||||||
type = "testresource"
|
type = "testresource",
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
local kotlin_project_config = {
|
local kotlin_project_config = {
|
||||||
["src/main/kotlin/*.kt"] = {
|
["src/main/kotlin/*.kt"] = {
|
||||||
type = "source",
|
type = "source",
|
||||||
template = {
|
template = {
|
||||||
"package {dirname|dot}",
|
"package {dirname|dot}",
|
||||||
"",
|
"",
|
||||||
"class {basename} {open}",
|
"class {basename} {open}",
|
||||||
"{close}"
|
"{close}",
|
||||||
},
|
},
|
||||||
alternate = "src/test/kotlin/{}Test.kt"
|
alternate = "src/test/kotlin/{}Test.kt",
|
||||||
},
|
},
|
||||||
["src/main/java/*.kt"] = {
|
["src/main/java/*.kt"] = {
|
||||||
type = "source",
|
type = "source",
|
||||||
template = {
|
template = {
|
||||||
"package {dirname|dot}",
|
"package {dirname|dot}",
|
||||||
"",
|
"",
|
||||||
"class {basename} {open}",
|
"class {basename} {open}",
|
||||||
"{close}"
|
"{close}",
|
||||||
},
|
},
|
||||||
alternate = "src/test/java/{}Test.kt"
|
alternate = "src/test/java/{}Test.kt",
|
||||||
},
|
},
|
||||||
["src/test/kotlin/*Test.kt"] = {
|
["src/test/kotlin/*Test.kt"] = {
|
||||||
type = "test",
|
type = "test",
|
||||||
template = {
|
template = {
|
||||||
"package {dirname|dot}",
|
"package {dirname|dot}",
|
||||||
"",
|
"",
|
||||||
"class {basename}Test {open}",
|
"class {basename}Test {open}",
|
||||||
"{close}"
|
"{close}",
|
||||||
},
|
},
|
||||||
alternate = "src/main/kotlin/{}.kt"
|
alternate = "src/main/kotlin/{}.kt",
|
||||||
},
|
},
|
||||||
["src/test/java/*Test.kt"] = {
|
["src/test/java/*Test.kt"] = {
|
||||||
type = "test",
|
type = "test",
|
||||||
template = {
|
template = {
|
||||||
"package {dirname|dot}",
|
"package {dirname|dot}",
|
||||||
"",
|
"",
|
||||||
"class {basename}Test {open}",
|
"class {basename}Test {open}",
|
||||||
"{close}"
|
"{close}",
|
||||||
},
|
},
|
||||||
alternate = "src/main/java/{}.kt"
|
alternate = "src/main/java/{}.kt",
|
||||||
},
|
},
|
||||||
["src/main/resources/*"] = {
|
["src/main/resources/*"] = {
|
||||||
type = "resource"
|
type = "resource",
|
||||||
},
|
},
|
||||||
["src/test/resources/*"] = {
|
["src/test/resources/*"] = {
|
||||||
type = "testresource"
|
type = "testresource",
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
local mint_config = {
|
local mint_config = {
|
||||||
["*"] = {
|
["*"] = {
|
||||||
start = "mint start"
|
start = "mint start",
|
||||||
},
|
},
|
||||||
["source/*.mint"] = {
|
["source/*.mint"] = {
|
||||||
type = "source",
|
type = "source",
|
||||||
template = {
|
template = {
|
||||||
"component {basename} {open}",
|
"component {basename} {open}",
|
||||||
" style {basename|camelcase} {open}",
|
" style {basename|camelcase} {open}",
|
||||||
" {close}",
|
" {close}",
|
||||||
"",
|
"",
|
||||||
" fun render : Html {open}",
|
" fun render : Html {open}",
|
||||||
" {close}",
|
" {close}",
|
||||||
"{close}"
|
"{close}",
|
||||||
},
|
},
|
||||||
alternate = "tests/{}.mint"
|
alternate = "tests/{}.mint",
|
||||||
},
|
},
|
||||||
["tests/*.mint"] = {
|
["tests/*.mint"] = {
|
||||||
type = "test",
|
type = "test",
|
||||||
template = {
|
template = {
|
||||||
'suite "{basename}" {open}',
|
'suite "{basename}" {open}',
|
||||||
' test "A test" {open}',
|
' test "A test" {open}',
|
||||||
" with Test.Html {open}",
|
" with Test.Html {open}",
|
||||||
" {close}",
|
" {close}",
|
||||||
" {close}",
|
" {close}",
|
||||||
"{close}"
|
"{close}",
|
||||||
},
|
},
|
||||||
alternate = "source/{}.mint"
|
alternate = "source/{}.mint",
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
local crystal_config = {
|
local crystal_config = {
|
||||||
["*"] = {
|
["*"] = {
|
||||||
start = "crystal run"
|
start = "crystal run",
|
||||||
},
|
},
|
||||||
["src/*.cr"] = {
|
["src/*.cr"] = {
|
||||||
type = "source",
|
type = "source",
|
||||||
template = {
|
template = {
|
||||||
"module {capitalize|colons}",
|
"module {capitalize|colons}",
|
||||||
"end"
|
"end",
|
||||||
},
|
},
|
||||||
alternate = "spec/{}_spec.cr"
|
alternate = "spec/{}_spec.cr",
|
||||||
},
|
},
|
||||||
["spec/*_spec.cr"] = {
|
["spec/*_spec.cr"] = {
|
||||||
type = "spec",
|
type = "spec",
|
||||||
template = {
|
template = {
|
||||||
"describe {capitalize|colons} do",
|
"describe {capitalize|colons} do",
|
||||||
" # TODO Write tests",
|
" # TODO Write tests",
|
||||||
"",
|
"",
|
||||||
' it "works" do',
|
' it "works" do',
|
||||||
" false.should eq(true)",
|
" false.should eq(true)",
|
||||||
" end",
|
" end",
|
||||||
"end"
|
"end",
|
||||||
},
|
},
|
||||||
alternate = "src/{}.cr"
|
alternate = "src/{}.cr",
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
local function c_project_config(source_extension, header_extension)
|
local function c_project_config(source_extension, header_extension)
|
||||||
return {
|
return {
|
||||||
["*"] = {
|
["*"] = {
|
||||||
start = "make run"
|
start = "make run",
|
||||||
},
|
},
|
||||||
["src/*." .. source_extension] = {
|
["src/*." .. source_extension] = {
|
||||||
type = "source",
|
type = "source",
|
||||||
alternate = {
|
alternate = {
|
||||||
"src/{}." .. header_extension,
|
"src/{}." .. header_extension,
|
||||||
"test/{}." .. source_extension,
|
"test/{}." .. source_extension,
|
||||||
"include/{project|basename}/{}." .. header_extension
|
"include/{project|basename}/{}." .. header_extension,
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
["test/*." .. source_extension] = {
|
["test/*." .. source_extension] = {
|
||||||
type = "test",
|
type = "test",
|
||||||
alternate = {
|
alternate = {
|
||||||
"src/{}." .. header_extension
|
"src/{}." .. header_extension,
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
["src/*." .. header_extension] = {
|
["src/*." .. header_extension] = {
|
||||||
type = "header",
|
type = "header",
|
||||||
alternate = {
|
alternate = {
|
||||||
"src/{}." .. source_extension
|
"src/{}." .. source_extension,
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
["include/{project|basename}/*." .. header_extension] = {
|
["include/{project|basename}/*." .. header_extension] = {
|
||||||
type = "header",
|
type = "header",
|
||||||
alternate = {
|
alternate = {
|
||||||
"src/{}." .. header_extension
|
"src/{}." .. header_extension,
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
vim.g.projectionist_heuristics = {
|
vim.g.projectionist_heuristics = {
|
||||||
["pubspec.yaml"] = flutter_config,
|
["pubspec.yaml"] = flutter_config,
|
||||||
["requirements.txt|pyproject.toml"] = python_config,
|
["requirements.txt|pyproject.toml"] = python_config,
|
||||||
["*.sln"] = dotnet_solution_config,
|
["*.sln"] = dotnet_solution_config,
|
||||||
["*.csproj"] = csharp_project_config,
|
["*.csproj"] = csharp_project_config,
|
||||||
["plugin/|autoload/"] = vim_plugin_config,
|
["plugin/|autoload/"] = vim_plugin_config,
|
||||||
["src/*.cpp|test/*.cpp"] = c_project_config("cpp", "hpp"),
|
["src/*.cpp|test/*.cpp"] = c_project_config("cpp", "hpp"),
|
||||||
["src/*.c|test/*.c"] = c_project_config("c", "h"),
|
["src/*.c|test/*.c"] = c_project_config("c", "h"),
|
||||||
["lua/"] = lua_vim_plugin_config,
|
["lua/"] = lua_vim_plugin_config,
|
||||||
["build.gradle|pom.xml"] = java_project_config,
|
["build.gradle|pom.xml"] = java_project_config,
|
||||||
["build.gradle|build.gradle.kts"] = kotlin_project_config,
|
["build.gradle|build.gradle.kts"] = kotlin_project_config,
|
||||||
["mint.json"] = mint_config,
|
["mint.json"] = mint_config,
|
||||||
["shard.yml"] = crystal_config
|
["shard.yml"] = crystal_config,
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,15 @@
|
||||||
-- - Vim REST Console setup and extra commands -
|
-- - Vim REST Console setup and extra commands -
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
|
|
||||||
vim.cmd [[command! -nargs=0 ScratchRestConsole :lua require('vim_rest_console_extensions').open_scratch_rest_console()]]
|
vim.cmd(
|
||||||
vim.cmd [[command! -nargs=? RestConsole :lua require('vim_rest_console_extensions').open_cached_rest_console(<f-args>)]]
|
[[command! -nargs=0 ScratchRestConsole :lua require('vim_rest_console_extensions').open_scratch_rest_console()]]
|
||||||
vim.cmd [[command! -nargs=? RestConsoleLocal :lua require('vim_rest_console_extensions').open_local_rest_console(<f-args>)]]
|
)
|
||||||
vim.cmd [[command! -nargs=1 RestConsoleCached :lua require('vim_rest_console_extensions').open_named_cached_rest_console(<f-args>)]]
|
vim.cmd(
|
||||||
|
[[command! -nargs=? RestConsole :lua require('vim_rest_console_extensions').open_cached_rest_console(<f-args>)]]
|
||||||
|
)
|
||||||
|
vim.cmd(
|
||||||
|
[[command! -nargs=? RestConsoleLocal :lua require('vim_rest_console_extensions').open_local_rest_console(<f-args>)]]
|
||||||
|
)
|
||||||
|
vim.cmd(
|
||||||
|
[[command! -nargs=1 RestConsoleCached :lua require('vim_rest_console_extensions').open_named_cached_rest_console(<f-args>)]]
|
||||||
|
)
|
||||||
|
|
|
@ -3,9 +3,15 @@ local s = luasnip.snippet
|
||||||
local f = luasnip.function_node
|
local f = luasnip.function_node
|
||||||
|
|
||||||
luasnip.add_snippets("all", {
|
luasnip.add_snippets("all", {
|
||||||
s("date", {f(function(_, _) return os.date("%Y-%m-%d") end)}),
|
s("date", { f(function(_, _)
|
||||||
s("datetime", {f(function(_, _) return os.date("%Y-%m-%d %H:%M:%S") end)}),
|
return os.date("%Y-%m-%d")
|
||||||
s("diso", {f(function(_, _) return os.date("%Y-%m-%dT%H:%M:%S") end)})
|
end) }),
|
||||||
|
s("datetime", { f(function(_, _)
|
||||||
|
return os.date("%Y-%m-%d %H:%M:%S")
|
||||||
|
end) }),
|
||||||
|
s("diso", { f(function(_, _)
|
||||||
|
return os.date("%Y-%m-%dT%H:%M:%S")
|
||||||
|
end) }),
|
||||||
})
|
})
|
||||||
|
|
||||||
require("luasnip.loaders.from_vscode").lazy_load()
|
require("luasnip.loaders.from_vscode").lazy_load()
|
||||||
|
|
|
@ -3,36 +3,28 @@
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
|
|
||||||
local actions = require("telescope.actions")
|
local actions = require("telescope.actions")
|
||||||
require("telescope").setup {
|
require("telescope").setup({
|
||||||
defaults = {
|
defaults = {
|
||||||
mappings = {
|
mappings = {
|
||||||
i = {
|
i = {
|
||||||
-- Switch out M-q and C-q since C-q will be used more often
|
-- Switch out M-q and C-q since C-q will be used more often
|
||||||
["<M-q>"] = actions.send_to_qflist + actions.open_qflist,
|
["<M-q>"] = actions.send_to_qflist + actions.open_qflist,
|
||||||
["<C-q>"] = actions.send_selected_to_qflist + actions.open_qflist
|
["<C-q>"] = actions.send_selected_to_qflist + actions.open_qflist,
|
||||||
},
|
},
|
||||||
n = {
|
n = {
|
||||||
-- Switch out M-q and C-q since C-q will be used more often
|
-- Switch out M-q and C-q since C-q will be used more often
|
||||||
["<M-q>"] = actions.send_to_qflist + actions.open_qflist,
|
["<M-q>"] = actions.send_to_qflist + actions.open_qflist,
|
||||||
["<C-q>"] = actions.send_selected_to_qflist + actions.open_qflist
|
["<C-q>"] = actions.send_selected_to_qflist + actions.open_qflist,
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
}
|
})
|
||||||
|
|
||||||
require("telescope").load_extension("dap")
|
require("telescope").load_extension("dap")
|
||||||
|
|
||||||
vim.keymap.set(
|
vim.keymap.set("n", "<C-P>", function()
|
||||||
"n",
|
require("telescope.builtin").find_files()
|
||||||
"<C-P>",
|
end)
|
||||||
function()
|
vim.keymap.set("n", "<C-M-F>", function()
|
||||||
require("telescope.builtin").find_files()
|
require("telescope.builtin").live_grep()
|
||||||
end
|
end)
|
||||||
)
|
|
||||||
vim.keymap.set(
|
|
||||||
"n",
|
|
||||||
"<C-M-F>",
|
|
||||||
function()
|
|
||||||
require("telescope.builtin").live_grep()
|
|
||||||
end
|
|
||||||
)
|
|
||||||
|
|
|
@ -1,48 +1,45 @@
|
||||||
require "nvim-treesitter.configs".setup {
|
require("nvim-treesitter.configs").setup({
|
||||||
ensure_installed = "all", -- "all" or a list of languages
|
ensure_installed = "all", -- "all" or a list of languages
|
||||||
highlight = {
|
highlight = {
|
||||||
enable = true -- false will disable the whole extension
|
enable = true, -- false will disable the whole extension
|
||||||
},
|
},
|
||||||
indent = {
|
playground = {
|
||||||
enable = true
|
enable = true,
|
||||||
},
|
disable = {},
|
||||||
playground = {
|
updatetime = 25, -- Debounced time for highlighting nodes in the playground from source code
|
||||||
enable = true,
|
persist_queries = false, -- Whether the query persists across vim sessions
|
||||||
disable = {},
|
},
|
||||||
updatetime = 25, -- Debounced time for highlighting nodes in the playground from source code
|
textobjects = {
|
||||||
persist_queries = false -- Whether the query persists across vim sessions
|
select = {
|
||||||
},
|
enable = true,
|
||||||
textobjects = {
|
lookahead = true, -- Automatically jump forward to textobj, similar to targets.vim
|
||||||
select = {
|
keymaps = {
|
||||||
enable = true,
|
-- You can use the capture groups defined in textobjects.scm
|
||||||
lookahead = true, -- Automatically jump forward to textobj, similar to targets.vim
|
["af"] = "@function.outer",
|
||||||
keymaps = {
|
["if"] = "@function.inner",
|
||||||
-- You can use the capture groups defined in textobjects.scm
|
["ac"] = "@class.outer",
|
||||||
['af'] = '@function.outer',
|
["ic"] = "@class.inner",
|
||||||
['if'] = '@function.inner',
|
},
|
||||||
['ac'] = '@class.outer',
|
},
|
||||||
['ic'] = '@class.inner',
|
move = {
|
||||||
},
|
enable = true,
|
||||||
},
|
set_jumps = true, -- whether to set jumps in the jumplist
|
||||||
move = {
|
goto_next_start = {
|
||||||
enable = true,
|
["]m"] = "@function.outer",
|
||||||
set_jumps = true, -- whether to set jumps in the jumplist
|
["]]"] = "@class.outer",
|
||||||
goto_next_start = {
|
},
|
||||||
[']m'] = '@function.outer',
|
goto_next_end = {
|
||||||
[']]'] = '@class.outer',
|
["]M"] = "@function.outer",
|
||||||
},
|
["]["] = "@class.outer",
|
||||||
goto_next_end = {
|
},
|
||||||
[']M'] = '@function.outer',
|
goto_previous_start = {
|
||||||
[']['] = '@class.outer',
|
["[m"] = "@function.outer",
|
||||||
},
|
["[["] = "@class.outer",
|
||||||
goto_previous_start = {
|
},
|
||||||
['[m'] = '@function.outer',
|
goto_previous_end = {
|
||||||
['[['] = '@class.outer',
|
["[M"] = "@function.outer",
|
||||||
},
|
["[]"] = "@class.outer",
|
||||||
goto_previous_end = {
|
},
|
||||||
['[M'] = '@function.outer',
|
},
|
||||||
['[]'] = '@class.outer',
|
},
|
||||||
},
|
})
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in New Issue