Compare commits

..

1 commit

Author SHA1 Message Date
3045531cd3 WIP
All checks were successful
ci/woodpecker/push/check Pipeline was successful
2023-05-12 19:15:16 +01:00
314 changed files with 4533 additions and 2313 deletions

8
.envrc
View file

@ -1,8 +1,10 @@
if ! has nix_direnv_version || ! nix_direnv_version 3.0.0; then
source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/3.0.0/direnvrc" "sha256-21TMnI2xWX7HkSTjFFri2UaohXVj854mgvWapWrxRXg="
if ! has nix_direnv_version || ! nix_direnv_version 2.2.1; then
source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/2.2.1/direnvrc" "sha256-zelF0vLbEl5uaqrfIzbgNzJWGmLzCmYAkInj/LNxvKs="
fi
use flake
watch_file ./flake/checks.nix
watch_file ./flake/dev-shells.nix
use flake
eval "$shellHooks"

View file

@ -1,7 +1,7 @@
labels:
backend: local
type: exec
steps:
pipeline:
- name: nix flake check
image: bash
commands:

View file

@ -1,6 +1,5 @@
#!/usr/bin/env nix-shell
#! nix-shell -i bash -p bitwarden-cli git gnupg jq nix
# shellcheck shell=bash
# Command failure is script failure
set -e
@ -11,6 +10,7 @@ BOLD_GREEN="\e[0;1;32m"
RESET="\e[0m"
DEST="$HOME/.config/nixpkgs"
BW_SESSION=""
warn() {

71
flake.lock generated
View file

@ -8,17 +8,14 @@
],
"nixpkgs": [
"nixpkgs"
],
"systems": [
"systems"
]
},
"locked": {
"lastModified": 1703433843,
"narHash": "sha256-nmtA4KqFboWxxoOAA6Y1okHbZh+HsXaMPFkYHsoDRDw=",
"lastModified": 1683866323,
"narHash": "sha256-M2bEuh2jr0Ec13GnP5f8unD8q0AcPt2fHSUynOZJ8No=",
"owner": "ryantm",
"repo": "agenix",
"rev": "417caa847f9383e111d1397039c9d4337d024bf0",
"rev": "92197270a1eedd142a4aff853e4cc6d1e838c22f",
"type": "github"
},
"original": {
@ -36,11 +33,11 @@
]
},
"locked": {
"lastModified": 1700795494,
"narHash": "sha256-gzGLZSiOhf155FW7262kdHo2YDeugp3VuIFb4/GGng0=",
"lastModified": 1673295039,
"narHash": "sha256-AsdYgE8/GPwcelGgrntlijMg4t3hLFJFCRF3tL5WVjA=",
"owner": "lnl7",
"repo": "nix-darwin",
"rev": "4b9b83d5a92e8c1fbfd8eb27eda375908c11ec4d",
"rev": "87b9d090ad39b25b2400029c64825fc2a8868943",
"type": "github"
},
"original": {
@ -53,11 +50,11 @@
"flake-compat": {
"flake": false,
"locked": {
"lastModified": 1696426674,
"narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
"lastModified": 1673956053,
"narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
"rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9",
"type": "github"
},
"original": {
@ -73,11 +70,11 @@
]
},
"locked": {
"lastModified": 1706830856,
"narHash": "sha256-a0NYyp+h9hlb7ddVz4LUn1vT/PLwqfrWYcHMvFB1xYg=",
"lastModified": 1683560683,
"narHash": "sha256-XAygPMN5Xnk/W2c1aW0jyEa6lfMDZWlQgiNtmHXytPc=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "b253292d9c0a5ead9bc98c4e9a26c6312e27d69f",
"rev": "006c75898cf814ef9497252b022e91c946ba8e17",
"type": "github"
},
"original": {
@ -89,16 +86,14 @@
},
"futils": {
"inputs": {
"systems": [
"systems"
]
"systems": "systems"
},
"locked": {
"lastModified": 1705309234,
"narHash": "sha256-uNRRNRKmJyCRC/8y1RqBkqWBLM034y4qN7EprSdmgyA=",
"lastModified": 1681202837,
"narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "1ef2e671c3b0c19053962c07dbda38332dcebf26",
"rev": "cfacdce06f30d2b68473a46042957675eebb3401",
"type": "github"
},
"original": {
@ -116,11 +111,11 @@
]
},
"locked": {
"lastModified": 1703887061,
"narHash": "sha256-gGPa9qWNc6eCXT/+Z5/zMkyYOuRZqeFZBDbopNZQkuY=",
"lastModified": 1660459072,
"narHash": "sha256-8DFJjXG8zqoONA1vXtgeKXy68KdJL5UaXR8NtVMUbx8=",
"owner": "hercules-ci",
"repo": "gitignore.nix",
"rev": "43e1aa1308018f37118e34d3a9cb4f5e75dc11d5",
"rev": "a20de23b925fd8264fd7fad6454652e142fd7f73",
"type": "github"
},
"original": {
@ -136,11 +131,11 @@
]
},
"locked": {
"lastModified": 1707175763,
"narHash": "sha256-0MKHC6tQ4KEuM5rui6DjKZ/VNiSANB4E+DJ/+wPS1PU=",
"lastModified": 1683883222,
"narHash": "sha256-Tow+8GKwNNk2NvXoBwS/VBP8lpOdqIeeJ46ZU2fw5QU=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "f99eace7c167b8a6a0871849493b1c613d0f1b80",
"rev": "a835096fd2bcc369f57b76b9b17cc00348f595f5",
"type": "github"
},
"original": {
@ -152,11 +147,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1707092692,
"narHash": "sha256-ZbHsm+mGk/izkWtT4xwwqz38fdlwu7nUUKXTOmm4SyE=",
"lastModified": 1683408522,
"narHash": "sha256-9kcPh6Uxo17a3kK3XCHhcWiV1Yu1kYj22RHiymUhMkU=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "faf912b086576fd1a15fca610166c98d47bc667e",
"rev": "897876e4c484f1e8f92009fd11b7d988a121a4e7",
"type": "github"
},
"original": {
@ -168,11 +163,11 @@
},
"nur": {
"locked": {
"lastModified": 1707234300,
"narHash": "sha256-D+LdA8g0Tq+KE9EmJMmn8EGRO5jZ2nLe/W0Fr5EIsdg=",
"lastModified": 1683884754,
"narHash": "sha256-o3JF2SZJIwnz2YXwS0tb+CZqfXTABZDTdCjOG6fahIA=",
"owner": "nix-community",
"repo": "NUR",
"rev": "59fceae769455455ef44c1dfb63bbae1ecddc41d",
"rev": "ee3497fa69c9c48ec7e4c0ffc1610ea543497633",
"type": "github"
},
"original": {
@ -197,11 +192,11 @@
]
},
"locked": {
"lastModified": 1706424699,
"narHash": "sha256-Q3RBuOpZNH2eFA1e+IHgZLAOqDD9SKhJ/sszrL8bQD4=",
"lastModified": 1682596858,
"narHash": "sha256-Hf9XVpqaGqe/4oDGr30W8HlsWvJXtMsEPHDqHZA6dDg=",
"owner": "cachix",
"repo": "pre-commit-hooks.nix",
"rev": "7c54e08a689b53c8a1e5d70169f2ec9e2a68ffaf",
"rev": "fb58866e20af98779017134319b5663b8215d912",
"type": "github"
},
"original": {
@ -219,8 +214,7 @@
"home-manager": "home-manager",
"nixpkgs": "nixpkgs",
"nur": "nur",
"pre-commit-hooks": "pre-commit-hooks",
"systems": "systems"
"pre-commit-hooks": "pre-commit-hooks"
}
},
"systems": {
@ -234,7 +228,6 @@
},
"original": {
"owner": "nix-systems",
"ref": "main",
"repo": "default",
"type": "github"
}

