Compare commits

...

4 commits

Author SHA1 Message Date
ac2b15e673 fix(vim): update lsp config to fix deprecations
Nvim lsp has changed the way the config works. This is now on all the versions
on nvim I am using. The main one is in tumbleweed this is relatively up to
date.

The sign_define has also moved into the diagnostic config.
2024-12-30 13:15:37 +00:00
26ae32de82 fix(vim): ensure we don't get errors if we are on old ivy 2024-12-30 13:15:37 +00:00
bbdcd42b27 feat(vim): add csharp snippets
This add most of the snippets I used to have. It implements a custom
env_namespace for adding in the namespace of the file based on where it in the
file tree.
2024-12-30 13:15:37 +00:00
1a9492c0ef feat(core): start the windows support 2024-12-30 13:15:37 +00:00
21 changed files with 170 additions and 49 deletions

View file

@ -1,6 +1,13 @@
local git = require "lib.git"
local emacs_dir = os.getenv "HOME" .. "/.emacs.d"
local emacs_dir
if os.getenv "OS" == "Windows_NT" then
emacs_dir = os.getenv "HOME" .. "/AppData/Roaming/.emacs.d"
else
emacs_dir = os.getenv "HOME" .. "/.emacs.d"
end
if not configz.is_directory(emacs_dir .. "/straight") then
configz.directory(emacs_dir .. "/straight")
end

View file

@ -1,6 +1,12 @@
local git = require "lib.git"
local nvim_dir = os.getenv "HOME" .. "/.config/nvim"
local nvim_dir
if os.getenv "OS" == "Windows_NT" then
nvim_dir = os.getenv "HOME" .. "/AppData/Local/nvim"
else
nvim_dir = os.getenv "HOME" .. "/.config/nvim"
end
local nvim_plugin_dir_start = nvim_dir .. "/pack/bundle/start"
local nvim_plugin_dir_opt = nvim_dir .. "/pack/bundle/opt"
@ -74,12 +80,12 @@ for plugin, config in pairs(opt_plugins) do
}
end
configz.run(string.format("rm -rf %s/conjure", nvim_plugin_dir_start))
configz.run(string.format("rm -rf %s/orgmode", nvim_plugin_dir_start))
configz.run(string.format("rm -rf %s/indent-line", nvim_plugin_dir_start))
configz.run(string.format("rm -rf %s/auto-pairs", nvim_plugin_dir_start))
configz.run(string.format("rm -rf %s/vim-puppet", nvim_plugin_dir_start))
configz.run(string.format("rm -rf %s/base16-vim", nvim_plugin_dir_start))
configz.run(string.format("rm -rf %s/vim-fugitive", nvim_plugin_dir_start))
configz.run(string.format("rm -rf %s/vim-rhubarb", nvim_plugin_dir_start))
configz.run(string.format("rm -rf %s/vim-tmux-navigator", nvim_plugin_dir_start))
-- configz.run(string.format("rm -rf %s/conjure", nvim_plugin_dir_start))
-- configz.run(string.format("rm -rf %s/orgmode", nvim_plugin_dir_start))
-- configz.run(string.format("rm -rf %s/indent-line", nvim_plugin_dir_start))
-- configz.run(string.format("rm -rf %s/auto-pairs", nvim_plugin_dir_start))
-- configz.run(string.format("rm -rf %s/vim-puppet", nvim_plugin_dir_start))
-- configz.run(string.format("rm -rf %s/base16-vim", nvim_plugin_dir_start))
-- configz.run(string.format("rm -rf %s/vim-fugitive", nvim_plugin_dir_start))
-- configz.run(string.format("rm -rf %s/vim-rhubarb", nvim_plugin_dir_start))
-- configz.run(string.format("rm -rf %s/vim-tmux-navigator", nvim_plugin_dir_start))

View file

@ -1,6 +1,12 @@
local data = require "lib.data"
local config_dir = os.getenv "HOME" .. "/.config/sapling"
local config_dir
if os.getenv "OS" == "Windows_NT" then
config_dir = os.getenv "HOME" .. "/AppData/Roaming/sapling"
else
config_dir = os.getenv "HOME" .. "/.config/sapling"
end
configz.directory(config_dir);

View file

