Some notes on using Windows 11

Created: December 06, 2021   Last Modified: August 30, 2022   Category: windows   Print this pageBack to Home

Full right-click context menu

To enable full context menu, run

reg add "HKCU\Software\Classes\CLSID\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}\InprocServer32" /f /ve

and restart the explorer process.

To enable the default Windows 11 right-click context menu, run

reg delete "HKCU\Software\Classes\CLSID\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}" /f

Clear System Tray Icons Cache

reg delete "HKCU\Software\Classes\Local Settings\Software\Microsoft\Windows\CurrentVersion\TrayNotify\IconStreams" /f
reg delete "HKCU\Software\Classes\Local Settings\Software\Microsoft\Windows\CurrentVersion\TrayNotify\PastIconsStream" /f

Backup/Restore/Delete Wireless Profiles via netsh

Backup/Restore VPN settings

Backup and Restore Windows partitions with Clonezilla

C:\usr\snmp\persist\snmpapp.conf keeps appearing

The folder C:\usr appears in my C:\ drive and even when I removed it, after rebooting Windows, it appears again. It contains a single directory persist and that directory has only one file named snmpapp.conf with the following content.

#
# net-snmp (or ucd-snmp) persistent data file.
#
############################################################################
# STOP STOP STOP STOP STOP STOP STOP STOP STOP 
#
#          **** DO NOT EDIT THIS FILE ****
#
# STOP STOP STOP STOP STOP STOP STOP STOP STOP 
############################################################################
#
# DO NOT STORE CONFIGURATION ENTRIES HERE.
# Please save normal configuration tokens for snmpapp in SNMPCONFPATH/snmpapp.conf.
# Only "createUser" tokens should be placed here by snmpapp administrators.
# (Did I mention: do not edit this file?)
#




engineBoots 1
oldEngineID 0x80001f8880340200006dc1b46100000000

From this page, I figure out that this is because I added a Kyocera printer to my list of printers in Windows.

Firefox show MOZILLA_PKIX_ERROR_OCSP_RESPONSE_FOR_CERT_MISSING error when entering a support.microsoft.com page

See this page for more details. To fix the issue, follow this workaround:

  1. Open a tab and type about:config in the address bar.
  2. Once in, type ocsp in the config search bar.
  3. Toggle the parameter security.ssl.enable_ocsp_stapling from true to false.

Vim

See this page for the installations and configurations in Arch Linux.

Installation

Plugins

Extra configurations

set encoding=utf-8
set fileencoding=utf-8
set termencoding=utf-8

" Taken from https://learnvimscriptthehardway.stevelosh.com/chapters/07.html
" edit Vim configurations
nnoremap <leader>ev :split $MYVIMRC<cr>
nnoremap <leader>sv :source $MYVIMRC<cr>
nnoremap <leader>egv :split $MYGVIMRC<cr>
nnoremap <leader>sgv :source $MYGVIMRC<cr>

" edit Vim configurations
nnoremap <leader>ev :split $MYVIMRC<cr>
nnoremap <leader>sv :source $MYVIMRC<cr>
nnoremap <leader>egv :split $MYGVIMRC<cr>
nnoremap <leader>sgv :source $MYGVIMRC<cr>

set grepprg=grep\ -nH\ $*

" NERDTree
let g:NERDTreeWinSize = 20
let NERDTreeIgnore = ['\~$','\.pyc$','\*NTUSER*','\*ntuser*','\NTUSER.DAT','\ntuser.ini']
let NERDTreeIgnore += ['\.png$','\.jpg$','\.gif$','\.mp3$','\.flac$', '\.ogg$', '\.mp4$','\.avi$','.webm$','.mkv$','\.pdf$', '\.zip$', '\.tar.gz$', '\.rar$']
" Start NERDTree. If a file is specified, move the cursor to its window.
autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * NERDTreeCWD | if argc() > 0 || exists("s:std_in") | wincmd p | endif
" Exit Vim if NERDTree is the only window remaining in the only tab.
autocmd BufEnter * if tabpagenr('$') == 1 && winnr('$') == 1 && exists('b:NERDTree') && b:NERDTree.isTabTree() | quit | endif
" Close the tab if NERDTree is the only window remaining in it.
autocmd BufEnter * if winnr('$') == 1 && exists('b:NERDTree') && b:NERDTree.isTabTree() | quit | endif
" If another buffer tries to replace NERDTree, put it in the other window, and bring back NERDTree.
autocmd BufEnter * if bufname('#') =~ 'NERD_tree_\d\+' && bufname('%') !~ 'NERD_tree_\d\+' && winnr('$') > 1 |
	\ let buf=bufnr() | buffer# | execute "normal! \<C-W>w" | execute 'buffer'.buf | endif
" Open NERDTree on each new tab.
autocmd BufWinEnter * if getcmdwintype() == '' | silent lcd %:p:h | NERDTreeCWD | wincmd p | endif

autocmd BufEnter * silent! lcd %:p:h " move to current folder