View file

@ -9,7 +9,6 @@
inputs = {
home-manager.follows = "home-manager";
nixpkgs.follows = "nixpkgs";
systems.follows = "systems";
};
};
@ -28,9 +27,6 @@
owner = "numtide";
repo = "flake-utils";
ref = "main";
inputs = {
systems.follows = "systems";
};
};
home-manager = {
@ -68,13 +64,6 @@
nixpkgs-stable.follows = "nixpkgs";
};
};
systems = {
type = "github";
owner = "nix-systems";
repo = "default";
ref = "main";
};
};
# Can't eta-reduce a flake outputs...

View file

@ -2,7 +2,7 @@
{
perSystem = { config, pkgs, ... }: {
devShells = {
default = pkgs.mkShellNoCC {
default = pkgs.mkShell {
name = "NixOS-config";
nativeBuildInputs = with pkgs; [

View file

@ -2,7 +2,7 @@
let
defaultModules = [
# Include generic settings
"${self}/modules/home"
"${self}/home"
{
# Basic user information defaults
home.username = lib.mkDefault "ambroisie";
@ -39,9 +39,8 @@ let
};
};
homes = {
"ambroisie@bazin" = "x86_64-linux";
"ambroisie@mousqueton" = "x86_64-linux";
hosts = {
"ambroisie@ambroisie" = "x86_64-linux"; # Unfortunate naming here...
};
in
{
@ -50,13 +49,13 @@ in
legacyPackages = {
homeConfigurations =
let
filteredHomes = lib.filterAttrs (_: v: v == system) homes;
allHomes = filteredHomes // {
filteredHosts = lib.filterAttrs (_: v: v == system) hosts;
allHosts = filteredHosts // {
# Default configuration
ambroisie = system;
};
in
lib.mapAttrs mkHome allHomes;
lib.mapAttrs mkHome allHosts;
};
};
}

View file

@ -1,5 +1,7 @@
{ self, inputs, lib, ... }:
{ self, inputs, ... }:
let
inherit (self) lib;
defaultModules = [
{
# Let 'nixos-version --json' know about the Git revision
@ -11,7 +13,9 @@ let
];
}
# Include generic settings
"${self}/modules/nixos"
"${self}/modules"
# Include bundles of settings
"${self}/profiles"
];
buildHost = name: system: lib.nixosSystem {
@ -21,7 +25,7 @@ let
];
specialArgs = {
# Use my extended lib in NixOS configuration
inherit (self) lib;
inherit lib;
# Inject inputs to use them in global registry
inherit inputs;
};

29
home/comma/default.nix Normal file
View file

@ -0,0 +1,29 @@
{ config, lib, pkgs, ... }:
let
cfg = config.my.home.comma;
in
{
options.my.home.comma = with lib; {
enable = my.mkDisableOption "comma configuration";
pkgsFlake = mkOption {
type = types.str;
default = "pkgs";
example = "nixpkgs";
description = ''
Which flake from the registry should be used with
<command>nix shell</command>.
'';
};
};
config = lib.mkIf cfg.enable {
home.packages = with pkgs; [
ambroisie.comma
];
home.sessionVariables = {
COMMA_PKGS_FLAKE = cfg.pkgsFlake;
};
};
}

53
home/default.nix Normal file
View file

@ -0,0 +1,53 @@
{ ... }:
{
imports = [
./aliases
./atuin
./bat
./bluetooth
./comma
./dircolors
./direnv
./discord
./documentation
./feh
./firefox
./flameshot
./fzf
./gammastep
./gdb
./git
./gpg
./gtk
./htop
./jq
./mail
./mpv
./nix
./nix-index
./nm-applet
./packages
./pager
./power-alert
./secrets
./ssh
./terminal
./tmux
./udiskie
./vim
./wm
./x
./xdg
./zathura
./zsh
];
# First sane reproducible version
home.stateVersion = "20.09";
# Who am I?
home.username = "ambroisie";
# Start services automatically
systemd.user.startServices = "sd-switch";
}

32
home/direnv/lib/nix.sh Normal file
View file

@ -0,0 +1,32 @@
#shellcheck shell=bash
use_pkgs() {
if ! has nix; then
# shellcheck disable=2016
log_error 'use_pkgs: `nix` is not in PATH'
return 1
fi
# Use user-provided default value, or fallback to nixpkgs
local DEFAULT_FLAKE="${DIRENV_DEFAULT_FLAKE:-nixpkgs}"
# Allow changing the default flake through a command line switch
if [ "$1" = "-f" ] || [ "$1" = "--flake" ]; then
DEFAULT_FLAKE="$2"
shift 2
fi
# Allow specifying a full installable, or just a package name and use the default flake
local packages=()
for pkg; do
if [[ $pkg =~ .*#.* ]]; then
packages+=("$pkg")
else
packages+=("$DEFAULT_FLAKE#$pkg")
fi
done
# shellcheck disable=2154
direnv_load nix shell "${packages[@]}" --command "$direnv" dump
}

View file

@ -33,10 +33,13 @@ in
enable = true;
package = pkgs.firefox.override {
nativeMessagingHosts = ([ ]
++ lib.optional cfg.tridactyl.enable pkgs.tridactyl-native
cfg = {
enableTridactylNative = cfg.tridactyl.enable;
};
extraNativeMessagingHosts = with pkgs; ([ ]
# Watch videos using mpv
++ lib.optional cfg.ff2mpv.enable pkgs.ff2mpv-go
++ lib.optional cfg.ff2mpv.enable ambroisie.ff2mpv-go
);
};
@ -54,8 +57,8 @@ in
"browser.newtabpage.activity-stream.section.highlights.includePocket" = false; # Disable pocket
"extensions.pocket.enabled" = false; # Disable pocket
"media.eme.enabled" = true; # Enable DRM
"media.gmp-widevinecdm.enabled" = true; # Enable DRM
"media.gmp-widevinecdm.visible" = true; # Enable DRM
"media.gmp-widevinecdm.enabled" = true; # Enable DRM
"signon.autofillForms" = false; # Disable built-in form-filling
"signon.rememberSignons" = false; # Disable built-in password manager
"ui.systemUsesDarkTheme" = true; # Dark mode

View file

@ -22,8 +22,8 @@ bind ;c hint -Jc [class*="expand"],[class*="togg"],[class="comment_folder"]
bindurl reddit.com gu urlparent 3
" Only hint search results on Google
bindurl www.google.com f hint -Jc #search a
bindurl www.google.com F hint -Jbc #search a
bindurl www.google.com f hint -Jc #search div:not(.action-menu) > a
bindurl www.google.com F hint -Jbc #search div:not(.action-menu) > a
" Only hint search results on DuckDuckGo
bindurl ^https://duckduckgo.com f hint -Jc [data-testid="result-title-a"]
@ -69,6 +69,8 @@ unbind <C-f>
" Redirections {{{
" Always redirect Reddit to the old site
autocmd DocStart ^http(s?)://www.reddit.com js tri.excmds.urlmodify("-t", "www", "old")
" Use a better Twitter front-end
autocmd DocStart ^http(s?)://twitter.com js tri.excmds.urlmodify("-t", "twitter.com", "nitter.net")
" }}}
" Disabled websites {{{

View file

@ -20,19 +20,19 @@ in
};
};
config = lib.mkIf cfg.enable (lib.mkMerge [
{
config = lib.mkMerge [
(lib.mkIf cfg.enable {
home.packages = with pkgs; [
gdb
];
xdg.configFile."gdb/gdbinit".source = ./gdbinit;
}
})
(lib.mkIf cfg.rr.enable {
home.packages = [
cfg.rr.package
];
})
]);
];
}

View file

@ -7,9 +7,6 @@ in
{
options.my.home.git = with lib; {
enable = my.mkDisableOption "git configuration";
# I want the full experience by default
package = mkPackageOption pkgs "git" { default = [ "gitFull" ]; };
};
config.home.packages = with pkgs; lib.mkIf cfg.enable [
@ -25,7 +22,8 @@ in
userEmail = mkMailAddress "bruno" "belanyi.fr";
userName = "Bruno BELANYI";
inherit (cfg) package;
# I want the full experience
package = pkgs.gitFull;
aliases = {
git = "!git";

View file

@ -8,7 +8,7 @@ let
realName = lib.mkDefault "Bruno BELANYI";
userName = lib.mkDefault (mkMailAddress address domain);
passwordCommand =
lib.mkDefault [ (lib.getExe pkgs.ambroisie.rbw-pass) "Mail" passName ];
lib.mkDefault [ "${pkgs.ambroisie.bw-pass}/bin/bw-pass" "Mail" passName ];
address = mkMailAddress address domain;
aliases = builtins.map (lib.flip mkMailAddress domain) aliases;
@ -18,6 +18,8 @@ let
himalaya = {
enable = cfg.himalaya.enable;
# FIXME: try to actually configure it at some point
backend = "imap";
sender = "smtp";
};
msmtp = {

View file

@ -9,7 +9,7 @@ in
settings = {
notify-cmd =
let
notify-send = lib.getExe pkgs.libnotify;
notify-send = "${pkgs.libnotify}/bin/notify-send";
in
pkgs.writeScript "mail-notifier" ''
SENDER="$1"

View file

@ -13,8 +13,6 @@ in
scripts = [
pkgs.mpvScripts.mpris # Allow controlling using media keys
pkgs.mpvScripts.mpv-cheatsheet # Show some simple mappings on '?'
pkgs.mpvScripts.uosc # Nicer UI
];
};
};

View file

@ -6,10 +6,6 @@ in
options.my.home.packages = with lib; {
enable = my.mkDisableOption "user packages";
allowAliases = mkEnableOption "allow package aliases";
allowUnfree = my.mkDisableOption "allow unfree packages";
additionalPackages = mkOption {
type = with types; listOf package;
default = [ ];
@ -21,15 +17,10 @@ in
};
};
config = lib.mkIf cfg.enable {
home.packages = with pkgs; ([
fd
file
ripgrep
] ++ cfg.additionalPackages);
nixpkgs.config = {
inherit (cfg) allowAliases allowUnfree;
};
};
config.home.packages = with pkgs; lib.mkIf cfg.enable ([
fd
file
mosh
ripgrep
] ++ cfg.additionalPackages);
}

10
home/secrets/secrets.nix Normal file
View file

@ -0,0 +1,10 @@
# Common secrets
let
keys = import ../../keys;
# deadnix: skip
all = keys.users;
in
{
# Add secrets here
}

54
home/ssh/default.nix Normal file
View file

@ -0,0 +1,54 @@
{ config, lib, ... }:
let
cfg = config.my.home.ssh;
in
{
options.my.home.ssh = with lib; {
enable = my.mkDisableOption "ssh configuration";
};
config.programs.ssh = lib.mkIf cfg.enable {
enable = true;
includes = [
# Local configuration, not-versioned
"config.local"
];
matchBlocks = {
"github.com" = {
hostname = "github.com";
identityFile = "~/.ssh/shared_rsa";
user = "git";
};
"gitlab.com" = {
hostname = "gitlab.com";
identityFile = "~/.ssh/shared_rsa";
user = "git";
};
"git.sr.ht" = {
hostname = "git.sr.ht";
identityFile = "~/.ssh/shared_rsa";
user = "git";
};
"git.belanyi.fr" = {
hostname = "git.belanyi.fr";
identityFile = "~/.ssh/shared_rsa";
user = "git";
};
porthos = {
hostname = "91.121.177.163";
identityFile = "~/.ssh/shared_rsa";
user = "ambroisie";
};
};
extraConfig = ''
AddKeysToAgent yes
'';
};
}

View file

@ -10,20 +10,7 @@ in
options.my.home.tmux = with lib; {
enable = my.mkDisableOption "tmux terminal multiplexer";
enablePassthrough = mkEnableOption "tmux DCS passthrough sequence";
trueColorTerminals = mkOption {
type = with types; listOf str;
default = lib.my.nullableToList config.my.home.terminal.program;
defaultText = ''
`[ config.my.home.terminal.program ]` if it is non-null, otherwise an
empty list.
'';
example = [ "xterm-256color" ];
description = ''
$TERM values which should be considered to always support 24-bit color.
'';
};
enabledPassthrough = mkEnableOption "tmux DCS passthrough sequence";
};
config.programs.tmux = lib.mkIf cfg.enable {
@ -79,23 +66,12 @@ in
# Allow any application to send OSC52 escapes to set the clipboard
set -s set-clipboard on
# Longer session names in status bar
set -g status-left-length 16
${
lib.optionalString cfg.enablePassthrough ''
lib.optionalString cfg.enabledPassthrough ''
# Allow any application to use the tmux DCS for passthrough
set -g allow-passthrough on
''
}
# Force 24-bit color for each relevant $TERM
${
let
mkTcFlag = term: ''set -as terminal-features ",${term}:RGB"'';
in
lib.concatMapStringsSep "\n" mkTcFlag cfg.trueColorTerminals
}
'';
};
}

View file

@ -4,7 +4,3 @@ call ftplugined#check_undo_ft()
" Enable spell checking on commit messages
setlocal spell
let b:undo_ftplugin.='|setlocal spell<'
" Change max length of a line to 72 for this buffer
setlocal colorcolumn=72
let b:undo_ftplugin.='|setlocal colorcolumn<'

View file

@ -1,7 +1,5 @@
local wk = require("which-key")
local lsp = require("ambroisie.lsp")
local keys = {
-- Edition and navigation mappins
["["] = {
@ -32,7 +30,7 @@ local keys = {
x = "XML encode",
y = "C string encode",
-- Custom
d = { lsp.goto_prev_diagnostic, "Previous diagnostic" },
d = { vim.diagnostic.goto_prev, "Previous diagnostic" },
},
["]"] = {
name = "Next",
@ -62,7 +60,7 @@ local keys = {
x = "XML decode",
y = "C string decode",
-- Custom
d = { lsp.goto_next_diagnostic, "Next diagnostic" },
d = { vim.diagnostic.goto_next, "Next diagnostic" },
},
-- Option mappings

View file

@ -67,7 +67,7 @@ in
nvim-lspconfig # Easy LSP configuration
lsp-format-nvim # Simplified formatting configuration
lsp_lines-nvim # Show diagnostics *over* regions
none-ls-nvim # LSP integration for linters and formatters
null-ls-nvim # LSP integration for linters and formatters
nvim-treesitter.withAllGrammars # Better highlighting
nvim-treesitter-textobjects # More textobjects
nvim-ts-context-commentstring # Comment string in nested language blocks
@ -77,10 +77,10 @@ in
luasnip # Snippet manager compatible with LSP
friendly-snippets # LSP snippets collection
nvim-cmp # Completion engine
cmp-async-path # More responsive path completion
cmp-buffer # Words from open buffers
cmp-nvim-lsp # LSP suggestions
cmp-nvim-lua # NeoVim lua API
cmp-path # Path name suggestions
cmp-under-comparator # Sort items that start with '_' lower
cmp_luasnip # Snippet suggestions from LuaSnip

View file

@ -1,4 +1,4 @@
-- Use Automake filetype for `local.am` files
-- Use Automake filetype for `local.am` files, explicit `set` to force override
vim.filetype.add({
filename = {
["local.am"] = "automake",

View file

@ -48,6 +48,8 @@ set noswapfile
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Set the minimal amount of lignes under and above the cursor for context
set scrolloff=5
" More stable splits
set splitkeep=screen
" Always show status line
set laststatus=2
" Enable Doxygen highlighting

View file

@ -3,47 +3,26 @@ local M = {}
-- Simplified LSP formatting configuration
local lsp_format = require("lsp-format")
--- Move to the next/previous diagnostic, automatically showing the diagnostics
--- float if necessary.
--- @param forward whether to go forward or backwards
local function goto_diagnostic(forward)
vim.validate({
forward = { forward, "boolean" },
-- shared LSP configuration callback
-- @param client native client configuration
-- @param bufnr int? buffer number of the attched client
M.on_attach = function(client, bufnr)
-- Diagnostics
vim.diagnostic.config({
-- Disable virtual test next to affected regions
virtual_text = false,
-- Also disable virtual diagnostics under the affected regions
virtual_lines = false,
-- Show diagnostics signs
signs = true,
-- Underline offending regions
underline = true,
-- Do not bother me in the middle of insertion
update_in_insert = false,
-- Show highest severity first
severity_sort = true,
})
local opts = {
float = false,
}
-- Only show floating diagnostics if they are otherwise not displayed
local config = vim.diagnostic.config()
if not (config.virtual_text or config.virtual_lines) then
opts.float = true
end
if forward then
vim.diagnostic.goto_next(opts)
else
vim.diagnostic.goto_prev(opts)
end
end
--- Move to the next diagnostic, automatically showing the diagnostics float if
--- necessary.
M.goto_next_diagnostic = function()
goto_diagnostic(true)
end
--- Move to the previous diagnostic, automatically showing the diagnostics float
--- if necessary.
M.goto_prev_diagnostic = function()
goto_diagnostic(false)
end
--- shared LSP configuration callback
--- @param client native client configuration
--- @param bufnr int? buffer number of the attched client
M.on_attach = function(client, bufnr)
-- Format on save
lsp_format.on_attach(client, bufnr)

View file

@ -1,29 +1,29 @@
local M = {}
--- pretty print lua object
--- @param obj any object to pretty print
-- pretty print lua object
-- @param obj any object to pretty print
M.dump = function(obj)
print(vim.inspect(obj))
end
--- checks if a given command is executable
--- @param cmd string? command to check
--- @return boolean executable
---@param cmd string? command to check
---@return boolean executable
M.is_executable = function(cmd)
return cmd and vim.fn.executable(cmd) == 1
end
--- return a function that checks if a given command is executable
--- @param cmd string? command to check
--- @return fun(cmd: string): boolean executable
---@param cmd string? command to check
---@return fun(cmd: string): boolean executable
M.is_executable_condition = function(cmd)
return function()
return M.is_executable(cmd)
end
end
--- whether or not we are currently in an SSH connection
--- @return boolean ssh connection
-- whether or not we are currently in an SSH connection
-- @return boolean ssh connection
M.is_ssh = function()
local variables = {
"SSH_CONNECTION",
@ -40,9 +40,9 @@ M.is_ssh = function()
return false
end
--- list all active LSP clients for current buffer
--- @param bufnr int? buffer number
--- @return table all active LSP client names
-- list all active LSP clients for current buffer
-- @param bufnr int? buffer number
-- @return table all active LSP client names
M.list_lsp_clients = function(bufnr)
local clients = vim.lsp.buf_get_clients(bufnr)
local names = {}

View file

@ -37,7 +37,7 @@ cmp.setup({
entries = "native",
},
sources = {
{ name = "async_path", priority_weight = 110 },
{ name = "path", priority_weight = 110 },
{ name = "nvim_lsp", priority_weight = 100 },
{ name = "nvim_lua", priority_weight = 90 },
{ name = "luasnip", priority_weight = 80 },

View file

@ -2,22 +2,6 @@ local lspconfig = require("lspconfig")
local lsp = require("ambroisie.lsp")
local utils = require("ambroisie.utils")
-- Diagnostics
vim.diagnostic.config({
-- Disable virtual test next to affected regions
virtual_text = false,
-- Also disable virtual diagnostics under the affected regions
virtual_lines = false,
-- Show diagnostics signs
signs = true,
-- Underline offending regions
underline = true,
-- Do not bother me in the middle of insertion
update_in_insert = false,
-- Show highest severity first
severity_sort = true,
})
-- Inform servers we are able to do completion, snippets, etc...
local capabilities = require("cmp_nvim_lsp").default_capabilities()

Some files were not shown because too many files have changed in this diff Show more