123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972 |
- " vim:fileencoding=utf-8:foldmethod=marker:foldmarker={{{,}}}
- " zo command for open fold
- " zc command for close fold
- " !!! - fold colors modified in colorscheme files !!!
- " {{{ Basic VIM settings
- " Enable line numbering
- :set number
- " make numbering relative
- :set relativenumber
- " For example - scrolloff=7
- " When cursor on 7 line, counting from bottom, and U going to next line,
- " document
- " Default value = 0
- :set scrolloff=4
- " Copying indents from prev line when adding new
- :set autoindent
- " Supplements option above by adding spaces in ((needed)) places
- :set smartindent
- " price of tab (in spaces)
- :set tabstop=3
- " By default - adjusting the indentation width (in spaces) adding by commands
- " >> and <<. If != tabstop, then indent can consist both of spaces and tabs.
- " When smarttab is on, may have an additional impact
- " (0 for ‘tabstop’):
- :set shiftwidth=0
- " Pressing tab in BoL (before 1-st not-space symbol) adding indent == shiftwidth
- " Backspace deleting entire indent, not just one tab
- :set smarttab
- " Count of spaces the tab is displayed with when added
- " For example - tabstop=8 ; softtabstop=4
- " Example - Triple tab. We have - 1 tab (8 spaces) and 4 spaces
- " (0 for ‘tabstop’, -1 for ‘shiftwidth’):
- :set softtabstop=-1
- " activating mouse in VIM
- ":set mouse=a
- " autotips on type
- :set encoding=UTF-8
- " Not change tabs by spaces
- :set noexpandtab
- " Show tabs as chars
- :set list
- ":set listchars=tab:
- ":set listchars=tab:\
- :set listchars=tab:\
- " for show by :echo mapleader (i saved default key)
- :let mapleader = "\\"
- " Use system clipboard in nvim
- :set clipboard+=unnamedplus
- " Number of screen lines to use for the command-line
- :set cmdheight=1
- " comma-separated list of strings that can start a comment line
- ":set comments="s1:/*,mb:*,ex:*/,://,b:#,:%,:XCOMM,n:>,fb:-,fb:•"
- " Comma-separatef list of completion options
- " Available
- " menu, menuone, longest, preview, noinsert, noselect
- :set completeopt="menu"
- " Comma-separated list of languages. Vim will use the first language for which
- " the desired help can be found. English help will alway be used as a last
- " resort.
- :set helplang=ru,en
- " Ignore case in search patterns
- ":set ignorecase
- " Not Ignore case
- :set noignorecase
- " colored column, for your orientation (may be U don't want write line > 80 symbols
- ":set colorcolumn=80
- " settings for nvim-highlight-colors
- :set termguicolors
- :set t_Co=256
- " enable folding
- " marker "{\{{" (without "\" sign) increases fold level by 1
- " marker "}\}}" (without "\" sign) decreases fold level by 1
- " it works in comments
- " for enter to fold - use zo command
- ":set foldmethod=syntax
- :set foldmethod=syntax
- let g:python_recommended_style = 1
- " {{{Function for python folding
- :function! Python_Folding()
- "return match(getline(v:lnum), '\S')
- let curtabnum = match(getline(v:lnum), '\S')
- let nexttabnum = match(getline(v:lnum), '\S')
- if curtabnum == 0
- return 0
- elseif curtabnum > nexttabnum
- return "<".curtabnum
- elseif curtabnum == nexttabnum
- return curtabnum
- else
- return ">".curtabnum
- endif
- ":set foldmethod=indent
- " Достаточно хуёво работающие fold на основе табов (не создаёт новые уровни
- " fold'ов)
- ":set foldexpr=getline(v:lnum)[0]==\"\\t\"
-
- " Самый рабочий код, но нуждается в доработке
- " let thisline = getline(v:lnum)
- " "let tabcount = len(thisline) - len(replace(thisline, "\t", ""))
- " let tabcount = match(thisline, '\S')
- " let prevline = ""
- " if v:lnum == 0
- " prevline = ""
- " else
- " let prevline = getline(v:lnum - 1)
- " endif
- " let prevtabcount = match(prevline, '\S')
- " let nextline = getline(v:lnum + 1)
- " let nexttabcount = match(nextline, '\S')
- "
- " if tabcount < nexttabcount
- " return ">".nexttabcount
- " elseif tabcount > nexttabcount
- " return "<".tabcount
- " else
- " return tabcount
- " endif
- :endfunction
- " }}}
- "autocmd FileType python set foldmethod=indent
- "autocmd FileType python call Python_Folding()
- "autocmd FileType python set foldexpr=Python_Folding()
- "autocmd FileType python set foldmethod=expr
- "autocmd FileType python set foldexpr=Python_Folding()
- "autocmd BufEnter *.py set foldmethod=expr
- " left to comma marker opens fold, and right to comma closes it
- " more then 1 pair of strings is unsupported
- " for example
- " if U write
- ":set foldmarker={{{,}}},(((,)))
- " that's won't work.
- " For this use
- ":set foldmethod=expr
- ":set foldmarker={{{,}}}
- " color sheme from awesome-vim-colorschemes plugin
- " space-vim-dark;
- source ~/.local/share/nvim/plugged/awesome-vim-colorschemes/colors/space-vim-dark.vim
- " }}}
- " {{{ Plugins usage descriptions
- " {{{ coc.nvim
- " Install coc.nvim
- " https://github.com/neoclide/coc.nvim
- " 1. install yarn
- " 2. install coc.nvim plugin
- " 3. :CocInstall [coc extension]
- " 4. :CocConfig - for access to config
- " }}}
- " {{{ coc marketplace
- " Coc marketplace - list all available extensions
- " usage
- ":CocList marketplace - list all available extensions
- ":Coclist marketplace python - search extension that name contains python
- "[Tab], when on extension - doing install, uninstall and homepage actions
- " }}}
- " {{{ Plugins (un)installation
- " install plugins
- " 1. install vim-plug
- " https://github.com/junegunn/vim-plug
- " 2. write call plug#begin() and call plug#end()
- " 3. between them write "Plug 'link'"
- " 4. re-enter to init.vim
- " 5. Write command ":PlugInstall"
- " 6. Done
- "
- " Uninstall plugins (what is unlisted in plugin list)
- ":PlugClean
- " Update plugins
- ":PlugUpdate
- " Update vim-plug itself
- ":PlugUpgrade
- " }}}
- " {{{ NERDTree commands
- " NERDTree commands (:help NERDTree for more)
- "I - toggle hidden files displayed
- "X - Recursively close dir
- "O - recursively open dir
- "A - Zoom (max/min) the NERDTree window
- "? - Quick help
- " }}}
- " {{{ vim-surround
- " vim-surround
- " usage (when inside brackets/etc)
- " change " to '
- "cs"'
- " change " to <q>
- "cs"<q>
- " change any tag to "
- "cst"
- " remove delimiter
- "ds"
- " close word with "
- "ysiw"
- " close word with [] and add space between word and brakets
- "ysiw[
- " close word with [] without space
- "ysiw]
- " close entire line with "
- "yss"
- " close entire line(s) in tag (also works with visual mode)
- "V -> highlight lines -> S<p class="important">
- " }}}
- " {{{ vim-multiple-cursors
- " vim-multiple-cursors
- " WARNING!
- " Undo and Redo doesn't work with this plugin!
- " usage
- " for choose same words in document
- " 1. Command - fp<C-n> (in command mode press fp, then Ctrl+n)
- " 2. Highlight all the word, if it doesn't happened
- " 3. Press <C-n> for add new cursor to same word
- " 4. Command - c
- " 5. Change the text
- "
- " For add a cursor to each line of visual selection
- " 1. Command - vip<C-n>
- " 2. Command for insert- i
- " 2* - other VIM commands works too (e.g A, hjkl, etc.)
- " }}}
- " {{{ Tagbar
- " Tagbar
- " requirments:
- " Exuberant Ctags/Universal Ctags ; phpctags (for php) ; jsctags (for JavaScript) ; etc-ctags
- " Universal Ctags
- " https://github.com/universal-ctags/ctags
- " todo-comments
- " requirments - writed near Plug'' line
- " commands
- " * all the commands accept next arguments:
- """ Specify the directory to search for comments
- " cwd=~/projects/foobar
- """ Comma separated list of keywords to filter results by. Case-sensitive
- " keywords=TODO,FIX
- ":TodoQuickFix - shows all todos in project by QuickFix list
- ":TodoLocList - same but uses the location list
- ":TodoTrouble - same but uses Trouble
- ":TodoTelescope - same but uses Telescope
- " }}}
- " {{{ nvim-notify
- " show notify manually
- ":lua vim.notify("error test", "error")
- " }}}
- " {{{ GuessIndent
- " manually trigger
- ":GuessIndent
- " }}}
- " {{{ Smart-splits
- " }}}
- " End plugins usage desctiptions }}}
- "{{{ Plugins installation (Vim-plug)
- "-------- Plugins ------------------------------------------------------------------------------------
- " site
- " https://neovimcraft.com/
- call plug#begin()
- " {{{ nvim UI
- " status/tabline for vim
- Plug 'https://github.com/vim-airline/vim-airline'
- " color schemes for vim
- Plug 'https://github.com/rafi/awesome-vim-colorschemes'
- " file manager inside vim
- Plug 'https://github.com/preservim/nerdtree'
- " adds icons for vim plugins (e.g. NerdTree)
- Plug 'https://github.com/ryanoasis/vim-devicons'
- " Tagbar - browse the tags of the current file
- Plug 'https://github.com/preservim/tagbar'
- " highlight colors everywhere in vim (when you giving to variable a color definition - it's highlighting) (if be more correct - it finds "=[color_definition]")
- " For example
- "let a=red
- " "red" is highlighted
- Plug 'https://github.com/brenoprata10/nvim-highlight-colors'
- " nvim notifications
- Plug 'https://github.com/rcarriga/nvim-notify'
- " Plugin for highlight next types of comments:
- " {{{ Types
- " PERF: - perfect
- " HACK: - weird code behavior
- " WARNING: - don't eat white snow
- " TODO: - wake up
- " NOTE: - adding a note
- " FIX: - need to fix this shit
- " BUG: - real bug in code
- " }}}
- "
- " *TODO is highlighted by some plugin higher. May be conflicts
- " requires ripgrep package (optional, for search)
- Plug 'https://github.com/folke/todo-comments.nvim'
- " End nvim UI}}}
- " {{{ Unused plugins
- " realtime show colors in .css (css, rgb and words)
- "Plug 'https://github.com/ap/vim-css-color'
- " check it later
- "Plug 'https://github.com/mattn/emmet-vim'
- " End unused plugins}}}
- " {{{ Requirments
- " todo-comments requirment (optional, for search)
- Plug 'https://github.com/nvim-lua/plenary.nvim'
- " Trouble requirment (or U can find theme, what required for Trouble)
- Plug 'https://github.com/folke/lsp-colors.nvim'
- " todo-comments requirment (optional)
- Plug 'https://github.com/folke/trouble.nvim'
- " End requirments}}}
- " languages helper (autotips)
- Plug 'https://github.com/neoclide/coc.nvim', {'branch': 'master', 'do': 'yarn install --frozen-lockfile'}
- " code snippets
- Plug 'https://github.com/neoclide/coc-snippets'
- " all about "surroundings": parentheses, brackets, quotes, XML tags and more
- " Delete, change and add surroundings in pairs
- Plug 'https://github.com/tpope/vim-surround'
- " Multiple cursors in vim
- Plug 'https://github.com/terryma/vim-multiple-cursors'
- " Adds line (in line numbers col) that shows changes in the file (saved/etc) (like VSCode)
- Plug 'https://github.com/lewis6991/gitsigns.nvim'
- " Autopair plugin
- Plug 'https://github.com/windwp/nvim-autopairs'
- " Show popup with key bindings (U should write descriptions manually)
- " Plug 'https://github.com/folke/which-key.nvim'
- " UI Component lib for nvim
- " Plug 'https://github.com/MunifTanjim/nui.nvim'
- " Modified autointent
- "Plug 'https://github.com/NMAC427/guess-indent.nvim'
- " Split pane management
- Plug 'https://github.com/mrjones2014/smart-splits.nvim'
- " Generate docstrings for python
- Plug 'https://github.com/pixelneo/vim-python-docstring'
- " Advanced folding
- Plug 'https://github.com/anuvyklack/pretty-fold.nvim'
- " preview folds
- Plug 'https://github.com/anuvyklack/fold-preview.nvim'
- " Folding for python
- Plug 'https://github.com/tmhedberg/SimpylFold'
- call plug#end()
- "-------- End plugins ------------------------------------------------------------------------------
- "}}}
- "{{{ Things after plugins load
- "-------- Things after plugins load ----------------------------------------------------------------
- " {{{ Activate NERDTree, highligt, todo-comments, git-signs
- " Turn on devicons in NERDTree
- let g:webdevicons_enable_nerdtree = 1
- " turn highlight on (nvim-highlight-colors)
- :lua require("nvim-highlight-colors").turnOn()
- " activate todo-comments
- :lua require("todo-comments").setup()
- " activate git-signs
- :lua require("gitsigns").setup()
- " }}}
- " {{{ autopair plugin
- lua << AUTOPAIR
- require("nvim-autopairs").setup {}
- -- Default values {{{
- local disable_filetype = { "TelescopePrompt", "spectre_panel" }
- local disable_in_macro = true -- disable when recording or executing a macro
- local disable_in_visualblock = false -- disable when insert after visual block mode
- local disable_in_replace_mode = true
- local ignored_next_char = [=[[%w%%%'%[%"%.%`%$]]=]
- local enable_moveright = true
- local enable_afterquote = true -- add bracket pairs after quote
- local enable_check_bracket_line = true --- check bracket in same line
- local enable_bracket_in_quote = true --
- local enable_abbr = false -- trigger abbreviation
- local break_undo = true -- switch for basic rule break undo sequence
- local check_ts = false
- local map_cr = false
- local map_bs = false -- map the <BS> key
- local map_c_h = false -- Map the <C-h> key to delete a pair
- local map_c_w = false -- map <c-w> to delete a pair if possible
- -- End default values }}}
- -- {{{ Key mappings
- -- local remap = vim.api.nvim_set_keymap
- -- local npairs = require('nvim-autopairs')
- --
- -- npairs.setup({ map_bs = false, map_cr = false })
- --
- -- vim.g.coq_settings = { keymap = { recommended = false } }
- --
- -- -- these mappings are coq recommended mappings unrelated to nvim-autopairs
- -- remap('i', '<esc>', [[pumvisible() ? "<c-e><esc>" : "<esc>"]], { expr = true, noremap = true })
- -- remap('i', '<c-c>', [[pumvisible() ? "<c-e><c-c>" : "<c-c>"]], { expr = true, noremap = true })
- -- remap('i', '<tab>', [[pumvisible() ? "<c-n>" : "<tab>"]], { expr = true, noremap = true })
- -- remap('i', '<s-tab>', [[pumvisible() ? "<c-p>" : "<bs>"]], { expr = true, noremap = true })
- --
- -- -- skip it, if you use another global object
- -- _G.MUtils= {}
- --
- -- MUtils.CR = function()
- -- if vim.fn.pumvisible() ~= 0 then
- -- if vim.fn.complete_info({ 'selected' }).selected ~= -1 then
- -- return npairs.esc('<c-y>')
- -- else
- -- return npairs.esc('<c-e>') .. npairs.autopairs_cr()
- -- end
- -- else
- -- return npairs.autopairs_cr()
- -- end
- -- end
- -- remap('i', '<cr>', 'v:lua.MUtils.CR()', { expr = true, noremap = true })
- --
- -- MUtils.BS = function()
- -- if vim.fn.pumvisible() ~= 0 and vim.fn.complete_info({ 'mode' }).mode == 'eval' then
- -- return npairs.esc('<c-e>') .. npairs.autopairs_bs()
- -- else
- -- return npairs.autopairs_bs()
- -- end
- -- end
- -- remap('i', '<bs>', 'v:lua.MUtils.BS()', { expr = true, noremap = true })
- -- End key mappings }}}
- AUTOPAIR
- " }}}
- " setting nvim-notify as default notify function
- :lua vim.notify = require("notify")
- " {{{ GuessIndent plugin
- "lua << GUESSINDENT
- "-- This is the default configuration
- "require('guess-indent').setup {
- " auto_cmd = true, -- Set to false to disable automatic execution
- " override_editorconfig = false, -- Set to true to override settings set by .editorconfig
- " filetype_exclude = { -- A list of filetypes for which the auto command gets disabled
- " "netrw",
- " "tutor",
- " },
- " buftype_exclude = { -- A list of buffer types for which the auto command gets disabled
- " "help",
- " "nofile",
- " "terminal",
- " "prompt",
- " },
- "}
- "GUESSINDENT
- " End GuessIndent plugin }}}
- " {{{ Smart-splits plugin
- lua << Smart-Splits
- -- Default configuration
- require('smart-splits').setup({
- -- Ignored filetypes (only while resizing)
- ignored_filetypes = {
- 'nofile',
- 'quickfix',
- 'prompt',
- },
- -- Ignored buffer types (only while resizing)
- ignored_buftypes = { 'NvimTree' },
- -- the default number of lines/columns to resize by at a time
- default_amount = 3,
- -- Desired behavior when your cursor is at an edge and you
- -- are moving towards that same edge:
- -- 'wrap' => Wrap to opposite side
- -- 'split' => Create a new split in the desired direction
- -- 'stop' => Do nothing
- -- function => You handle the behavior yourself
- -- NOTE: If using a function, the function will be called with
- -- a context object with the following fields:
- -- {
- -- mux = {
- -- type:'tmux'|'wezterm'|'kitty'
- -- current_pane_id():number,
- -- is_in_session(): boolean
- -- current_pane_is_zoomed():boolean,
- -- -- following methods return a boolean to indicate success or failure
- -- current_pane_at_edge(direction:'left'|'right'|'up'|'down'):boolean
- -- next_pane(direction:'left'|'right'|'up'|'down'):boolean
- -- resize_pane(direction:'left'|'right'|'up'|'down'):boolean
- -- split_pane(direction:'left'|'right'|'up'|'down',size:number|nil):boolean
- -- },
- -- direction = 'left'|'right'|'up'|'down',
- -- split(), -- utility function to split current Neovim pane in the current direction
- -- wrap(), -- utility function to wrap to opposite Neovim pane
- -- }
- -- NOTE: `at_edge = 'wrap'` is not supported on Kitty terminal
- -- multiplexer, as there is no way to determine layout via the CLI
- at_edge = 'wrap',
- -- when moving cursor between splits left or right,
- -- place the cursor on the same row of the *screen*
- -- regardless of line numbers. False by default.
- -- Can be overridden via function parameter, see Usage.
- move_cursor_same_row = false,
- -- whether the cursor should follow the buffer when swapping
- -- buffers by default; it can also be controlled by passing
- -- `{ move_cursor = true }` or `{ move_cursor = false }`
- -- when calling the Lua function.
- cursor_follows_swapped_bufs = false,
- -- resize mode options
- resize_mode = {
- -- key to exit persistent resize mode
- quit_key = '<ESC>',
- -- keys to use for moving in resize mode
- -- in order of left, down, up' right
- resize_keys = { 'h', 'j', 'k', 'l' },
- -- set to true to silence the notifications
- -- when entering/exiting persistent resize mode
- silent = false,
- -- must be functions, they will be executed when
- -- entering or exiting the resize mode
- hooks = {
- on_enter = nil,
- on_leave = nil,
- },
- },
- -- ignore these autocmd events (via :h eventignore) while processing
- -- smart-splits.nvim computations, which involve visiting different
- -- buffers and windows. These events will be ignored during processing,
- -- and un-ignored on completed. This only applies to resize events,
- -- not cursor movement events.
- ignored_events = {
- 'BufEnter',
- 'WinEnter',
- },
- -- enable or disable a multiplexer integration;
- -- automatically determined, unless explicitly disabled or set,
- -- by checking the $TERM_PROGRAM environment variable,
- -- and the $KITTY_LISTEN_ON environment variable for Kitty
- multiplexer_integration = nil,
- -- disable multiplexer navigation if current multiplexer pane is zoomed
- -- this functionality is only supported on tmux and Wezterm due to kitty
- -- not having a way to check if a pane is zoomed
- disable_multiplexer_nav_when_zoomed = true,
- -- Supply a Kitty remote control password if needed,
- -- or you can also set vim.g.smart_splits_kitty_password
- -- see https://sw.kovidgoyal.net/kitty/conf/#opt-kitty.remote_control_password
- kitty_password = nil,
- -- default logging level, one of: 'trace'|'debug'|'info'|'warn'|'error'|'fatal'
- log_level = 'info',
- })
- Smart-Splits
- " }}}
- " {{{ fold-preview plugin
- lua << FoldPreview
- require('fold-preview').setup({
- -- Your configuration goes here.
- -- Auto open preview (integer | false)
- auto = 400,
- -- Default is true
- default_keybindings = false,
- -- defalut is {' ', '', ' ', ' ', ' ', ' ', ' ', ' '}
- -- "none" | "single" | "double" | "rounded" | "solid" | "shadow" | string[]
- border = "single",
- -- keybinds
- -- show preview on closed fold
- -- h
- -- open fold
- -- hh
- -- When preview opened, close it and open fold
- --
- })
- FoldPreview
- " End fold-preview plugin}}}
- " {{{ Pretty Fold plugin
- lua << PrettyFold
- -- {{{ Global pretty config
- local global_pretty_config = function()
- require('pretty-fold').setup({
- sections = {
- left = {
- --function() return string.rep('+', vim.v.foldlevel) end,
- function() return 'level: '..tonumber(vim.v.foldlevel) end,
- ', ',
- 'number_of_folded_lines',
- ': ',
- 'percentage',
- ' ',
- 'content',
- },
- right = {
- --' ', 'number_of_folded_lines', ': ', 'percentage', ' ',
- --function(config) return config.fill_char:rep(3) end
- --function(global_pretty_config) return global_pretty_config.fill_char:rep(5) end
- },
- },
- --fill_char = '•',
- -- more chars: '┣', '┫'
- fill_char = '━',
- remove_fold_markers = true,
- -- keep the indentation of the content of the fold string.
- keep_indentation = true,
- -- possible values:
- -- "delete" : delete all comment signs from the fold string.
- -- "spaces" : replace all comment signs with equal number of spaces.
- -- false : do nothing with comment signs.
- process_comment_signs = 'spaces',
- --process_comment_signs = false,
- -- comment signs additional to the value of `&commentstring` option.
- --comment_signs = {},
- comment_signs = {
- '"""', -- python docstring
- '#', -- python and bash comments
- '--', -- lua comment
- '//', -- c languages comment
- -- not working (err in init.lua, line 78)
- --{ "/*", "*/" },
- },
- -- list of patterns that will be removed from content foldtext section.
- stop_words = {
- '@brief%s*', -- (for c++) remove '@brief' and all spaces after.
- },
- add_close_pattern = true, -- true, 'last_line' or false
- matchup_patterns = {
- { '{', '}' },
- { '%(', ')' }, -- % to escape lua pattern char
- { '%[', ']' }, -- % to escape lua pattern char
- },
- ft_ignore = { 'neorg' },
- })
- end
- -- End global pretty config }}}
- -- {{{ Python pretty config
- local python_pretty_config = function()
- require('pretty-fold').ft_setup('python', {
- sections = {
- left = {
- --function() return string.rep('+', vim.v.foldlevel) end,
- function() return 'level: '..tonumber(vim.v.foldlevel) end,
- ', ',
- 'number_of_folded_lines',
- ': ',
- 'percentage',
- ' ',
- 'content',
- },
- right = {
- --' ', 'number_of_folded_lines', ': ', 'percentage', ' ',
- --function(config) return config.fill_char:rep(3) end
- --function(global_pretty_config) return global_pretty_config.fill_char:rep(5) end
- },
- },
- --fill_char = '•',
- -- more chars: '┣', '┫'
- fill_char = '━',
- remove_fold_markers = true,
- -- keep the indentation of the content of the fold string.
- keep_indentation = true,
- -- possible values:
- -- "delete" : delete all comment signs from the fold string.
- -- "spaces" : replace all comment signs with equal number of spaces.
- -- false : do nothing with comment signs.
- process_comment_signs = 'spaces',
- --process_comment_signs = false,
- -- comment signs additional to the value of `&commentstring` option.
- --comment_signs = {},
- comment_signs = {
- '"""', -- python docstring
- '#', -- python and bash comments
- '--', -- lua comment
- '//', -- c languages comment
- -- not working (err in init.lua, line 78)
- --{ "/*", "*/" },
- },
- -- list of patterns that will be removed from content foldtext section.
- stop_words = {
- '@brief%s*', -- (for c++) remove '@brief' and all spaces after.
- },
- add_close_pattern = true, -- true, 'last_line' or false
- matchup_patterns = {
- { '^%s*if%s*:', '^%s %s'},
- { '{', '}' },
- { '%(', ')' }, -- % to escape lua pattern char
- { '%[', ']' }, -- % to escape lua pattern char
- },
- })
- end
- -- End python pretty config }}}
- -- {{{ Lua pretty config
- local lua_pretty_config = function()
- require('pretty-fold').ft_setup('python', {
- matchup_patterns = {
- { '^%s*do$', 'end' }, -- do ... end blocks
- { '^%s*if', 'end' }, -- if ... end
- { '^%s*for', 'end' }, -- for
- { 'function%s*%(', 'end' }, -- 'function( or 'function (''
- { '{', '}' },
- { '%(', ')' }, -- % to escape lua pattern char
- { '%[', ']' }, -- % to escape lua pattern char
- },
- })
- end
- -- End lua pretty config }}}
- global_pretty_config()
- python_pretty_config()
- lua_pretty_config()
- PrettyFold
- " End pretty fold plugin }}}
- " {{{SimpylFold
- let g:SimpylFold_docstring_preview = 1
- let g:SimpylFold_fold_docstring = 1
- let g:SimpylFold_fold_import = 1
- let g:SimpylFold_fold_blank = 0
- " EndSimplyFold}}}
- " ---------- End things after plugins load -----------------------------------------------------------
- " }}} Things after plugins load
- " {{{ Hotkeys
- "-------- Hotkeys ---------------------------------------------------------------------------------
- " FOR CHECK hotkey use command
- ":verbose imap [key]
- " e.g.
- ":verbose imap <Tab>
- " {{{ NERDTree
- " Ctrl+N for open NerdTree
- "nnoremap <C-n> :NERDTree<CR>
- " Ctrl+T for open/close NerdTree
- nnoremap <C-t> :NERDTreeToggle<CR>
- " F8 for open Tagbar
- nmap <F8> :TagbarToggle<CR>
- " }}}
- " {{{ Coc (autocomplete)
- "------ Coc (autocomplete)
- " Alt+Tab for next variant of completion and Shift+Tab for previous
- inoremap <silent><expr> <a-TAB>
- \ coc#pum#visible() ? coc#pum#next(1) :
- \ CheckBackspace() ? "\<Tab>" :
- \ coc#refresh()
- inoremap <expr><S-TAB> coc#pum#visible() ? coc#pum#prev(1) : "\<C-h>"
- "inoremap <silent><expr> <CR> coc#pum#visible() ? coc#pum#confirm()
- " \: "\<C-g>u\<CR>\<c-r>=coc#on_enter()\<CR>"
- " use Shift+Enter for accept completion
- inoremap <silent><expr> <S-CR> coc#pum#confirm()
- " use Ctrl+Space to trigger completion
- inoremap <silent><expr> <c-space> coc#refresh()
- " go to definition
- nmap <silent> gd <Plug>(coc-definition)
- nmap <silent> gy <Plug>(coc-type-definition)
- nmap <silent> gi <Plug>(coc-implementation)
- " go to references
- nmap <silent> gr <Plug>(coc-references)
- "------ end Coc (autocomplete)
- "}}}
- " {{{ coc-snippets
- "inoremap <silent><expr> <a-TAB>
- " \ coc#pum#visible() ? coc#_select_confirm() :
- " \ coc#expandableOrJumpable() ? "\<C-r>=coc#rpc#request('doKeymap', ['snippets-expand-jump',''])\<CR>" :
- " \ CheckBackspace() ? "\<TAB>" :
- " \ coc#refresh()
- "
- "function! CheckBackspace() abort
- " let col = col('.') - 1
- " return !col || getline('.')[col - 1] =~# '\s'
- "endfunction
- "
- "let g:coc_snippet_next = '<tab>'
- " }}}
- " turn off search highlight
- " , and Space
- nnoremap ,<space> :nohlsearch<CR>
- " for insert mode - escape by jk
- "inoremap jk <esc>
- "
- " {{{ VIM go to smth
- " go to next vim buffer
- nnoremap gn :bnext<CR>
- " go to prev vim buffer
- nnoremap gp :bprevious<CR>
- " close buffer
- nnoremap gw :bdelete<CR>
- " buffer list
- nnoremap gl :buffers<CR>
- " }}}
- " {{{ VIM split
- nnoremap <S-l> :vsplit
- nnoremap <S-j> :split
- " End VIM split}}}
- " {{{ smart-splits
- lua << smart-splits-keys
- -- recommended mappings
- -- resizing splits
- -- these keymaps will also accept a range,
- -- for example `10<A-h>` will `resize_left` by `(10 * config.default_amount)`
- vim.keymap.set('n', '<A-h>', require('smart-splits').resize_left)
- vim.keymap.set('n', '<A-j>', require('smart-splits').resize_down)
- vim.keymap.set('n', '<A-k>', require('smart-splits').resize_up)
- vim.keymap.set('n', '<A-l>', require('smart-splits').resize_right)
- -- moving between splits
- vim.keymap.set('n', '<C-h>', require('smart-splits').move_cursor_left)
- vim.keymap.set('n', '<C-j>', require('smart-splits').move_cursor_down)
- vim.keymap.set('n', '<C-k>', require('smart-splits').move_cursor_up)
- vim.keymap.set('n', '<C-l>', require('smart-splits').move_cursor_right)
- -- swapping buffers between windows
- vim.keymap.set('n', '<leader><leader>h', require('smart-splits').swap_buf_left)
- vim.keymap.set('n', '<leader><leader>j', require('smart-splits').swap_buf_down)
- vim.keymap.set('n', '<leader><leader>k', require('smart-splits').swap_buf_up)
- vim.keymap.set('n', '<leader><leader>l', require('smart-splits').swap_buf_right)
- -- adding smart-split
- --vim.keymap.set('n', '<S-l>', require('smart-splits').split_pane_right)
- --vim.keymap.set('n', '<S-k>', require('smart-splits').resize_up)
- smart-splits-keys
- " }}}
- "-------- End hotkeys --------------------------------------------------------------------------------
- "}}}
- " {{{ Functions
- "-------- Functions ----------------------------------------------------------------------------------
- " {{{ for coc autocomplete
- " For coc autocomplete
- function! CheckBackspace() abort
- let col = col('.') - 1
- return !col || getline('.')[col - 1] =~# '\s'
- endfunction
- " }}}
- "-------- End functions ------------------------------------------------------------------------------
- " }}}
|