Skip to content

Instantly share code, notes, and snippets.

@upgradeQ
Last active May 7, 2024 14:37
Show Gist options
  • Save upgradeQ/962920808e152e1218cba7dc70495c23 to your computer and use it in GitHub Desktop.
Save upgradeQ/962920808e152e1218cba7dc70495c23 to your computer and use it in GitHub Desktop.
neovim config
call plug#begin()
Plug 'folke/tokyonight.nvim'
"---------------------------------------------------------------------------------
Plug 'mbbill/undotree', { 'on': 'UndotreeToggle' }
map <F3> :UndotreeToggle<cr>
"---------------------------------------------------------------------------------
Plug 'mhinz/vim-startify',{'on':'Startify'}
nnoremap <F4> :Startify <cr>
"---------------------------------------------------------------------------------
Plug 'psf/black', {'on':'Black'}
nnoremap <F5> :Black <cr>
"---------------------------------------------------------------------------------
"Plug 'numirias/semshi', {'do': ':UpdateRemotePlugins','for': 'python'}
"map <F6> :Semshi toggle <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'}}
"a good plugin that features multiple files results from a search,broken
"Plug 'dyng/ctrlsf.vim',{'on':[]}
"---------------------------------------------------------------------------------
Plug 'tpope/vim-repeat' ,{'on':[]}
"Plug 'psliwka/vim-smoothie', {'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 'lukas-reineke/indent-blankline.nvim'
"---------------------------------------------------------------------------------
call plug#end()
lua <<EOF
vim.g.indent_blankline_char = '▏'
vim.g.indent_blankline_char_highlight_list = { "IndentLine" }
vim.g.indent_blankline_show_first_indent_level = false
vim.g.indent_blankline_show_current_context = true
vim.g.indent_blankline_use_treesitter = true
vim.g.indent_blankline_filetype_exclude = { 'startify','help','undotree' }
vim.g.indent_blankline_context_patterns = {
"class",
"function",
"method",
"block",
"list_literal",
"selector",
"^if",
"^table",
"if_statement",
"while",
"^while",
"for",
"^for"
}
require'nvim-treesitter.configs'.setup {
ensure_installed ={"python", "bash", "regex", "json", "lua", "c" },
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,{})
EOF
set nocompatible hidden laststatus=2
"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')
function MyCustomHighlights() " not used
hi semshiAttribute ctermfg=blue guifg=#337d92
endfunction
augroup ui
au!
au VimEnter * set background=light
au VimEnter * let g:tokyonight_style = "day"
au VimEnter * colorscheme tokyonight
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 with this command:set guifont=*
" mono bold 14
endif
" default mapleader \
map <leader>h :set hlsearch!<cr>
map <leader>f :Files<cr>
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 <silent> <F11> :call GuiWindowFullScreen((g:GuiWindowFullScreen + 1) % 2)<cr>
let g:python3_host_prog= 'C:/c_path/py_path_location/python.exe'
"let g:semshi#error_sign_delay = 6
let g:lightline = {'colorscheme': 'tokyonight'}
"let g:lightline = { 'colorscheme': 'PaperColor' }
"let g:nightflyItalics = 0
"
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',
\ ]
" 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=88 "show 88 character limit column
set splitbelow splitright
set sessionoptions+=blank
set sessionoptions+=tabpages
set sessionoptions+=winsize
syntax on
"set columns=88 "lines=60
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
"autocmd FileType python call MyCustomHighlights()
" 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
" NOTES -------------------------------------------------------------------
" move split to new tab - <C-w>T
" :%s/:.*//g " delete everything in line starting with :
@upgradeQ
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment