add some more hints on the default settings for neovim; just go with alejandra formatter; add more docs on qa

std
Hung 2023-06-17 20:32:15 -07:00
parent e7efe1a965
commit 6352f821c3
13 changed files with 296 additions and 210 deletions

View File

@ -0,0 +1,12 @@
# Neovim: Testing cmp for color with Tailwind
- [ ] It should detect a project uses tailwind, maybe via some kind of config file
(`tailwind.config.{cjs,mjs,js,ts,json,tsx,toml,yaml}`), or just based on the
string content or via tree-stiter. Check this by `:LspInfo` and `tailwindcss-lsp`
should attach to the current buffer that has tailwind-css string
- [ ] Type in a classname `text-red-500`, just stop at somewhere and start
browsing the cmp-lsp window. It should show a color in place of `lspkind`.
This validates `tailwindcss-colorizer-cmp.nvim` is good
- [ ] Hit that autocomplete, the string should show the color red. This validates
`nvim-colorizer.lua` is properly setup.

View File

@ -104,7 +104,7 @@ WPlug('kyazdani42/nvim-web-devicons') -- icons for folder and filetype
WPlug('m-demare/hlargs.nvim') -- highlights arguments; great for func prog
WPlug('folke/todo-comments.nvim') -- Highlights TODO
WPlug('NvChad/nvim-colorizer.lua') -- color highlighter with tailwind support
WPlug('roobert/tailwindcss-colorizer-cmp.nvim') -- color highlighter with tailwind support
WPlug('roobert/tailwindcss-colorizer-cmp.nvim') -- color for tailiwnd for compe
-- other utilities
WPlug('nvim-treesitter/nvim-treesitter-context') -- Top one-liner context of func/class scope
@ -112,6 +112,7 @@ WPlug('nvim-treesitter/playground') -- Sees Treesitter AST - less h
WPlug('saadparwaiz1/cmp_luasnip') -- snippet engine
WPlug('L3MON4D3/LuaSnip') -- snippet engine
WPlug('mickael-menu/zk-nvim') -- Zettelkasten
WPlug('folke/neodev.nvim') -- Neovim + lua development setup
-- Switch cases:
-- `gsp` -> PascalCase (classes), `gsc` -> camelCase (Java), `gs_` -> snake_case (C/C++/Rust)
-- `gsu` -> UPPER_CASE (CONSTs), `gsk` -> kebab-case (Clojure), `gsK` -> Title-Kebab-Case
@ -241,7 +242,57 @@ colorscheme gruvbox
]])
require('hlargs').setup()
require('nvim-web-devicons').setup()
require('trouble').setup()
require('trouble').setup {
position = "bottom", -- position of the list can be: bottom, top, left, right
height = 10, -- height of the trouble list when position is top or bottom
width = 50, -- width of the list when position is left or right
icons = true, -- use devicons for filenames
mode = "workspace_diagnostics", -- "workspace_diagnostics", "document_diagnostics", "quickfix", "lsp_references", "loclist"
severity = nil, -- nil (ALL) or vim.diagnostic.severity.ERROR | WARN | INFO | HINT
fold_open = "", -- icon used for open folds
fold_closed = "", -- icon used for closed folds
group = true, -- group results by file
padding = true, -- add an extra new line on top of the list
action_keys = {
-- key mappings for actions in the trouble list
-- map to {} to remove a mapping, for example:
-- close = {},
close = "q", -- close the list
cancel = "<esc>", -- cancel the preview and get back to your last window / buffer / cursor
refresh = "r", -- manually refresh
jump = { "<cr>", "<tab>" }, -- jump to the diagnostic or open / close folds
open_split = { "<c-x>" }, -- open buffer in new split
open_vsplit = { "<c-v>" }, -- open buffer in new vsplit
open_tab = { "<c-t>" }, -- open buffer in new tab
jump_close = { "o" }, -- jump to the diagnostic and close the list
toggle_mode = "m", -- toggle between "workspace" and "document" diagnostics mode
switch_severity = "s", -- switch "diagnostics" severity filter level to HINT / INFO / WARN / ERROR
toggle_preview = "P", -- toggle auto_preview
hover = "K", -- opens a small popup with the full multiline message
preview = "p", -- preview the diagnostic location
close_folds = { "zM", "zm" }, -- close all folds
open_folds = { "zR", "zr" }, -- open all folds
toggle_fold = { "zA", "za" }, -- toggle fold of current file
previous = "k", -- previous item
next = "j" -- next item
},
indent_lines = true, -- add an indent guide below the fold icons
auto_open = false, -- automatically open the list when you have diagnostics
auto_close = false, -- automatically close the list when you have no diagnostics
auto_preview = true, -- automatically preview the location of the diagnostic. <esc> to close preview and go back to last window
auto_fold = false, -- automatically fold a file trouble list at creation
auto_jump = { "lsp_definitions" }, -- for the given modes, automatically jump if there is only a single result
signs = {
-- icons / text used for a diagnostic
error = "",
warning = "",
hint = "",
information = "",
other = "",
},
use_diagnostic_signs = false -- enabling this will use the signs defined in your lsp client
}
-- TODO: Any way to collect all the TODOs and its variants?
require('todo-comments').setup()
@ -922,10 +973,10 @@ require('mason-lspconfig').setup_handlers({
defaultConfig = {
indent_style = "space",
indent_size = 4,
}
}
}
}
},
},
},
},
}
end,
["pyright"] = function()
@ -1002,7 +1053,7 @@ require('mason-lspconfig').setup_handlers({
settings = {
["nil"] = {
formatting = {
command = {"nix", "run", "nixpkgs#alejandra"},
command = { "nix", "run", "nixpkgs#alejandra" },
},
nix = {
flake = {

View File

@ -4,11 +4,14 @@
# Additional configurations goes to profiles/<user>
# or inlined in flake.nix
{
config, # Represents the realized final configuration
pkgs, # This is by default just ``= import <nixpkgs>{}`
config,
# Represents the realized final configuration
pkgs,
# This is by default just ``= import <nixpkgs>{}`
myHome,
myLib,
option, # The options we're given, this might be useful for typesafety?
option,
# The options we're given, this might be useful for typesafety?
proj_root,
...
}: let

View File

@ -9,7 +9,8 @@
pkgs.callPackage
({runCommand}:
# runCommand source: https://github.com/NixOS/nixpkgs/blob/master/pkgs/build-support/trivial-builders.nix#L33
runCommand outputPath {
runCommand outputPath
{
inherit yamlContent;
nativeBuildInputs = [pkgs.yq];
}

View File

@ -3,7 +3,8 @@
{
pkgs,
lib,
naersk, # rust packages
naersk,
# rust packages
...
} @ pkgs_input: {
# dot-hwtr = import "./dot-hwtr" pkgs_input;

View File

@ -4,9 +4,11 @@
lib,
...
}:
with builtins; with lib; let
with builtins;
with lib; let
pkgs2storeContents = l:
map (x: {
map
(x: {
object = x;
symlink = "none";
})

View File

@ -4,7 +4,8 @@
config,
...
}:
with builtins; with lib; {
with builtins;
with lib; {
imports = [
(mkRenamedOptionModule ["wsl" "compatibility" "interopPreserveArgvZero"] ["wsl" "interop" "preserveArgvZero"])
];

View File

@ -4,7 +4,8 @@
config,
...
}:
with builtins; with lib; {
with builtins;
with lib; {
options.wsl = with types; let
coercedToStr = coercedTo (oneOf [bool path int]) toString str;
in {

View File

@ -2,5 +2,4 @@
inputs,
cell,
}: let
in {
}
in {}

View File

@ -1,5 +1,4 @@
{
inputs,
cell,
}: {
}
}: {}

View File

@ -1,11 +1,14 @@
# This is an interface for home-profiles and should not contain opinionated
# configurations. It should provide alternative configurations, aggregates
# or new configurations
_imports@{inputs, cell}: let
_imports@{ inputs, cell }:
let
namespace = "repo";
imports = _imports // {inherit namespace;};
in {
git = { config , lib , ... }: let
imports = _imports // { inherit namespace; };
in
{
git = { config, lib, ... }:
let
cfg = config."${namespace}".git;
baseAliases = {
a = "add";
@ -20,7 +23,8 @@ in {
};
default-user = "Pegasust";
default-email = "pegasucksgg@gmail.com";
in {
in
{
options."${namespace}".git = {
aliases = lib.mkOption {
type = lib.types.attrs;
@ -87,10 +91,12 @@ in {
};
};
alacritty = {config, lib}: let
alacritty = { config, lib }:
let
inherit (inputs.cells.repo.lib) fromYAML;
cfg = config."${namespace}".alacritty;
in {
in
{
options."${namespace}".alacritty = {
font.family = lib.mkOption {
type = lib.types.nullOr lib.types.singleLineStr;
@ -125,9 +131,13 @@ in {
};
config.programs.alacritty = {
enable = cfg.enable;
settings = let ;
actualConfig = if cfg.config-path != null then fromYAML (builtins.readFile cfg.config-path) else {};
in lib.recursiveUpdate actualConfig {
settings =
let
;
actualConfig =
if cfg.config-path != null then fromYAML (builtins.readFile cfg.config-path) else { };
in
lib.recursiveUpdate actualConfig {
font.normal.family = lib.mkIf (font.family != null) font.family;
font.size = lib.mkIf (font.size != null) font.size;
};
@ -135,9 +145,11 @@ in {
};
# TODO: chromium is not really supported on darwin
private_chromium = { config, pkgs, lib, ... }: let
private_chromium = { config, pkgs, lib, ... }:
let
cfg = config."${namespace}".private_chromium;
in {
in
{
options."${namespace}".private_chromium = {
enable = lib.mkOption {
type = lib.types.bool;

View File

@ -1,36 +1,39 @@
{inputs, cell}: let
{ inputs, cell }:
let
namespace = "repo";
yamlToJsonDrv = pkgs: yamlContent: outputPath: (pkgs.runCommand
outputPath { inherit yamlContent; nativeBuildInputs = [ pkgs.yq ]; }
outputPath
{ inherit yamlContent; nativeBuildInputs = [ pkgs.yq ]; }
# run yq which outputs '.' (no filter) on file at yamlPath
# note that $out is passed onto the bash/sh script for execution
''
echo "$yamlContent" | yq >$out
'')
{ });
in {
in
{
fromYAML = yamlContent: bulitins.fromJSON (builtins.readFile (yamlToJsonDrv inputs.nixpkgs yamlContent "fromYaml.json"));
# NOTE: Deprecate
# ctor
opt-some = a: [a];
opt-none = [];
opt-none_thunk = _: [];
opt-some = a: [ a ];
opt-none = [ ];
opt-none_thunk = _: [ ];
# from-to null
opt-fromNullable = nullable: if nullable == null then [] else [nullable];
opt-fromNullable = nullable: if nullable == null then [ ] else [ nullable ];
opt-toNullable = opt-fork (a:a) (_: null);
opt-map = builtins.map;
opt-filter = builtins.filter;
opt-fork = on_some: on_none: opt: if opt == [] then (on_none null) else (on_some (builtins.elemAt opt 0));
opt-fork = on_some: on_none: opt: if opt == [ ] then (on_none null) else (on_some (builtins.elemAt opt 0));
opt-unwrap = opt-fork (a:a) (_: throw "opt-unwrap: expected some, got none");
opt-unwrapOrElse = opt-fork (a:a);
opt-unwrapOr = fallback_val: opt-fork (a:a) (_: fallback_val);
opt-orElse = opt: fallback_opt: opt-fork (opt-some) (opt-none_thunk) (opt ++ fallback_opt);
opt-leftmostSome = opts: builtins.foldl' (opt-orElse) [] opts;
opt-leftmostSome = opts: builtins.foldl' (opt-orElse) [ ] opts;
}

View File

@ -64,8 +64,7 @@
rev = info.rev;
shortRev = builtins.substring 0 7 info.rev;
}
else {
}
else {}
)
else if info.type == "path"
then {
@ -112,7 +111,9 @@
callFlake4 = flakeSrc: locks: let
flake = import (flakeSrc + "/flake.nix");
inputs = builtins.mapAttrs (n: v:
inputs =
builtins.mapAttrs
(n: v:
if v.flake or true
then callFlake4 (fetchTree (v.locked // v.info)) v.inputs
else fetchTree (v.locked // v.info))