job_start
  • Member for 5 years, 2 months
  • Last seen this week
Keep \t Characters, While Don't Transform Spaces to Tabs?
Accepted answer
3 votes

Replace set noexpandtab to set expandtab . This will make both auto-indentation and Tabs you manually typed to only spaces. Now you can type a line containing mixture of both spaces and Tabs with ...

View answer
How to customize the name of each tab in Vim/NeoVim?
2 votes

Finally, I decided not to re-invent the wheel, and this problem seems to be more difficult than I think. So, I give Vem-Tabline a try and it works nicely, and the default settings of this plugin are ...

View answer
How to get the buffer type of the current buffer?
2 votes

With @B Layer's kindly comments, I found that what I should detect is the file type, not buffer type, of the current window where the cursor at. The final result is: nnoremap <nowait><silent&...

View answer
Map to a key to do nothing?
2 votes

After some try-and-errors I resolved this problem. Btw, if I add to it, would the never be triggered? Yes. Change nnoremap <C-W> <NULL> to: nnoremap <C-W> <ESC> Since ...

View answer
NeoVim: How to move the cursor to a window by its window number?
1 votes

I just found that NeoVim provides some functions to do so easily: local cur_win = vim.api.nvim_get_current_win() -- do your windo, for example: vim.cmd("windo if &buftype != 'nofile' | let g:...

View answer
How to map <BS> to do nothing?
1 votes

Since I have solved this myself with the help of comments by @Chris Heithoff I'm going to answer it myself. As comment stated: when some mapping should work but it didn't, thne the reason is probably ...

View answer
How to suppress error message of autocmd command when the `silent` doesn't work?
1 votes

The problem can be solved by these two lines: let blacklist = ['vim', 'help'] autocmd CursorHold * if (index(blacklist, &ft) < 0 || !coc#rpc#ready()) \ | silent! call CocActionAsync('...

View answer
Get path to parent directory and use it in a nnoremap command?
1 votes

OK, after some try-and-error I resolved this problem. To get the path to parent dir: %:p:h Notice that the :p is needed to get the full path, without it you might end up with nothing, i.e. it's ...

View answer
How to check last char is { in vimscript?
1 votes

After some search this work(, but might be simplified further): " My try inoremap <silent><expr> <CR> \ <SID>if_open_curly_on_left()? "\<CR>}\<ESC>O&...

View answer
How to backward-kill-word in Vim insert mode like zsh?
1 votes

(First I think I have to say is that my environment is simply Terminal and zsh, all I use are built-in stuffs provided by macOS.) In INSERT MODE I typed option + ⌫ then strangely <S-Insert> ...

View answer
How to use cmdline to send key `<ESC>`?
0 votes

I just resolved this using NeoVIm by the way: vim.keymap.set({'n', 't'}, '<M-Tab>', function () if (vim.api.nvim_win_get_config(0).relative ~= '') then vim.api.nvim_input('<ESC>') ...

View answer
How to center the current line to 80% height of the current window, in NeoVim?
0 votes

Update Since I don't like scrolloff, I update to this new version: vim.api.nvim_set_keymap('n', 'M', '<cmd>lua pin_to_80_percent_height()<CR>', NOREF_NOERR_TRUNC) function _G....

View answer
Use command to move cursor like `^` and `$`, in NeoVim?
0 votes

Update: This ternary version for 0 ^ $ is much better. Please call me UX-magician :) vim.api.nvim_set_keymap('n', '0', '<cmd>lua toggle_zero_goto_line_beginning()<CR>', NOREF_NOERR_TRUNC) ...

View answer
Toggle Vim background transparency: how to setup?
0 votes

I just want to provide the NeoVim version answer, in case anyone (include myself) would need it in the future: local _get_darken = false function _G.toggle_background_transparent() if (not ...

View answer
How to show Chinese characters in Floating Terminal inside Neovim?
0 votes

This will be a popular and helpful question, since I cannot find any related websites after Googled "nvim floating term Chinese" and similars. Just add the following: export LANG=zh_TW.UTF-8 ...

View answer
Some migration problems from vimrc to init.lua
0 votes

After some searching. vim.g.mapleader = ' ': Simplest already. vim.cmd('cnoreabbrev S LspStart'): This has not been implemented. (read from a neovim GitHub issue) vim.cmd('noremap! <S-Insert> ...

View answer
Insert mode <S-Tab> to delete one <Tab>-indent?
0 votes

vim.api.nvim_set_keymap('i', '<S-Tab>', "v:lua.check_back_space() ? '<BS>' : '<NOP>'", EXPR_NOREF_NOERR_TRUNC) where EXPR_... is local EXPR_NOREF_NOERR_TRUNC = { expr = ...

View answer
Delete until the start of next visible line?
Accepted answer
0 votes

While this brute-force looks verbose but it actually speedy: nnoremap <nowait><silent> J mm+:left<CR>i<BS><ESC>`m Intended behaviour: The trailing space(s) on the ...

View answer
Useful script to manage buffer and window?
0 votes

I use the following script with assumption: nnoremap <nowait><silent><expr> ∑ "(YOUR_SHORT_CUT) \ (&filetype=="fern" <bar><bar> &...

View answer