How to undo after running sudo code . --user-data-dir='.'? - visual-studio-code

I was doing the VSCode configuration, but accidentally I saw this command line which I am not sure what it is doing.
However, after running, it always creates the cache data whenever I start my VSCode.
Note: Whenever I typed this command in any directory, it'll automatically shown those folder and file in that directory.

By setting --user-data-dir you're telling VS Code where it should keep your user / session data, which is why it's creating all of those new directories. This is necessary because when you run code as sudo, it doesn't know where your user data directory is, since you're running as a different user. Like this answer says, you probably shouldn't be running code with sudo: VSCode - what exactly --user-data-dir is specifiying. See that answer for suggestions on alternatives.
As for deleting the data it made, just a simple sudo rm -rf <dir> should do the trick (be careful of course).

Related

Can't save the file «/usr/share/netbeans/10.0/etc/netbeans.conf»?

I am trying to change the jdk access path in the netbeans.conf file to solve the java.lang file not found problem and I cannot save this file with a new name or the same name, so I cannot solve the problem. It reports to me, You don't have permission for do that, how to solve?
I use linux mint 20 Ulyana.
Make sure Netbeans or a connected process is not running. Try completely powering down your system, then start it back up again.
If that does not work, then use the vi editor to edit the file and try putting "sudo" before the command like this:
sudo vi /usr/share/netbeans/10.0/etc/netbeans.conf
It may prompt you for your password.
Learning to use vi is an excellent skill.
Always be very careful using sudo. Usually there is a reason why normal users cannot access files and sudo can. So take a back up just in case.

zsh (Default PATH?) messed up with mongodb installation

seems to be imposible after hours and hours trying to solve this problem. All my sudo terminal commands are corrupted due to a several path changes, so i ask for help to set the correct environment variables.
Recently I've a failed installation of mongodb, it was my mistake cause the installation was set for mojave and i've changed several times the path (currently in Big Sur).
The problem starts when i created a .bash_profile in my home user folder, with the mongodb installation path after i moved the files .tgz to /usr/local/mongodb.
After i realized that, i note that when i run sudo 'something' in terminal nothing happens. Instead the name of the window in terminal changes from .zsh to 'sudo' 40x60 and nothing happens. This is very bad for me. Appends all of this i've installed the brand new 11.3.1 big sur update and everything crashes sum the fact that every single file is veryfying...can't at least disable gatekeeper via sudo.
In my user home folder i've:
.bash_profile: - export PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
.zprofile -
#Setting PATH for Python 3.9 #The original version is saved in .zprofile.pysave PATH="/Library/Frameworks/Python.framework/Versions/3.9/bin:${PATH}"
&
.zshrc
with nothing inside, empty lines.
Someone could please provide me the correct paths and commands for each of these files.
I'm only want to have sudo commands again.

Neovim error: E492: Not an editor command: PlugInstall

