├── .github └── workflows │ └── molt.yml ├── .gitignore ├── LICENSE ├── README.md ├── denops └── @ddu-columns │ └── icon_filename.ts └── doc └── ddu-column-icon_filename.txt /.github/workflows/molt.yml: -------------------------------------------------------------------------------- 1 | name: molt 2 | 3 | on: 4 | schedule: 5 | - cron: "0 0 * * 0" 6 | workflow_dispatch: 7 | 8 | jobs: 9 | udd: 10 | runs-on: ubuntu-latest 11 | steps: 12 | - uses: actions/checkout@v4 13 | 14 | - name: Setup Deno 15 | uses: denoland/setup-deno@v1 16 | with: 17 | deno-version: "1.x" 18 | 19 | - name: Update dependencies 20 | run: deno run -A jsr:@molt/cli $(find . -name "*.ts") --write 21 | 22 | - name: Create Pull Request 23 | uses: peter-evans/create-pull-request@v6 24 | with: 25 | commit-message: "Update deno dependencies" 26 | title: "Update Deno dependencies" 27 | body: > 28 | Automated updates by [@molt/cli](https://github.com/hasundue/molt) 29 | and [create-pull-request](https://github.com/peter-evans/create-pull-request) 30 | GitHub action 31 | branch: update-deno-dependencies 32 | author: GitHub 33 | delete-branch: true 34 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022 ryota2357 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ddu-column-icon_filename 2 | 3 | Icon and filename column for ddu.vim 4 | 5 | ## Required 6 | 7 | ### denops.vim 8 | 9 | https://github.com/vim-denops/denops.vim 10 | 11 | ### ddu.vim 12 | 13 | https://github.com/Shougo/ddu.vim 14 | 15 | ## Configuration 16 | 17 | ```vim 18 | call ddu#custom#patch_global({ 19 | \ 'columns': ['icon_filename'], 20 | \ }) 21 | ``` 22 | 23 | ## Screenshots 24 | 25 | filer 26 | 27 | ff 28 | 29 | ### Screenshots config 30 | 31 | ```vim 32 | call ddu#custom#alias('column', 'icon_filename_for_ff', 'icon_filename') 33 | call ddu#custom#patch_global({ 34 | \ sourceOptions: #{ 35 | \ file: #{ 36 | \ columns: ['icon_filename'] 37 | \ }, 38 | \ file_rec: #{ 39 | \ columns: ['icon_filename_for_ff'] 40 | \ }, 41 | \ }, 42 | \ columnParams: #{ 43 | \ icon_filename: #{ 44 | \ defaultIcon: #{ icon = '' }, 45 | \ }, 46 | \ icon_filename_for_ff: #{ 47 | \ defaultIcon: #{ icon = '' }, 48 | \ padding = 0, 49 | \ pathDisplayOption = 'relative' 50 | \ } 51 | \ } 52 | \ }) 53 | ``` 54 | -------------------------------------------------------------------------------- /denops/@ddu-columns/icon_filename.ts: -------------------------------------------------------------------------------- 1 | import { 2 | BaseColumn, 3 | DduItem, 4 | ItemHighlight, 5 | } from "https://deno.land/x/ddu_vim@v4.0.0/types.ts"; 6 | import { GetTextResult } from "https://deno.land/x/ddu_vim@v4.0.0/base/column.ts"; 7 | import { Denops, fn } from "https://deno.land/x/ddu_vim@v4.0.0/deps.ts"; 8 | import { 9 | basename, 10 | extname, 11 | relative, 12 | } from "https://deno.land/std@0.224.0/path/mod.ts"; 13 | 14 | type Params = { 15 | span: number; 16 | padding: number; 17 | pathDisplayOption: "basename" | "relative"; 18 | defaultIcon: IconParam; 19 | linkIcon: IconParam; 20 | useLinkIcon: "always" | "grayout" | "default" | "none"; 21 | customSpecialIcons: Record; 22 | customFileIcons: Record; 23 | colors: Record; 24 | }; 25 | 26 | type ActionData = { 27 | isDirectory?: boolean; 28 | isLink?: boolean; 29 | path?: string; 30 | }; 31 | 32 | type IconParam = { 33 | icon?: string; 34 | color?: string; 35 | }; 36 | 37 | type IconData = { 38 | icon: string; 39 | hl_group: string; 40 | color: string; 41 | }; 42 | 43 | const textEncoder = new TextEncoder(); 44 | 45 | export class Column extends BaseColumn { 46 | public override async getLength(args: { 47 | denops: Denops; 48 | columnParams: Params; 49 | items: DduItem[]; 50 | }): Promise { 51 | const cwd = await fn.getcwd(args.denops); 52 | const lengths = await Promise.all( 53 | args.items.map(async (item) => { 54 | const action = item?.action as ActionData; 55 | 56 | let filename: string; 57 | switch (args.columnParams.pathDisplayOption) { 58 | case "basename": 59 | filename = this.getBasenameFilename( 60 | action.path ?? item.word, 61 | action.isDirectory ?? false, 62 | ); 63 | break; 64 | case "relative": 65 | filename = this.getRelativeFilename( 66 | cwd, 67 | action.path ?? item.word, 68 | action.isDirectory ?? false, 69 | ); 70 | break; 71 | } 72 | 73 | const iconData = this.getIcon( 74 | // NOTE: If pass `filename` as 1st args, `getIcon()` does not handle specialIcon correctly 75 | this.getBasenameFilename( 76 | action.path ?? item.word, 77 | action.isDirectory ?? false, 78 | ), 79 | item.__expanded, 80 | action.isLink ?? false, 81 | args.columnParams, 82 | ); 83 | 84 | const indent = item.__level + args.columnParams.padding; 85 | const iconByteLength = textEncoder.encode(iconData.icon).length; 86 | const span = args.columnParams.span; 87 | const itemLength = await fn.strlen(args.denops, filename); 88 | 89 | return indent + iconByteLength + span + itemLength; 90 | }), 91 | ); 92 | return Math.max(...lengths); 93 | } 94 | 95 | public override async getText(args: { 96 | denops: Denops; 97 | columnParams: Params; 98 | startCol: number; 99 | endCol: number; 100 | item: DduItem; 101 | }): Promise { 102 | const action = args.item?.action as ActionData; 103 | const highlights: ItemHighlight[] = []; 104 | 105 | let filename: string; 106 | switch (args.columnParams.pathDisplayOption) { 107 | case "basename": 108 | filename = this.getBasenameFilename( 109 | action.path ?? args.item.word, 110 | action.isDirectory ?? false, 111 | ); 112 | break; 113 | case "relative": 114 | filename = this.getRelativeFilename( 115 | await fn.getcwd(args.denops), 116 | action.path ?? args.item.word, 117 | action.isDirectory ?? false, 118 | ); 119 | break; 120 | } 121 | 122 | const iconData = this.getIcon( 123 | // NOTE: If pass `filename` as 1st args, `getIcon()` does not handle specialIcon correctly 124 | this.getBasenameFilename( 125 | action.path ?? args.item.word, 126 | action.isDirectory ?? false, 127 | ), 128 | args.item.__expanded, 129 | action.isLink ?? false, 130 | args.columnParams, 131 | ); 132 | 133 | // create text 134 | const indent = this.whitespace( 135 | args.item.__level + args.columnParams.padding, 136 | ); 137 | const span = this.whitespace(args.columnParams.span); 138 | const body = indent + iconData.icon + span + filename; 139 | const bodyLength = await fn.strlen(args.denops, body); 140 | const padding = this.whitespace( 141 | Math.max(0, args.endCol - args.startCol - bodyLength), 142 | ); 143 | const text = body + padding; 144 | 145 | // set highlight 146 | const hl_group = `ddu_column_${iconData.hl_group}`; 147 | const iconByteLength = textEncoder.encode(iconData.icon).length; 148 | const color = (() => { 149 | const col = iconData.color; 150 | return col.startsWith("!") 151 | ? args.columnParams.colors[col.slice(1)] ?? 152 | defaultColors.get(col.slice(1)) ?? 153 | defaultColors.get("default")! 154 | : col; 155 | })(); 156 | highlights.push({ 157 | name: "column-icons-icon", 158 | hl_group: hl_group, 159 | col: args.startCol + args.columnParams.padding + args.item.__level, 160 | width: iconByteLength, 161 | }); 162 | if (color.startsWith("#")) { 163 | await args.denops.cmd(`hi default ${hl_group} guifg=${color}`); 164 | } else { 165 | await args.denops.cmd(`hi default link ${hl_group} ${color}`); 166 | } 167 | 168 | return { 169 | text: text, 170 | highlights: highlights, 171 | }; 172 | } 173 | 174 | public override params(): Params { 175 | return { 176 | span: 1, 177 | padding: 1, 178 | pathDisplayOption: "basename", 179 | defaultIcon: { icon: " ", color: "!default" }, 180 | linkIcon: { icon: "", color: "#808080" }, 181 | useLinkIcon: "always", 182 | customSpecialIcons: {}, 183 | customFileIcons: {}, 184 | colors: {}, 185 | }; 186 | } 187 | 188 | private whitespace(count: number): string { 189 | return " ".repeat(Math.max(0, count)); 190 | } 191 | 192 | private getBasenameFilename(path: string, isDirectory: boolean): string { 193 | return basename(path) + (isDirectory ? "/" : ""); 194 | } 195 | 196 | private getRelativeFilename( 197 | cwd: string, 198 | path: string, 199 | isDirectory: boolean, 200 | ): string { 201 | return relative(cwd, path) + (isDirectory ? "/" : ""); 202 | } 203 | 204 | // case(1): isLink? and useLinkIcon == always 205 | // return linkIcon 206 | // case(2): match specialIcons 207 | // return customSpecialIcon ?? specialIcon.marge(useLinkIcon == "grayout) 208 | // case(3): isDirectory? 209 | // return folderIcons 210 | // case(4): match fileIcons 211 | // return customFileIcon ?? fileIcon.marge(useLinkIcon == "grayout") 212 | // case(5): isLink? and useLinkIcon == "default" 213 | // return linkIcon 214 | // return defaultIcon 215 | private getIcon( 216 | fname: string, 217 | expanded: boolean, 218 | isLink: boolean, 219 | params: Params, 220 | ): IconData { 221 | const isDirectory = fname[fname.length - 1] == "/"; 222 | const linkIcon = (() => { 223 | const icon = params.linkIcon.icon ?? ""; 224 | const color = params.linkIcon.color ?? "#808080"; 225 | return { 226 | icon: icon, 227 | hl_group: "link", 228 | color: color, 229 | }; 230 | })(); 231 | 232 | // case(1) 233 | if (isLink && params.useLinkIcon == "always") return linkIcon; 234 | 235 | // case(2) 236 | const sp = (() => { 237 | const name = fname.toLowerCase(); 238 | const custom = params.customSpecialIcons[name]; 239 | const builtin = specialIcons.get(name); 240 | return custom 241 | ? ({ 242 | icon: custom.icon ?? builtin?.icon, 243 | color: custom.color ?? builtin?.color, 244 | hl_group: "csp_" + (custom.icon?.charCodeAt(0) ?? 0).toString(), 245 | } as IconData) 246 | : builtin; 247 | })(); 248 | if (sp) { 249 | if (isLink && params.useLinkIcon == "grayout") { 250 | sp.hl_group = linkIcon.hl_group; 251 | sp.color = linkIcon.color; 252 | } 253 | return sp; 254 | } 255 | 256 | // case(3) 257 | if (isDirectory) { 258 | return expanded ? folderIcons.expand : folderIcons.collaps; 259 | } 260 | 261 | // case(4) 262 | const file = (() => { 263 | const ext = extname(fname).substring(1); 264 | const custom = params.customFileIcons[ext]; 265 | const builtin = fileIcons.get(ext); 266 | return custom 267 | ? ({ 268 | icon: custom.icon ?? builtin?.icon, 269 | color: custom.color ?? builtin?.color, 270 | hl_group: "cfile_" + (custom.icon?.charCodeAt(0) ?? 0).toString(), 271 | } as IconData) 272 | : builtin; 273 | })(); 274 | if (file) { 275 | if (isLink && params.useLinkIcon == "grayout") { 276 | file.hl_group = linkIcon.hl_group; 277 | file.color = linkIcon.color; 278 | } 279 | return file; 280 | } 281 | 282 | // case(5) 283 | if (isLink && params.useLinkIcon != "none") return linkIcon; 284 | 285 | // default 286 | const defoIcon = params.defaultIcon.icon ?? " "; 287 | const defoColor = params.defaultIcon.color ?? "Normal"; 288 | return { 289 | icon: defoIcon, 290 | hl_group: "file_default", 291 | color: defoColor, 292 | }; 293 | } 294 | } 295 | 296 | const defaultColors = new Map([ 297 | ["default", "Normal"], 298 | ["aqua", "#3AFFDB"], 299 | ["beige", "#F5C06F"], 300 | ["blue", "#689FB6"], 301 | ["brown", "#905532"], 302 | ["darkBlue", "#44788E"], 303 | ["darkOrange", "#F16529"], 304 | ["green", "#8FAA54"], 305 | ["lightGreen", "#31B53E"], 306 | ["lightPurple", "#834F79"], 307 | ["orange", "#D4843E"], 308 | ["pink", "#CB6F6F"], 309 | ["purple", "#834F79"], 310 | ["red", "#AE403F"], 311 | ["salmon", "#EE6E73"], 312 | ["yellow", "#F09F17"], 313 | ]); 314 | 315 | // for preventing typo 316 | const palette = { 317 | default: "!default", 318 | aqua: "!aqua", 319 | beige: "!beige", 320 | blue: "!blue", 321 | brown: "!brown", 322 | darkBlue: "!darkBlue", 323 | darkOrange: "!darkOrange", 324 | green: "!green", 325 | lightGreen: "!lightGreen", 326 | lightPurple: "!lightPurple", 327 | orange: "!orange", 328 | pink: "!pink", 329 | purple: "!purple", 330 | red: "!red", 331 | salmon: "!salmon", 332 | yellow: "!yellow", 333 | }; 334 | 335 | const folderIcons: Record<"expand" | "collaps", IconData> = { 336 | expand: { icon: "", hl_group: "folder_expand", color: "Directory" }, 337 | collaps: { icon: "", hl_group: "folder_collaps", color: "Directory" }, 338 | }; 339 | 340 | // deno-fmt-ignore-start 341 | const specialIcons = new Map([ // nerd font class name 342 | [".bashrc", { icon: "", hl_group: "sp_bashrc", color: palette.default }], // nf-dev-terminal 343 | [".ds_store", { icon: "", hl_group: "sp_ds_store", color: palette.default }], // nf-dev-aptana 344 | [".editorconfig", { icon: "", hl_group: "sp_editorconfig", color: palette.default }], // nf-dev-aptana 345 | [".eslintrc.js", { icon: "", hl_group: "sp_eslintrc", color: palette.purple }], // nf-seti-eslint 346 | [".eslintrc.json", { icon: "", hl_group: "sp_eslintrc", color: palette.purple }], // nf-seti-eslint 347 | [".eslintrc.yaml", { icon: "", hl_group: "sp_eslintrc", color: palette.purple }], // nf-seti-eslint 348 | [".eslintrc.yml", { icon: "", hl_group: "sp_eslintrc", color: palette.purple }], // nf-seti-eslint 349 | [".git/", { icon: "", hl_group: "sp_git", color: "Directory" }], // nf-custom-folder_git 350 | [".gitconfig", { icon: "", hl_group: "sp_gitconfig", color: palette.default }], // nf-dev-aptana 351 | [".github/", { icon: "", hl_group: "sp_github", color: "Directory" }], // nf-custom-folder_github 352 | [".gitignore", { icon: "", hl_group: "sp_gitignore", color: palette.darkOrange }], // nf-dev-git 353 | [".gitlab-ci.yml", { icon: "", hl_group: "sp_gitlab_ci", color: palette.default }], // nf-fa-gitlab 354 | [".vimrc", { icon: '', hl_group: "sp_vimrc", color: palette.green }], // nf-dev-vim 355 | [".vscode", { icon: "", hl_group: "sp_vscode", color: "Directory" }], // nf-dev-visualstudio 356 | [".zshrc", { icon: "", hl_group: "sp_zshrc", color: palette.default }], // nf-dev-terminal 357 | ["changelog", { icon: "", hl_group: "sp_changelog", color: palette.green }], // nf-fa-history 358 | ["changelog.md", { icon: "", hl_group: "sp_changelog", color: palette.green }], // nf-fa-history 359 | ["config.ru", { icon: "", hl_group: "sp_config_ru", color: palette.default }], // nf-dev-ruby 360 | ["docker-compose.yaml", { icon: "", hl_group: "sp_dockercompose", color: palette.yellow }], // nf-dev-docker 361 | ["docker-compose.yml", { icon: "", hl_group: "sp_dockercompose", color: palette.yellow }], // nf-dev-docker 362 | ["dockerfile", { icon: "", hl_group: "sp_license", color: palette.blue }], // nf-dev-docker 363 | ["dropbox/", { icon: "", hl_group: "sp_dropbox", color: "Directory" }], // nf-dev-dropbox 364 | ["favicon.ico", { icon: "", hl_group: "sp_favicon", color: palette.yellow }], // nf-seti-favicon 365 | ["init.vim", { icon: "", hl_group: "sp_neovim", color: palette.green }], // nf-custom-neovim 366 | ["license", { icon: "", hl_group: "sp_license", color: palette.default }], // nf-seti-license 367 | ["license.md", { icon: "", hl_group: "sp_license", color: palette.default }], // nf-seti-license 368 | ["license.txt", { icon: "", hl_group: "sp_license", color: palette.default }], // nf-seti-license 369 | ["makefile", { icon: "", hl_group: "sp_gitconfig", color: palette.default }], // nf-dev-aptana 370 | ["node_modules/", { icon: "", hl_group: "sp_node_module", color: "Directory" }], // nf-dev-nodejs_small 371 | ["readme", { icon: "", hl_group: "sp_readme", color: palette.yellow }], // nf-seti-markdown 372 | ["readme.md", { icon: "", hl_group: "sp_readme", color: palette.yellow }], // nf-seti-markdown 373 | ["tailwind.config.cjs", { icon: "󱏿", hl_group: "sp_tailwind", color: palette.darkBlue }], // nf-md-tailwind 374 | ["tailwind.config.js", { icon: "󱏿", hl_group: "sp_tailwind", color: palette.darkBlue }], // nf-md-tailwind 375 | ]); 376 | // deno-fmt-ignore-end 377 | 378 | // deno-fmt-ignore-start 379 | const fileIcons = new Map([ // nerd font class name 380 | ["ai", { icon: "", hl_group: "file_ai", color: palette.darkOrange }], // nf-dev-illustrator 381 | ["apk", { icon: "", hl_group: "file_apk", color: palette.green }], // nf-dev-android 382 | ["astro", { icon: "", hl_group: "file_astro", color: palette.orange }], // nf-custom-astro 383 | ["awk", { icon: "", hl_group: "file_awk", color: palette.default }], // nf-dev-terminal 384 | ["bash", { icon: "", hl_group: "file_bash", color: palette.default }], // nf-dev-terminal 385 | ["bat", { icon: "", hl_group: "file_bat", color: palette.default }], // nf-dev-aptana 386 | ["bib", { icon: "", hl_group: "file_tex", color: palette.default }], // nf-seti-tex 387 | ["blend", { icon: "󰂫", hl_group: "file_blend", color: palette.darkOrange }], // nf-md-blender_software 388 | ["bmp", { icon: "", hl_group: "file_bmp", color: palette.aqua }], // nf-fa-file_image_o 389 | ["c", { icon: "", hl_group: "file_c", color: palette.blue }], // nf-custom-c 390 | ["cc", { icon: "", hl_group: "file_cc", color: palette.blue }], // nf-custom-cpp 391 | ["cjs", { icon: "", hl_group: "file_cjs", color: palette.beige }], // nf-dev-javascript 392 | ["clj", { icon: "", hl_group: "file_clj", color: palette.green }], // nf-dev-clojure 393 | ["cljc", { icon: "", hl_group: "file_cljc", color: palette.green }], // nf-dev-clojure 394 | ["cljs", { icon: "", hl_group: "file_cljs", color: palette.green }], // nf-dev-clojure_alt 395 | ["coffee", { icon: "", hl_group: "file_coffee", color: palette.brown }], // nf-dev-coffeescript 396 | ["conf", { icon: "", hl_group: "file_conf", color: palette.default }], // nf-dev-aptana 397 | ["cpp", { icon: "", hl_group: "file_cpp", color: palette.blue }], // nf-custom-cpp 398 | ["cs", { icon: "󰌛", hl_group: "file_cs", color: palette.blue }], // nf-md-language_csharp 399 | ["csh", { icon: "", hl_group: "file_csh", color: palette.default }], // nf-dev-terminal 400 | ["css", { icon: "", hl_group: "file_css", color: palette.blue }], // nf-dev-css3 401 | ["csv", { icon: "", hl_group: "file_csv", color: palette.lightGreen }], // nf-fa-file_excel_o 402 | ["d", { icon: "", hl_group: "file_d", color: palette.red }], // nf-dev-dlangd 403 | ["dart", { icon: "", hl_group: "file_dart", color: palette.blue }], // nf-dev-dart 404 | ["db", { icon: "", hl_group: "file_db", color: palette.blue }], // nf-fa-database 405 | ["doc", { icon: "", hl_group: "file_doc", color: palette.darkBlue }], // nf-fa-file_word_o 406 | ["dockerfile",{ icon: "", hl_group: "file_dockerfile", color: palette.blue }], // nf-dev-docker 407 | ["docx", { icon: "", hl_group: "file_docx", color: palette.darkBlue }], // nf-fa-file_word_o 408 | ["dot", { icon: "󱁊", hl_group: "file_dot", color: palette.darkBlue }], // nf-md-graph_outline 409 | ["elm", { icon: "", hl_group: "file_elm", color: palette.default }], // nf-custom-elm 410 | ["ex", { icon: "", hl_group: "file_ex", color: palette.lightPurple }], // nf-custom-elixir 411 | ["exs", { icon: "", hl_group: "file_exs", color: palette.lightPurple }], // nf-custom-elixir 412 | ["fish", { icon: "", hl_group: "file_fish", color: palette.green }], // nf-dev-terminal 413 | ["fs", { icon: "", hl_group: "file_fs", color: palette.blue }], // nf-dev-fsharp 414 | ["fsx", { icon: "", hl_group: "file_fsx", color: palette.blue }], // nf-dev-fsharp 415 | ["gif", { icon: "", hl_group: "file_gif", color: palette.aqua }], // nf-fa-file_image_o 416 | ["go", { icon: "", hl_group: "file_go", color: palette.beige }], // nf-dev-go 417 | ["gz", { icon: "", hl_group: "file_gz", color: palette.default }], // nf-oct-file_zip 418 | ["h", { icon: "", hl_group: "file_h", color: palette.default }], // nf-fa-h_square 419 | ["hpp", { icon: "", hl_group: "file_hpp", color: palette.default }], // nf-fa-h_square 420 | ["hs", { icon: "", hl_group: "file_hs", color: palette.beige }], // nf-dev-haskell 421 | ["html", { icon: "", hl_group: "file_html", color: palette.darkOrange }], // nf-dev-html5 422 | ["ico", { icon: "", hl_group: "file_ico", color: palette.aqua }], // nf-fa-file_image_o 423 | ["java", { icon: "", hl_group: "file_java", color: palette.purple }], // nf-dev-java 424 | ["jl", { icon: "", hl_group: "file_jl", color: palette.purple }], // nf-seti-julia 425 | ["jpeg", { icon: "", hl_group: "file_jpeg", color: palette.aqua }], // nf-fa-file_image_o 426 | ["jpg", { icon: "", hl_group: "file_jpg", color: palette.aqua }], // nf-fa-file_image_o 427 | ["js", { icon: "", hl_group: "file_js", color: palette.beige }], // nf-dev-javascript 428 | ["json", { icon: "", hl_group: "file_json", color: palette.beige }], // nf-seti-json 429 | ["jsx", { icon: "", hl_group: "file_jsx", color: palette.blue }], // nf-dev-react 430 | ["lock", { icon: "", hl_group: "file_lock", color: palette.beige }], // nf-fa-lock 431 | ["log", { icon: "", hl_group: "file_log", color: palette.yellow }], // nf-oct-file 432 | ["lua", { icon: "󰢱", hl_group: "file_lua", color: palette.purple }], // nf-md-language_lua 433 | ["md", { icon: "", hl_group: "file_md", color: palette.blue }], // nf-dev-markdown 434 | ["mdx", { icon: "", hl_group: "file_mdx", color: palette.blue }], // nf-dev-markdown 435 | ["mjs", { icon: "", hl_group: "file_mjs", color: palette.beige }], // nf-dev-javascript 436 | ["mov", { icon: "", hl_group: "file_mov", color: palette.orange }], // nf-fa-file_movie_o 437 | ["mp3", { icon: "", hl_group: "file_mp3", color: palette.salmon }], // nf-fa-file_audio_o 438 | ["mp4", { icon: "", hl_group: "file_mp4", color: palette.orange }], // nf-fa-file_movie_o 439 | ["otf", { icon: "", hl_group: "file_otf", color: palette.red }], // nf-fa-font 440 | ["pdf", { icon: "", hl_group: "file_pdf", color: palette.darkOrange }], // nf-fa-file_pdf_o 441 | ["php", { icon: "", hl_group: "file_php", color: palette.purple }], // nf-dev-php 442 | ["pl", { icon: "", hl_group: "file_pl", color: palette.blue }], // nf-dev-perl 443 | ["pm", { icon: "", hl_group: "file_pm", color: palette.blue }], // nf-dev-perl 444 | ["png", { icon: "", hl_group: "file_png", color: palette.aqua }], // nf-fa-file_image_o 445 | ["pp", { icon: "", hl_group: "file_pp", color: palette.default }], // nf-oct-beaker 446 | ["ppm", { icon: "", hl_group: "file_ppm", color: palette.aqua }], // nf-fa-file_image_o 447 | ["ppt", { icon: "", hl_group: "file_ppt", color: palette.orange }], // nf-fa-file_powerpoint_o 448 | ["pptx", { icon: "", hl_group: "file_pptx", color: palette.orange }], // nf-fa-file_powerpoint_o 449 | ["psd", { icon: "", hl_group: "file_psd", color: palette.darkBlue }], // nf-dev-photoshop 450 | ["py", { icon: "", hl_group: "file_py", color: palette.yellow }], // nf-dev-python 451 | ["rake", { icon: "", hl_group: "file_rake", color: palette.red }], // nf-dev-ruby_rough 452 | ["rb", { icon: "", hl_group: "file_rb", color: palette.red }], // nf-dev-ruby_rough 453 | ["rmd", { icon: "", hl_group: "file_rmd", color: palette.blue }], // nf-dev-markdown 454 | ["rs", { icon: "", hl_group: "file_rs", color: palette.red }], // nf-dev-rust 455 | ["rss", { icon: "", hl_group: "file_rss", color: palette.darkOrange }], // nf-fa-rss 456 | ["sass", { icon: "", hl_group: "file_sass", color: palette.default }], // nf-dev-sass 457 | ["scala", { icon: "", hl_group: "file_scala", color: palette.red }], // nf-dev-scala 458 | ["scm", { icon: "", hl_group: "file_scm", color: palette.salmon }], // nf-custom-scheme 459 | ["scss", { icon: "", hl_group: "file_scss", color: palette.pink }], // nf-dev-sass 460 | ["sh", { icon: "", hl_group: "file_sh", color: palette.lightPurple }], // nf-dev-terminal 461 | ["slim", { icon: "", hl_group: "file_slim", color: palette.orange }], // nf-seti-html 462 | ["sln", { icon: "", hl_group: "file_sln", color: palette.purple }], // nf-dev-visualstudio 463 | ["styl", { icon: "", hl_group: "file_styl", color: palette.green }], // nf-dev-stylus 464 | ["sty", { icon: "", hl_group: "file_tex", color: palette.default }], // nf-seti-tex 465 | ["swift", { icon: "", hl_group: "file_swift", color: palette.orange }], // nf-dev-swift 466 | ["tex", { icon: "", hl_group: "file_tex", color: palette.default }], // nf-seti-tex 467 | ["toml", { icon: "", hl_group: "file_toml", color: palette.default }], // nf-custom-toml 468 | ["ts", { icon: "", hl_group: "file_ts", color: palette.blue }], // nf-seti-typescript 469 | ["tsx", { icon: "", hl_group: "file_tsx", color: palette.blue }], // nf-dev-react 470 | ["ttf", { icon: "", hl_group: "file_ttf", color: palette.red }], // nf-fa-font 471 | ["txt", { icon: "", hl_group: "file_txt", color: palette.default }], // nf-fa-file_text 472 | ["vim", { icon: "", hl_group: "file_vim", color: palette.green }], // nf-dev-vim 473 | ["vue", { icon: "󰡄", hl_group: "file_vue", color: palette.green }], // nf-md-vuejs 474 | ["webp", { icon: "", hl_group: "file_webp", color: palette.aqua }], // nf-fa-file_image_o 475 | ["woff", { icon: "", hl_group: "file_woff", color: palette.red }], // nf-fa-font 476 | ["woff2", { icon: "", hl_group: "file_woff2", color: palette.red }], // nf-fa-font 477 | ["xls", { icon: "", hl_group: "file_xls", color: palette.lightGreen }], // nf-fa-file_excel_o 478 | ["xlsx", { icon: "", hl_group: "file_xlsx", color: palette.lightGreen }], // nf-fa-file_excel_o 479 | ["yaml", { icon: "", hl_group: "file_yaml", color: palette.default }], // nf-dev-aptana 480 | ["yml", { icon: "", hl_group: "file_yml", color: palette.default }], // nf-dev-aptana 481 | ["zip", { icon: "", hl_group: "file_zip", color: palette.default }], // nf-oct-file_zip 482 | ["zsh", { icon: "", hl_group: "file_zsh", color: palette.default }], // nf-dev-terminal 483 | ]); 484 | // deno-fmt-ignore-end 485 | -------------------------------------------------------------------------------- /doc/ddu-column-icon_filename.txt: -------------------------------------------------------------------------------- 1 | *ddu-column-icon_filename.txt* Icon and filename column for ddu.vim 2 | 3 | Author : ryota2357 4 | License : MIT license 5 | 6 | CONTENTS *ddu-column-icon_filename-contents* 7 | 8 | Introduction |ddu-column-icon_filename-introduction| 9 | Install |ddu-column-icon_filename-install| 10 | Examples |ddu-column-icon_filename-examples| 11 | Params |ddu-column-icon_filename-params| 12 | 13 | 14 | ============================================================================== 15 | INTRODUCTION *ddu-column-icon_filename-introduction* 16 | 17 | This column displays icon and filename. 18 | 19 | 20 | ============================================================================== 21 | INSTALL *ddu-column-icon_filename-install* 22 | 23 | Please install both "ddu.vim" and "denops.vim". 24 | 25 | https://github.com/Shougo/ddu.vim 26 | https://github.com/vim-denops/denops.vim 27 | 28 | 29 | ============================================================================== 30 | EXAMPLES *ddu-column-icon_filename-examples* 31 | > 32 | call ddu#custom#patch_global({ 33 | \ 'columns': ['icon_filename'], 34 | \ }) 35 | < 36 | 37 | ============================================================================== 38 | PARAMS *ddu-column-icon_filename-params* 39 | 40 | *ddu-column-icon_filename-param-span* 41 | span (number) 42 | The space size between icon and filename. 43 | 44 | Default: 1 45 | 46 | *ddu-column-icon_filename-param-padding* 47 | padding (number) 48 | The left space size in front of the icon. 49 | 50 | Default: 1 51 | 52 | *ddu-column-icon_filename-param-pathDisplayOption* 53 | pathDisplayOption (string) 54 | Display options for file name. 55 | 56 | "basename" Displays only filename. 57 | "relative" Displays paths relative to the current directory. 58 | 59 | Default: "basename" 60 | 61 | *ddu-column-icon_filename-param-defaultIcon* 62 | defaultIcon (dictionary) 63 | It specifies default icon which is used when none of the 64 | predefined icons apply. 65 | It can contain following keys. 66 | 67 | icon (string) 68 | Specify default icon. 69 | Default: " " 70 | 71 | color (string) 72 | Specify default icon highlight. 73 | If it start with #, it is interpreted as a hex color code. 74 | If it start with !, it refers to |ddu-column-icon_filename-param-colors|. 75 | Default: "!default" 76 | 77 | *ddu-column-icon_filename-param-linkIcon* 78 | linkIcon (dictionary) 79 | It specifies link icon. 80 | It can contain following keys. 81 | 82 | icon (string) 83 | Specify default icon. 84 | Default: "" 85 | 86 | color (string) 87 | Specify default icon highlight. 88 | If it start with #, it is interpreted as a hex color code. 89 | If it start with !, it refers to |ddu-column-icon_filename-param-colors|. 90 | Default: "#808080" 91 | 92 | *ddu-column-icon_filename-param-useLinkIcon* 93 | useLinkIcon (string) 94 | Specify linkIcon display conditions. 95 | 96 | "always" Always show linkIcon. 97 | "grayout" Grayout icon color. 98 | "default" When none of the predefined icons found, use 99 | linkIcon instead of defaultIcon. 100 | "none" Not use linkIcon. 101 | 102 | Default: "always" 103 | 104 | *ddu-column-icon_filename-param-customSpecialIcons* 105 | customSpecialIcons (dictionary) 106 | Configure custom special icon. 107 | "special icon" is used when there is an exact match to a 108 | certain file name (ignore case). 109 | 110 | Example: 111 | - Change .github directory icon to  112 | - Set new icon  for abc.txt (ABC.txt, aBc.txt) 113 | > 114 | call ddu#custom#patch_global('columnParams', { 115 | \ 'icon_filename': { 116 | \ 'customSpecialIcons': { 117 | \ '.github/': { 'icon': '' }, 118 | \ 'abc.txt': { 'icon': '', 'color': '#123456' } 119 | \ } 120 | \ } 121 | \ }) 122 | < 123 | *ddu-column-icon_filename-param-customFileIcons* 124 | customFileIcons (dictionary) 125 | Configure custom file icon. 126 | "file icon" is specified by file extention. 127 | 128 | Example: 129 | - Change *.tex icon to ﭨ 130 | - Set new icon  for *.abc (color is #123456) > 131 | call ddu#custom#patch_global('columnParams', { 132 | \ 'icon_filename': { 133 | \ 'customFileIcons': { 134 | \ 'tex': { 'icon': 'ﭨ' }, 135 | \ 'abc': { 'icon': '', 'color': '#123456' } 136 | \ } 137 | \ } 138 | \ }) 139 | < 140 | *ddu-column-icon_filename-param-colors* 141 | colors (dictionary) 142 | Color palette. 143 | You can override some of the colors and add new colors. 144 | 145 | Default: 146 | default = Normal 147 | aqua = #4AFFDB 148 | beige = #F5C06F 149 | blue = #689FB6 150 | brown = #905532 151 | darkBlue = #44788E 152 | darkOrange = #F16529 153 | green = #8FAA54 154 | lightGreen = #31B53E 155 | lightPurple = #834F79 156 | orange = #D4843E 157 | pink = #CB6F6F 158 | purple = #834F79 159 | red = #AE403F 160 | salmon = #EE6E73 161 | yellow = #F09F17 162 | 163 | ============================================================================== 164 | vim:tw=78:ts=8:ft=help:norl:noet:fen:noet: 165 | --------------------------------------------------------------------------------