@ -7,12 +7,12 @@
# The format of the prompt is: username@hostname:current_path
def create_left_prompt [] {
let username = $env.USER
let hostname = $env.HOSTNAME
let hostname = $env.HOSTNAME | str downcase
let formatted_path = $env.PWD
| str replace $env.HOME '~'
| str replace '~/Code/src/' '~s/'
| str replace '~s/github.com' '~gh'
| str replace (["~", "Code", "src"] | path join) '~s'
| str replace (["~s", "github.com"] | path join) '~gh'
$"(ansi magenta)($username)(ansi light_cyan)@(ansi yellow)($hostname)(ansi red):(ansi light_cyan)($formatted_path)(ansi reset)"
}

View file

@ -10,7 +10,7 @@ require("ivy").setup {
"ivy.backends.lsp-workspace-symbols",
"ivy.backends.rg",
},
mappings = vim.tbl_extend("force", config:get { "mappings" }, {
mappings = vim.tbl_extend("force", config:get { "mappings" } or {}, {
["<C-M-n>"] = "next_checkpoint",
["<C-M-p>"] = "previous_checkpoint",
}),

View file

@ -113,29 +113,22 @@ end
require("ionide").setup { on_attach = on_attach, capabilities = capabilities }
-- Change the diagnostic signs
vim.fn.sign_define("DiagnosticSignHint", { text = "", texthl = "DiagnosticSignHint", numhl = "DiagnosticSignHint" })
vim.fn.sign_define("DiagnosticSignInfo", { text = "", texthl = "DiagnosticSignInfo", numhl = "DiagnosticSignInfo" })
vim.fn.sign_define("DiagnosticSignWarn", { text = "", texthl = "DiagnosticSignWarn", numhl = "DiagnosticSignWarn" })
vim.fn.sign_define(
"DiagnosticSignError",
{ text = "", texthl = "DiagnosticSignError", numhl = "DiagnosticSignError" }
)
local border = "rounded"
vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, { border = border })
vim.lsp.handlers["textDocument/show_line_diagnostics"] = vim.lsp.with(vim.lsp.handlers.hover, { border = border })
vim.lsp.handlers["textDocument/diagnostic"] = vim.lsp.with(vim.lsp.handlers.hover, { border = border })
vim.lsp.handlers["textDocument/diagnostics"] = vim.lsp.with(vim.lsp.handlers.hover, { border = border })
vim.diagnostic.config {
float = {
focusable = false,
border = border,
border = "rounded",
},
virtual_text = {
prefix = "",
},
signs = {
text = {
[vim.diagnostic.severity.ERROR] = '',
[vim.diagnostic.severity.INFO] = '',
[vim.diagnostic.severity.WARN] = '',
[vim.diagnostic.severity.HINT] = '',
}
}
}
vim.cmd [[set updatetime=1000]]

View file

@ -66,7 +66,7 @@ local function parse_snippet_file(file_path)
end
local snippets = {}
local paths = vim.split(vim.fn.glob "~/.config/nvim/snippets/**/*.snippet", "\n")
local paths = vim.split(vim.fn.glob(vim.fn.stdpath("config") .. "/snippets/**/*.snippet"), "\n")
for paths_index = 1, #paths do
local file = paths[paths_index]
local snippet = parse_snippet_file(file)
@ -96,3 +96,12 @@ end
for filetype, snippets_to_add in pairs(snippets) do
ls.add_snippets(filetype, snippets_to_add)
end
ls.env_namespace("AA", {
vars= {
NAMESPACE = function ()
local file_path = vim.fn.fnamemodify(vim.fn.expand("%:h"), ":~:.")
return string.gsub(file_path, "[\\/]", ".");
end
}
})

View file

@ -0,0 +1,9 @@
# name: New class
# key: class
# contributor: Ade Attwood <code@adeattwood.co.uk>
# filetypes: cs
# --
${public} class $TM_FILENAME_BASE
{
$0
}

View file

@ -0,0 +1,6 @@
# name: Parameter doc block comment
# key: debugger
# contributor: Ade Attwood <code@adeattwood.co.uk>
# filetypes: cs
# --
System.Diagnostics.Debugger.Break();

View file

@ -0,0 +1,9 @@
# name: Parameter doc block comment
# key: enum
# contributor: Ade Attwood <code@adeattwood.co.uk>
# filetypes: cs
# --
${public} enum $TM_FILENAME_BASE
{
$0
}

View file

@ -0,0 +1,6 @@
# name: exception doc block comment
# key: <exception
# contributor: Ade Attwood <code@adeattwood.co.uk>
# filetypes: cs
# --
<exception cref="$1">$0</exception>

View file

@ -0,0 +1,10 @@
# name: New test case
# key: it
# contributor: Ade Attwood <code@adeattwood.co.uk>
# filetypes: cs
# --
[Fact]
public void ${1}()
{
$0
}

View file

@ -0,0 +1,6 @@
# name: Write text to the console
# key: log
# contributor: Ade Attwood <code@adeattwood.co.uk>
# filetypes: cs
# --
Console.WriteLine($0);

View file

@ -0,0 +1,6 @@
# name: Full boilerplare class for the current file
# key: namespace
# contributor: Ade Attwood <code@adeattwood.co.uk>
# filetypes: cs
# --
namespace ${AA_NAMESPACE};

View file

@ -0,0 +1,11 @@
# name: Full boilerplare class for the current file
# key: nclass
# contributor: Ade Attwood <code@adeattwood.co.uk>
# filetypes: cs
# --
namespace ${AA_NAMESPACE};
${public} class $TM_FILENAME_BASE
{
$0
}

View file

@ -0,0 +1,6 @@
# name: Parameter doc block comment
# key: <param
# contributor: Ade Attwood <code@adeattwood.co.uk>
# filetypes: cs
# --
<param name="${1:parameterName}">$0</param>"

View file

@ -0,0 +1,6 @@
# name: A public prop getter and setter
# key: prop
# contributor: Ade Attwood <code@adeattwood.co.uk>
# filetypes: cs
# --
public ${1:int} ${2:MyProperty} { get; set; }$0

View file

@ -0,0 +1,9 @@
# name: A public prop getter and setter
# key: pub
# contributor: Ade Attwood <code@adeattwood.co.uk>
# filetypes: cs
# --
public ${1:int} ${2:Name}($3)
{
$0
}

View file

@ -0,0 +1,6 @@
# name: Returns doc block comment
# key: <returns
# contributor: Ade Attwood <code@adeattwood.co.uk>
# filetypes: cs
# --
<returns>$0</returns>"

View file

@ -0,0 +1,8 @@
# name: Summary doc block comment
# key: ///
# contributor: Ade Attwood <code@adeattwood.co.uk>
# filetypes: cs
# --
/// <summary>
/// $0
/// </summary>

View file

@ -1,7 +1,7 @@
local wezterm = require "wezterm"
local scheme = wezterm.get_builtin_color_schemes()
local nord = scheme["nord"]
local theme = scheme["Poimandres"]
local function vim_pass_though_action(config)
return {
@ -25,47 +25,49 @@ return {
-- Use a sexy terminal font with ligatures.
-- You will need to install the beta version of the font to get the ligatures
-- https://github.com/intel/intel-one-mono/issues/9#issuecomment-1994958719
font = wezterm.font {
family = "Intel One Mono",
},
-- font = wezterm.font {
-- family = "FiraCode Nerd Font Mono",
-- },
-- The nord theme to fit with everyting else
color_scheme = "nord",
-- -- The nord theme to fit with everyting else
color_scheme = "Poimandres",
colors = {
tab_bar = {
background = nord.background,
background = theme.background,
active_tab = {
bg_color = "#88c0d0", -- nord.background,
fg_color = nord.background,
bg_color = "#88c0d0",
fg_color = theme.background,
},
inactive_tab = {
bg_color = nord.background,
fg_color = nord.foreground,
bg_color = theme.background,
fg_color = theme.foreground,
},
inactive_tab_hover = {
bg_color = "#4c566a",
fg_color = nord.foreground,
fg_color = theme.foreground,
italic = false,
},
new_tab = {
bg_color = nord.background,
fg_color = nord.foreground,
bg_color = theme.background,
fg_color = theme.foreground,
},
new_tab_hover = {
bg_color = "#4c566a",
fg_color = nord.foreground,
fg_color = theme.foreground,
italic = false,
},
},
},
default_prog = { 'nu' },
use_fancy_tab_bar = false,
-- Give the font some more line height, just makes thinks look a bit nicer
line_height = 1.4,
-- Remove the window boarders so we have a nice clean look
window_decorations = "NONE",
window_decorations = "RESIZE",
-- Who wants their music interrupted every time there is no tab completion
-- available in the shell, Who wants their music interrupted evert time there