Comments (8)
Sorry for resurrecting this, but I'm running into what may be the same question: is there an equivalent to vim-devicons WebDevIconsGetFileTypeSymbol()
and WebDevIconsGetFileFormatSymbol()
functions?
Thanks!
from nvim-web-devicons.
For anyone who comes across this - here's how i got the nvim-web-devicons
working with lightline
:
In Lua, define a function to provide the icon by filetype with get_icon_by_filetype
:
function getfiletypeicon( filetype )
local icon = require('nvim-web-devicons').get_icon_by_filetype( filetype )
return icon
end
The component_function
from lightline
expects a vimscript function (in my case, defined directly in Lua):
vim.cmd([[
function! CustomFilename()
let filetype = winwidth(0) > 70 ? (&filetype !=# '' ? &filetype : '-') : ''
let filename = expand('%:t') !=# '' ? expand('%:t') : '[no name]'
let filetypeicon = v:lua.getfiletypeicon(filetype)
return filetypeicon . ' ' . filename
endfunction
]])
Use CustomFilename
in your lightline
setup:
vim.g['lightline'] = {
active = {
left = {{'mode', 'paste'}, {'gitbranch', 'readonly', 'filename', 'modified'}}
},
component_function = {
filename = 'CustomFilename',
gitbranch = 'FugitiveHead'
}
}
from nvim-web-devicons.
Hello, there is not getFileFormatSymbol function actually but there could be one (now i understand what this issue means). get file type symbol is the main function this plugins provides through require'nvim-web-devicons'.get_icon(filename, extension, { default = true })
to get the file format it would be quite easy to do, maybe just make a PR ?
from nvim-web-devicons.
I'm keen for this too as I would like to get rid of the vim-devicons
dependency for lightline
, but would not know where to start!
from nvim-web-devicons.
Hi, i'm not sure what you mean by that, did you read the README ?
from nvim-web-devicons.
Where file format I mean the newline character- CR
and LF
, which has a different form in DOS, UNIX, and Mac, and in vimrc
,I cat set like this set fileformats=unix,dos,mac
from nvim-web-devicons.
i get what fileformats are, but i'm not sure about how it relates to getting an icon ? the icon returned is just a string
from nvim-web-devicons.
Do you have a patched font installed?
from nvim-web-devicons.
Related Issues (20)
- compose.yml , should have the same icon as docker-compose.yml and Dockerfile HOT 1
- Is there a way to set default options (hidden by default) HOT 1
- Font
- bug: OptionSet autocommand is clearing the Neovim intro screen HOT 3
- Errors showing in nvim due to hex color with 7 characters HOT 2
- TOML icon broken HOT 7
- Are you open to a PR for adding operating system icons? HOT 5
- Package-lock.json file name causes error HOT 3
- Outdated Terraform file icon
- New JS icon is not legible/recognizable in small size HOT 11
- Question - Where to find / edit git icons. Maybe not part of this codebase?
- Icons for C++20 module files doent work HOT 1
- Consolidate Default Icon Set: Seti HOT 1
- Material Icon Set
- Highlight Error HOT 4
- Haxe icon not showing HOT 2
- Add mp3 file icons HOT 4
- No way to add/override icons for filetypes HOT 4
- Add openscad icon HOT 1
- Rename `:NvimWebDeviconsHiTest` to anything else like `WebDeviconsHiTest` HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nvim-web-devicons.