set tabstop=4
set softtabstop=0 
set noexpandtab
set shiftwidth=4

set showmode " Show current mode in command line
set incsearch " Highlight while searching with / or ?
set hlsearch " Keep matches highlighted

set splitbelow             " Open new windows below the current window.
set splitright             " Open new windows right of the current window.

set cursorline             " Find the current line quickly.
set wrapscan               " Searches wrap around end-of-file.

" A syntax for placeholders
" Pressing Control-j jumps to the next match.
inoremap <c-j> <Esc>/<++><CR><Esc>cf>

syntax enable " enable syntax highlight
set background=dark
colorscheme solarized
set gfn=MonacoB_Nerd_Font_Mono:h13:cANSI:qDRAFT " Other nice fonts may be Inconsolata, DejaVuSansMono
set nu " line numbers
set wrap " text wrap
set lbr
set ai " autoindent

" Autocomplete brackets
inoremap { {}<Esc>ha
inoremap ( ()<Esc>ha
inoremap [ []<Esc>ha
inoremap " ""<Esc>ha
inoremap ' ''<Esc>ha
inoremap ` ``<Esc>ha

" Rainbow brackets
let g:rainbow_active = 1

" Press Ctrl+C for copying a line
vnoremap <C-c> "*y

set clipboard+=unnamed  " use the clipboards of vim and OS
" set paste               " Paste from a windows or from vim
set go+=a               " Visual selection automatically copied to the clipboard

" folding
set foldmethod=syntax
set foldnestmax=3
set nofoldenable
set foldlevel=2

" Put all temporary files under the same directory.
" https://github.com/mhinz/vim-galore#temporary-fil```
set backup
set backupdir   =$HOME/vimfiles/backup/
set backupext   =-vimbackup
set backupskip  =
set directory   =$HOME/vimfiles/swap/
set updatecount =100
set undofile
set undodir     =$HOME/vimfiles/undo/
set viminfo     ='100,n$HOME/vimfiles/info/viminfo

" Syntastic settings
set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*
let g:syntastic_always_populate_loc_list = 1
let g:syntastic_auto_loc_list = 1
"let g:syntastic_check_on_open = 1
let g:syntastic_mode_map = { 'mode': 'passive', 'active_filetypes': [],'passive_filetypes': [] }
let g:syntastic_check_on_wq = 0

" Use ctrl-[hjkl] to select the active split!
nmap <silent> <c-k> :wincmd k<CR>
nmap <silent> <c-j> :wincmd j<CR>
nmap <silent> <c-h> :wincmd h<CR>
nmap <silent> <c-l> :wincmd l<CR>

" vim-jekyll
let g:jekyll_post_dirs = ['_posts']
let g:jekyll_post_extension = '.md'
let g:jekyll_site_dir = '_site'
let g:jekyll_post_template =  [
	\ '---',
	\ 'layout: JEKYLL_LAYOUT',
	\ 'title: "JEKYLL_TITLE"',
	\ 'author: JEKYLL_AUTHOR',
	\ 'categories: ',
	\ '  - MAIN_CAT',
	\ '---',
	\ '',
	\ '* TOC',
	\ '{:toc}',
	\ '']

" Taken from https://vim.fandom.com/wiki/Insert_current_date_or_time
" If buffer modified, update any 'Last modified: ' in the first 20 lines.
" 'Last modified: ' can have up to 10 characters before (they are retained).
" Restores cursor and window position using save_cursor variable.
function! LastModified()
  if &modified
    let save_cursor = getpos(".")
    let n = min([20, line("$")])
    keepjumps exe '1,' . n . 's#^\(.\{,10}[Ll]ast[ _][Mm]odified.*: \).*#\1' .
          \ strftime('%a %b %d, %Y  %H:%M %Z') . '#e'
    call histdel('search', -1)
    call setpos('.', save_cursor)
  endif
endfun
autocmd BufWritePre * call LastModified()

Colors in Windows Command Line Prompt

See this guide for more details.

Using vim-latex-suite instead of vimtex

VPN connection error The parameter is incorrect

From this page.

MSEdgeRedirect

From its homepage,

A Tool to Redirect News, Search, Widgets, Weather and More to Your Default Browser This tool filters and passes the command line arguments of Microsoft Edge processes into your default browser instead of hooking into the microsoft-edge: handler, this should provide resiliency against future changes. Additionally, an Image File Execution Options mode is available to operate similarly to the Old EdgeDeflector. Additional modes are planned for future versions. No Default App walkthrough or other steps, just set and forget.

I installed the tool via Chocolatey using choco install -y msedgeredirect.I also set startpage.com as my default search engine via the URL https://www.startpage.com/sp/search?query=. (Just put %s after = if you want to set up with Firefox in iOS.)

ZaDark - Dark Theme for Zalo

See this page or this page for more information. Basically, just download the latest ZIP archive, extract it, close Zalo (if it opens), and run the EXE file.