Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
75b036b
Add CLAUDE.md to provide guidance for Claude Code
lambdalisue Jul 5, 2025
6bdfbe0
feat(source): add window source for listing Vim windows
lambdalisue Jul 6, 2025
ad2d410
feat(source): add tabpage source for listing Vim tab pages
lambdalisue Jul 6, 2025
9004a59
feat(source): add loclist source for listing location list items
lambdalisue Jul 6, 2025
d337686
feat(source): add colorscheme source for listing available colorschemes
lambdalisue Jul 6, 2025
d8a627c
feat(source): add highlight source for listing highlight groups
lambdalisue Jul 6, 2025
33e58cd
feat(source): add jumplist source for listing jump locations
lambdalisue Jul 6, 2025
fd1a7c8
feat(source): add register source for listing Vim registers
lambdalisue Jul 6, 2025
5006534
feat(source): add mark source for listing Vim marks
lambdalisue Jul 6, 2025
1c0e825
feat(source): add command source for listing user-defined commands
lambdalisue Jul 6, 2025
9c39f46
feat(source): add mapping source for listing key mappings
lambdalisue Jul 6, 2025
e8f21f1
feat(source): add git status source for listing modified files
lambdalisue Jul 6, 2025
881a059
feat(source): add grep source for vim's :grep command results
lambdalisue Jul 6, 2025
c3bf51b
feat(source): add vimgrep source for vim's :vimgrep command results
lambdalisue Jul 6, 2025
89e0265
feat(source): add autocmd source for vim autocmds
lambdalisue Jul 6, 2025
c74961d
feat(previewer): add shell command previewer
lambdalisue Jul 6, 2025
bfba569
feat(renderer): add file info renderer for displaying file metadata
lambdalisue Jul 6, 2025
8090011
feat(renderer): add buffer info renderer for displaying buffer metadata
lambdalisue Jul 6, 2025
0f0a8f2
feat(renderer): add smart grep renderer for formatting grep-like results
lambdalisue Jul 6, 2025
e9a3319
feat(refiner): add file info refiner for filtering by file properties
lambdalisue Jul 6, 2025
c166b92
feat(refiner): add buffer info refiner for filtering by buffer proper…
lambdalisue Jul 6, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 79 additions & 0 deletions builtin/source/colorscheme.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
import * as fn from "@denops/std/function";

import { defineSource, type Source } from "../../source.ts";

type Detail = {
/**
* Colorscheme name
*/
name: string;

/**
* Whether this is the current colorscheme
*/
current: boolean;
};

export type ColorschemeOptions = {
/**
* Whether to mark the current colorscheme.
* @default true
*/
markCurrent?: boolean;

/**
* The indicator string for the current colorscheme.
* @default "> "
*/
indicator?: string;
};

/**
* Creates a Source that generates items from available Vim colorschemes.
*
* This Source retrieves all available colorschemes and generates items
* for each one, optionally marking the currently active colorscheme.
*
* @param options - Options to customize colorscheme listing.
* @returns A Source that generates items representing colorschemes.
*/
export function colorscheme(
options: Readonly<ColorschemeOptions> = {},
): Source<Detail> {
const markCurrent = options.markCurrent ?? true;
return defineSource(async function* (denops, _params, { signal }) {
// Get list of all colorschemes
const colorschemes = await fn.getcompletion(
denops,
"",
"color",
) as string[];
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we really need this as string[] annotation?

signal?.throwIfAborted();

// Get current colorscheme if needed
let currentColorscheme = "";
if (markCurrent) {
const colors = await fn.execute(denops, "colorscheme") as string;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's better to use @core/unknownutil to check if the value is really string or not.

// Extract colorscheme name from output (removes whitespace and newlines)
currentColorscheme = colors.trim();
}

const items = colorschemes.map((name, index) => {
const isCurrent = markCurrent && name === currentColorscheme;
const indicator = options.indicator ?? "> ";
const prefix = isCurrent ? indicator : " ".repeat(indicator.length);
const suffix = isCurrent ? " (current)" : "";

return {
id: index,
value: `${prefix}${name}${suffix}`,
detail: {
name,
current: isCurrent,
},
};
});

yield* items;
});
}
1 change: 1 addition & 0 deletions builtin/source/mod.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// This file is generated by gen-mod.ts
export * from "./buffer.ts";
export * from "./colorscheme.ts";
export * from "./file.ts";
export * from "./helptag.ts";
export * from "./history.ts";
Expand Down