OS: Ubuntu 18.04.3 LTS
I just installed neovim using sudo apt-get install neovim and added the folder and file ~/.config/nvim/vim.init. At this moment the file has no content, but when I open up nvim and type :PlugInstall I get error: E492: Not an editor command: PlugInstall. I am clueless, what is going wrong?
I think you are trying to use vim-plug without previously installing it.
I changed my plug#begin to
call plug#begin('~/.local/share/nvim/site/autoload/plug.vim')
and it worked for me now
I followed this and it worked: https://github.com/junegunn/vim-plug/wiki/tutorial
I also wrote call plug#begin('~/.config/nvim/plugged) and made a directory at that location. Then the reload command is also source ~/.config/nvim/init.vim where init.vim is the configuration file. And then I just ran :PlugInstall and it worked :D
I got this error too, but in my case I was typing :pluginstall instead of the case-sensitive :PlugInstall and you have to use the correct case or it won't work. Oddly, :PlugUpdate was able to work before :PlugInstall but that was just because I typed the case correctly.
I see I have the vim.plug correctly installed here
~/.vim/autoload/plug.vim
I also created a "plugged" folder here and I see this is where vim-plug put the downloaded files from running :PlugInstall
.vim/plugged
To be overly pedantic, I typed 'cd' to get to the user directory, then cd .vim to go into my dotted .vim folder, then "mkdir plugged" to create the plugged directory. Not sure if this was 100% necessary or if :PlugInstall would have created it by itself.
I also needed to :source ~/.vimrc between adding addition plug line items and typing :PlugInstall, so make sure you "source" or you can also completely quit and restart your Vim so it will reload your .vimrc file, otherwise it won't know anything about your file edits.
I'm on a Mac. I installed vim-plug for standard vim and this gave me this file
~/.vim/autoload/plug.vim
My .vimrc is this:
" add line numbers
set number
call plug#begin()
" The default plugin directory will be as follows:
" - Vim (Linux/macOS): '~/.vim/plugged'
" Make sure you use single quotes
Plug 'tomasiser/vim-code-dark'
Plug 'tpope/vim-sensible'
call plug#end()
I had the same problem and come here for leave my contribution ( I hadn't find this solution in anywhere ). In my case, it's caused by permissions in my linux. I always start my vim for ocults archives with:
sudo vim .vimrc
In this case, the Vim just use the default commands ( I don't know why but I think this is by the security ). If you just run:
vim .vimrc
All the user commands will be able.
In my case, I had multiple terminal windows open. I still had the Vim window open after installing vim-plug in another window. Solution was to close and re-open Vim.
Instead of
call plug#begin()
I did
call plug#begin(has('nvim') ? stdpath('data') . '/plugged' : '~/.vim/plugged')
Worked 100%
If you have followed the steps in https://github.com/junegunn/vim-plug, but still didn't work.
Try run ':source ~/.config/nvim/vim.init' in vim (not source ~/.config/nvim/vim.init in shell).
Make sure git is installed.
In my case, I was trying to do :PlugInstall in a docker container and did not have git installed. I installed git, and it worked.

Where does breakpoints stores

In VSCode, where do the breakpoints store?
When I relaunch VSCode, those breakpoints still exists, so there should be a place for VSCode to store them. But it is stored neither in the workspace, nor in .vscode.
I need to know where they store so that I can backup/restore/add/modify/delete multiple breakpoints conveniently and efficiently.
Where are the breakpoints stored?
On Windows, the breakpoints are stored in:
%APPDATA%/Code/User/workspaceStorage/(long_hash)/state.vscdb
On Linux, they are in (per Matt's comment):
$HOME/.config/Code/User/workspaceStorage/(long_hash)/state.vscdb
To locate the (long_hash), I added a breakpoint and looked for a file that was recently modified. If you have Cygwin bash, a command like this works, right after adding or removing a breakpoint:
$ cd $APPDATA/Code
$ find . -mmin -1
The state.vscdb file is a SQLite database. I'm able to pull some data out of it using strings (another Cygwin command):
$ strings state.vscdb | grep 'debug.breakpoint'
debug.breakpoint
debug.breakpoint
debug.breakpoint[{"enabled":true,"uri":{"$mid":1,"fsPath":"d:\\wrk\\learn\\vscode\\cpphello\\helloworld.cpp","_sep":1,"external":"file:///d%3A/wrk/learn/vscode/cpphello/helloworld.cpp","path":"/D:/wrk/learn/vscode/cpphello/helloworld.cpp","scheme":"file"},"lineNumber":12},{"enabled":true,"uri":{"$mid":1,"fsPath":"d:\\wrk\\learn\\vscode\\cpphello\\helloworld.cpp","_sep":1,"external":"file:///d%3A/wrk/learn/vscode/cpphello/helloworld.cpp","path":"/D:/wrk/learn/vscode/cpphello/helloworld.cpp","scheme":"file"},"lineNumber":13}]g
debug.breakpoint[{"enabled":true,"uri":{"$mid":1,"fsPath":"d:\\wrk\\learn\\vscode\\cpphello\\helloworld.cpp","_sep":1,"external":"file:///d%3A/wrk/learn/vscode/cpphello/helloworld.cpp","path":"/D:/wrk/learn/vscode/cpphello/helloworld.cpp","scheme":"file"},"lineNumber":12}]
The above is with a single breakpoint at helloworld.cpp line 12.
Is accessing this file a good idea?
Probably not!
If your goal is to query or manipulate the breakpoints yourself by modifying this file, I'd caution that that risks corrupting VSCode's internal storage (even if using a proper SQLite client).
I recommend instead using the VSCode extension APIs debug.breakpoints and debug.addBreakpoints to query and modify them from within VSCode.
On mac, it's
~/Library/Application Support/Code/User/workspaceStorage/<hash>

Reloading/Recompiling/Refreshing .beam files inside a terminal

I use Eclipse and Erlide to develop in Erlang. To run the software I enter the ebin/ directory with my terminal since I don't like the console Eclipse provides. However after each change I have to exit and re-enter erl in the terminal to reload the .beam files that have been changed. Eclipse automatically generates new .beam files into the ebin/ directory after every save.
I know I can manually compile it with the c(filename) command, but that would require me to move to the src/ directory, compile the files, and move them back to the ebin/ directory. This requires a lot more work that just exiting and entering the Erlang terminal.
I have heard of makefiles, but I don't know if they can be ran from within an Erlang terminal.
The reason I don't want to exit the terminal is because I will lose my history of previous commands. If I'm using modules:methods with long names this takes a lot of typing time for each change made.
Is there any method to reload the .beam files in the current directory while in an Erlang terminal? Or is there any way to load the previous command history of the Erlang terminal?
You can use the l(Module). command in the shell which loads, or reloads, a module from the current directory into Erlang.
I would suggest something like active or sync but straightforward approach with c/1, l/1 and nl/1 works too
[edited]
Run your application from eclipse and check the node name, the default is #. Shut that down.
Start a separate erlang node with the same name. Now when running the application from eclipse that node will get used and you can use the shell in the terminal, while erlide will be able to reload beam code automatically when saving files.