Many people store files in the cloud these days and Microsoft OneDrive is useful online storage for Windows PCs. You can edit Office files, but did you know text and code can be edited too?
OneDrive is not just for WIndows PCs of course, and it can be accessed on an Apple Mac or Linux. Word, Excel, PowerPoint and other Microsoft Office files open in their web-based Office apps when they are clicked in a browser. What about other files though?
You might use OneDrive to store plain text files, and possibly HTML web pages, CSS, JavaScript and other types of code. OneDrive is just general storage, so you can save almost anything to it.
Edit text files on OneDrive
What happens if a text file file is clicked on OneDrive? Surprisingly, it opens in a useful online text editor in the browser window.
Select a file and a new button appears in the toolbar, Open in Text Editor. You don’t actually need to select the file first and simply clicking the filename opens it.
It works pretty much as expected and the arrow keys on the keyboard move the cursor and you can type text into it. The text wraps at the window edge.
- Select text and press Ctrl+C to copy it
- Select text and press Ctrl+X to cut it
- Position the cursor and press Ctrl+V to paste text
It is quick and easy to write notes with this simple text editor.
Edit code on OneDrive
HTML, JavaScript, CSS and other types of code are actually plain text files, so they can be opened in the same way as a text file. However, there is a surprising difference.
The code editor isn’t just a text editor and it is a lot better than you might expect. For example, it has code highlighting and it correctly identifies HTML tags, CSS, JavaScript and so on. It colors the code to make it easier to read in a similar way to many dedicated code editor tools.
For example, HTML tags are dark red, hyperlinks are blue underlined, tag parameters are light red and light blue, comments are green, plain text is black, and so on. There are line numbers down the left margin, and text is wrapped at the right window edge.
Another surprising feature is that if you position the cursor on an opening brackets, it is highlighted along with the closing bracket. This is very useful for coding because it is easy to forget to close brackets. When they are highlighted, they are easy to see.
There is more coding features and opening and closing tags are also highlighted. Position the cursor on an opening tag, like <title> and the matching closing tag is highlighted, </title>. This makes it easy to see if you have missed one and it works well for HTML, JavaScript and CSS. It might work with other types of code, try it and see.
On the right side of the editor is a document map with thumbnails for each page of code. You can quickly jump to another page by clicking a thumbnail.
There are more goodies in the editor and right clicking or pressing F1 shows this command palette.
Searching can be performed by pressing Ctrl+F to open the Find box. This is a basic web browser function rather than one in the code editor, but it works just the same.
The usual keyboard shortcuts work, so you can copy selected text with Ctrl+C, cut the selection with Ctrl+X, and paste what’s on the clipboard wuth with Ctrl+V. You can open multiple files on tabs and cut, copy and paste from one to the other.
I’m not sure a lot of people will want to store HTML files on OneDrive, but it is an interesting and unexpected feature. I keep code snippets on OneDrive partly as a backup and partly to enable them to be copied and pasted into wherever I need them. Being on OneDrive, they are synced across all my computers and devices.
I wonder what other types of code it can handle? Try it and see.
I wish there was a option for raw code.
Nice tipz. Is there a txt edit app on android that can edit ms cloud txt files?
hi i host my page using onedrive but if i do any changes example if i change the code and save the file it will not changing in live what the reason