WSL (Ubuntu) seamlessly connects Ubuntu and Win10, allowing developers to easily use win10 and Ubuntu in the same system without using a virtual machine. You can use it instead of Cywin32 and babun.
wsl-terminal is a very useful WSL terminal.
Open WSL Here
to the right mouse button:Note: The latest version of windows needs to install wsl-terminal on a non-C drive
Right-click on the desktop and select Open WSL Here
to open Bash.
sudo passwd
This step needs to enter the user password you created after downloading ubuntu
The default apt source of the system is foreign, the downloading software is slow, and the pip source of python is also very slow. We all changed to the source of Alibaba Cloud.
cd /etc/apt/sudo cp sources.list sources.list.bak && sudo vim sources.list
Delete all contents and replace with:
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiversedeb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiversedeb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiversedeb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiversedeb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiversedeb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiversedeb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiversedeb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiversedeb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiversedeb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
sudo apt updatesudo apt upgrade
mkdir ~/.pip && vi ~/.pip/pip.conf
[ global]trusted-host=mirrors.aliyun.comindex-url=http://mirrors.aliyun.com/pypi/simple/
Zsh allows you to search for previously entered commands by pressing the upper key on the keyboard.
For example, you can enter sudo
and press the up arrow key, and the previously entered commands starting with sudo
will appear.
sudo apt -y install zsh
sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
; shell=/bin/bashshell=/bin/zsh
If you are prompted that the file is read-only, take the first step to obtain permissions
Vim plug is a vim plug-in management tool, YCM is a very useful C and python code completion tool, and also supports other languages such as Go and Rust.
curl -fLo ~/.vim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
vi ~/.vimrc
Add in it
" Specify a directory for pluginscall plug#begin('~/.vim/plugged')" Make sure you use single quotesPlug 'jiangmiao/auto-pairs'Plug 'davidhalter/jedi-vim',{'for':'python'}Plug 'Valloric/YouCompleteMe',{'for':'python'}"You can add plugins that have been manually installed"Plug '~/.vim/bundle/YouCompleteMe'" Initialize plugin systemcall plug#end()
Save and exit, and enter vi
vi
Press the :
key to enter the command line, enter
PlugInstall
note:
YCM's python completion depends on jedi-vim
Because the YCM package has more than 200 M, it takes a long time to download.
After the installation is complete, a YCM server error is displayed. This is normal because ycm needs to manually compile the YCM core library.
sudo apt -y install cmake build-essential python3-dev
cd ~/.vim/plugged/YouCompleteMe
vi ./install.py
. /install.py
reference:
vim installs YouCompleteMe plugin, and python completion plugin jedi-vim
Only after YouCompleteMe is configured can it exert its powerful effects.
" Python version setting, use python2.Remove the last number at 7 3let g:ycm_python_binary_path='/usr/bin/python3'"Syntax keyword completion let g:ycm_seed_identifiers_with_syntax=1"Start to list the matches from the second typed character let g:ycm_min_num_of_chars_for_completion=2"Minimum candidate identifier length let g:ycm_min_num_identifier_candidate_chars =5"Press Ctrl+All classes and functions will pop up directly with the space, you must first turn off the input method switch shortcut key let g in the system:ycm_key_invoke_completion = '<C-Space>'"Configuration file path let g:ycm_global_ycm_extra_conf='~/.vim/.ycm_extra_conf.py'"Put together the identifiers recognized by ycm and the grammatical keywords let g:ycm_seed_identifiers_with_syntax = 1"The text in comments and strings will also be included and completed, let g is closed by default:ycm_collect_identifiers_from_comments_and_strings=1"String input completion, input in the string.An error occurs when adding letters, let g is enabled by default:ycm_complete_in_strings=1
Unlike many vim plugins, YCM requires configuration. After vim is started, YCM will look for the current path and the .ycm_extra_conf.py of the upper path. A default template is provided in ~/.vim/bundle/YouCompleteMe/third_party/ycmd/examples/.
Copy the configuration file:
cp ~/.vim/plugged/YouCompleteMe/third_party/ycmd/examples/.ycm_extra_conf.py ~/.vim/
sudo ln -s /usr/bin/python3 /usr/bin/pythonwget bootstrap.pypa.io/get-pip.py
sudo python get-pip.py
tar -jxvf pypy3.6-v7.0.0-linux64.tar.bz2
Detailed decompression command
sudo mv pypy3 /usr/local/lib/
sudo ln -s /usr/local/lib/pypy3/bin/pypy3 /usr/bin/pypy
sudo pypy get-pip.pysudo ln -s /usr/local/lib/pypy3/bin/pip /usr/bin/pipp
Note: You can also use commands like pip-pypy instead of pipp, this is just my personal habit
Usually different projects will use different library versions, and the virtual environment allows you to avoid the risk of damaging the system environment. virtalenvwrapper is based on virtualenv, but is more convenient.
sudo pip install -U virtualenvwrapper
This will automatically install the dependent package virtualenv.
vi ~/.zshrcexport PATH=/usr/local/lib/pypy3/bin:$PATHexport VIRTUALENVWRAPPER_PYTHON=/usr/local/lib/pypy3/bin/pypy3source /usr/local/lib/pypy3/bin/virtualenvwrapper.sh
mkvirtualenv -p /usr/local/lib/pypy3/bin/pypy3 env1
Created by default in the ~/. virtualenvs directory
- p specifies the version used when building, if you use the default python3, you can use
mkvirtualenv env1
workon env1
Note: You can’t find virtualenvwrapper.sh, you can use the following command to find the script
sudo find /-path "/mnt"-prune -o -name virtualenvwrapper.sh -print
Syntastic is a grammar checking tool, it needs the support of flake8, and yapf is used to format python code.
sudo pipp install flake8 yapf
Plugin 'vim-syntastic/syntastic'"(The following configuration is placed outside the vundle installation statement)"vimrc sets flake8 as a grammar checker let g:syntastic_python_checkers =['flake8']"Highlight error"let g:syntastic_enable_highlighting=1"Automatically jump to the first error or warning found"let g:syntastic_auto_jump =1"Yapf auto format shortcut keys"autocmd FileType python nnoremap <F8>:0, $!yapf<CR><CR>
After saving and exiting, use the PluginInstall command to install.
Yapf is only valid for py files. If there is a syntax error, garbled characters may appear. Press u to restore the py file.
MariaDB is a new branch of the author of MySQL, and CentOS has used MariaDB instead of MySQL by default.
sudo apt -y install mariadb-server python3-pymysql
sudo service mysql restart
su -#Enter the password mysql
# Create a user named: admin and password: admin. insert into mysql.user(Host,User,Password)values("localhost","admin",password("admin"));#Flush privileges;#Grant all permissions to the admin user GRANT ALL ON*.* TO 'admin'@'localhost';#Delete user and all permissions DROP USER account;
~/.zshrc
alias db='sudo service mysql start'
cp /mnt/d/.vimrc ~/.vimrc
After using the old version of .vimrc, there is no color matching when entering vim.
This is because the configuration of vundle in vimrc is filetype off, just turn it off.
Turn on this option when you need to use vundle.
mkdir -p ~/.vim/colors && cp /mnt/d/molokai.vim ~/.vim/colors/molokai.vim
Restart the service and you're done.
Recommended Posts