Last active
October 11, 2024 12:39
-
-
Save upgradeQ/962920808e152e1218cba7dc70495c23 to your computer and use it in GitHub Desktop.
neovim config
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
call plug#begin() | |
Plug 'projekt0n/github-nvim-theme' | |
"--------------------------------------------------------------------------------- | |
Plug 'mbbill/undotree', { 'on': 'UndotreeToggle' } | |
" requires diff.exe from git | |
map <F3> :UndotreeToggle<cr> | |
"--------------------------------------------------------------------------------- | |
Plug 'mhinz/vim-startify',{'on':'Startify'} | |
nnoremap <F4> :Startify <cr> | |
"--------------------------------------------------------------------------------- | |
Plug 'psf/black', {'on':'Black'} | |
nnoremap <F5> :Black <cr> | |
"--------------------------------------------------------------------------------- | |
map <F6> :TSBufToggle highlight<cr> | |
"--------------------------------------------------------------------------------- | |
" nnoremap <F7> :?????? <cr> | |
"--------------------------------------------------------------------------------- | |
"Plug '907th/vim-auto-save',{'on':'AutoSaveToggle'} | |
"let g:auto_save_events = ["InsertLeave", "TextChanged","TextChangedI","CursorHold","CursorHoldI"] | |
"--------------------------------------------------------------------------------- | |
"https://github.com/junegunn/fzf#search-syntax | |
" {'on':[]} for any file type | |
Plug 'junegunn/fzf', {'on':[]} | |
Plug 'junegunn/fzf.vim',{'on':[]} | |
let g:fzf_layout = {'window' : {'width':1,'height':0.8,'border':'sharp'}} | |
"--------------------------------------------------------------------------------- | |
Plug 'tpope/vim-repeat' ,{'on':[]} | |
Plug 'itchyny/lightline.vim', {'on':[]} | |
Plug 'nathanaelkane/vim-indent-guides', {'on':[]} | |
" vim cheat map \? | |
Plug 'lifepillar/vim-cheat40',{'on':[]} | |
Plug 'rafcamlet/nvim-luapad', {'on':[]} | |
Plug 'beyondmarc/hlsl.vim' | |
"Plug 'tbastos/vim-lua',{'for':'lua'} | |
Plug 'nvim-treesitter/nvim-treesitter',{'do': ':TSUpdate'} | |
Plug 'yamatsum/nvim-cursorline' | |
Plug 'p00f/nvim-ts-rainbow' | |
Plug 'sbdchd/neoformat' | |
call plug#end() | |
"************************************************************************** | |
" Lua scripting ----------------------------------------------------------- | |
"************************************************************************** | |
" | |
lua <<EOF | |
require'nvim-treesitter.configs'.setup { | |
ensure_installed ={"python", "bash", "regex", "json", "lua", "c","cpp" }, | |
highlight = { enable = true, }, | |
indent = { enable = true, }, | |
rainbow = { | |
enable = true, | |
extended_mode = true, -- Highlight also non-parentheses delimiters, boolean or table: lang -> boolean | |
max_file_lines = 1000, -- Do not enable for files with more than 1000 lines, int | |
} | |
} | |
local my_test_fn = function() | |
vim.cmd('python import json') | |
vim.cmd('python from vim import *') | |
vim.cmd("python current.line = str(json.dumps(json.loads(current.line),indent=2,sort_keys=True)).replace('\\n','\\r')") | |
vim.cmd([[%s/\%x0D/\r/g]]) | |
end | |
vim.api.nvim_create_user_command("RewriteJSON",my_test_fn,{}) | |
local my_test_fn2 = function() | |
local codestr = | |
[[from pywinauto.application import Application;]] .. | |
[[app = Application(backend="uia").connect(title_re=".*- Microsoft Visual Studio.*");]] .. | |
[[app["Microsoft Visual Studio 2022"].set_focus();]] .. | |
[[app["Microsoft Visual Studio 2022"]["Debug Target"].invoke()]] | |
vim.cmd("w") | |
vim.cmd("python " .. codestr) | |
end | |
vim.api.nvim_create_user_command("CallVSBuild",my_test_fn2,{}) | |
--lua end | |
EOF | |
"https://github.com/junegunn/vim-plug/wiki/tips#loading-plugins-manually "'vim-smoothie', | |
au VimEnter * call plug#load('vim-repeat','fzf.vim','fzf', | |
\ 'lightline.vim','nvim-luapad','vim-cheat40','vim-indent-guides') | |
"************************************************************************** | |
" Vimscript --------------------------------------------------------------- | |
"************************************************************************** | |
augroup ui | |
au! | |
au VimEnter * set background=light | |
au VimEnter * colorscheme github_light | |
au VimEnter * highlight Comment ctermfg=DarkGreen guifg=#43b14b | |
au VimEnter * set list listchars=tab:▸\ ,trail:·,precedes:←,extends:→,eol:$ | |
au VimEnter * hi NonText ctermfg=DarkBlue | |
au VimEnter * hi SpecialKey ctermfg=DarkBlue | |
augroup end | |
"opacity for popup window and suggestions | |
if has("gui_running") | |
set wildoptions=pum | |
set pumblend=15 | |
set winblend=15 | |
" font size selection, use OS font selector window neovim-qt with this command:set guifont=* | |
" mono bold 14 | |
endif | |
if exists("g:neovide") | |
" "C:\Program Files\Neovide\neovide.exe" --neovim-bin "C:\Users\path_to\bin\nvim.exe" --no-vsync | |
"set guifont=Monaspace\ Neon:h12 | |
set guifont=JetBrains\ Mono:h14 | |
"set guifont=Consolas:h12 | |
"let g:neovide_scale_factor = 1.25 | |
let g:neovide_cursor_animation_length = 0 | |
let g:neovide_refresh_rate = 144 | |
let g:neovide_refresh_rate_idle = 5 | |
let g:neovide_remember_window_size = v:true | |
"let g:neovide_cursor_vfx_mode = "pixiedust" | |
map <silent> <F11> :lua vim.g.neovide_fullscreen = not vim.g.neovide_fullscreen<CR> | |
endif | |
"************************************************************************** | |
" General hotkeys --------------------------------------------------------- | |
"************************************************************************** | |
" | |
" default mapleader \ | |
map <leader>h :set hlsearch!<cr> | |
map <leader>f :Files<cr> | |
"ripgrep | |
map <leader>rg :RG | |
map <leader>` :Marks<cr> | |
map <leader>l :Lines<cr> | |
map <leader>i :IndentGuidesToggle<cr> | |
" hot reload search with regex | |
map <leader>t :tabnew<cr><F4> | |
"save and run in split | |
"map <F2> :w<cr><c-w><c-w>Ga<up><cr><c-\><c-n><c-w><c-w> | |
map <F2> :CallVSBuild<cr> | |
"************************************************************************** | |
" Plug options --------------------------------------------------------- | |
"************************************************************************** | |
let g:python3_host_prog= 'C:/c_path/py_path_location/python.exe' | |
let g:lightline = { 'colorscheme': 'PaperColor' } | |
let g:startify_custom_header = [ | |
\'88b 88 Yb dP 88 8b d8', | |
\'88Yb88 Yb dP 88 88b d88', | |
\'88 Y88 YbdP 88 88YbdP88', | |
\'88 Y8 YP 88 88 YY 88', | |
\ ] | |
let g:startify_files_number = 25 | |
" https://github.com/jdhao/nvim-config/blob/81f64ed32eb229ffe22cec030ab0126b981ab9aa/viml_conf/plugins.vim#L146 | |
"https://jdhao.github.io/2020/04/19/nvim_cpp_and_c_completion/ | |
"AlwaysBreakAfterReturnType: TopLevelDefinitions - function return type on a new line | |
let g:neoformat_c_clangformat = { | |
\ 'exe': 'clang-format', | |
\ 'args': ['--style="{IndentWidth: 2, ColumnLimit: 120, ReflowComments: false, AlwaysBreakAfterReturnType: TopLevelDefinitions }"'] | |
\ } | |
let g:neoformat_enabled_cpp = ['clangformat'] | |
let g:neoformat_enabled_c = ['clangformat'] | |
"************************************************************************** | |
" General options --------------------------------------------------------- | |
"************************************************************************** | |
" | |
set nocompatible hidden laststatus=2 | |
au BufNewFile,BufRead *.effect set filetype=hlsl | |
" show invisible | |
" | |
" clipboard support sudo apt isntall xclip | |
set undofile | |
set guicursor+=n-v:blinkwait350-blinkon350-blinkoff350 | |
set mouse=a | |
set autochdir " autochange working directory | |
set cursorline " highlight current line | |
set nu rnu " numbers | |
set colorcolumn=120 "show 120 character limit column | |
set splitbelow splitright | |
set sessionoptions+=blank | |
set sessionoptions+=tabpages | |
set sessionoptions+=winsize | |
syntax on | |
tab sball | |
set enc=utf-8 | |
set ls=2 | |
set incsearch hlsearch | |
" ignore case if not any char is Uppercase, change search,set regex mode to simple one, show search replacement targets | |
set ignorecase smartcase magic inccommand=split | |
"set scrolloff=5 | |
" shift witdh , tabstop , expand tab , softtabstop | |
set sw=2 ts=2 et sts=2 | |
autocmd Filetype lua setlocal ts=2 sw=2 et sts=2 | |
autocmd Filetype python setlocal ts=4 sw=4 et sts=4 | |
" russian keymap | |
"https://habr.com/ru/company/dcmiran/blog/477768/#comment_20975662 | |
" change keyboard layout in Vim with <Ctrl+^> | |
" by default no translate layout in Search mode | |
" by default no translate layout in Insert mode | |
" See also :h 'langmap' | |
set keymap=russian-jcukenwin iminsert=0 imsearch=0 | |
" set ui to en | |
language messages en | |
"disable ads | |
set shortmess+=I | |
"************************************************************************** | |
" NOTES ------------------------------------------------------------------- | |
"************************************************************************** | |
" move split to new tab - <C-w>T | |
" :%s/:.*//g " delete everything in line starting with : | |
" g<C-a> column increase number | |
" recent neovim versions support commenting via gc example: gcc - comments line |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Installing neovim on windows
download zip, create nvim folder in local appdata, write to file inside neovim : e path/to/nvim/init.vim
this will create config with right permissions
download vim plug via powershell
download git
download zig
add zig to env path via settings in about system
download jetbrains mono, add ttf files via settings in windows personalization
set guifont=* , this will set font permanently , set 14 size https://stackoverflow.com/a/76942450