2009.12.30 14:45 pkrumins Vim Plugins
2012.03.28 05:15 anarcholibertarian Vim Magic
2024.01.31 05:16 drunkenblueberry Auto-indent in TeX files
setlocal autoindent let g:tex_indent_brace=0 let g:tex_indent_and=0 let g:tex_indent_items=0I turned off my LSP and confirmed these values are set by running :lua =vim.g.tex_indent_brace. But this doesn't solve the issue. Is there something I'm missing? I don't have vimtex or anything else TeX-related installed, other than texlab and nvim-treesitter.
2024.01.09 13:07 JitStill Auto Indentation Differences: Neovim vs. Vim
2023.04.22 21:33 Punkt_Punkt_Punkt Matching of Bracket Under Cursor Not Working
2022.12.05 06:34 benbrastmckie Auto Indent in LaTeX
2022.10.07 00:21 OomMielie Need help with coc.nvim settings
set nobackup set updatetime=300 set signcolumn=yes filetype off call plug#begin() Plug 'neoclide/coc.nvim', {'branch': 'release'} Plug 'preservim/nerdtree' Plug 'tpope/vim-commentary' Plug 'tpope/vim-fugitive' call plug#end() filetype plugin indent on set number inoremap\ coc#pum#visible() ? coc#pum#next(1) : \ CheckBackspace() ? "\ " : \ coc#refresh() inoremap coc#pum#visible() ? coc#pum#prev(1) : "\ " inoremap coc#pum#visible() ? coc#pum#confirm() \: "\ u\ \ =coc#on_enter()\ " function! CheckBackspace() abort let col = col('.') - 1 return !col getline('.')[col - 1] =~# '\s' endfunction if has('nvim') inoremap coc#refresh() else inoremap coc#refresh() endif "Maps nmap :NERDTreeToggle "Indentation Options set textwidth=80 set autoindent set shiftwidth=4 set tabstop=4 "Search Options set hlsearch set ignorecase set incsearch set smartcase "Text Rendering set scrolloff=2 set sidescrolloff=5 set background=dark
2022.09.20 19:19 shmerl Adding a line break without applying indentation?
2022.03.31 01:42 Sol33t303 Can't figure out how to setup the indent-blankline plugin?
require("indent_blankline").setup { -- for example, context is off by default, use this to turn it on show_current_context = true, show_current_context_start = true, }I have been looking around the pluggins directory and found the init.lua file and tried putting it in there but it doesn't seem to do anything.
" Run current file aliasis command! -bar PhTest w !php % command! -bar PyTest w !python3 % " Adjusted Key Bindings nmap:Vexplore map (easymotion-prefix) nmap :let file = expand('%:p') \:tabnew \:set nonumber \:execute 'term pudb3 ' file " various variable adjustments let b:ale_linters = ['pylint'] autocmd FileType php setlocal omnifunc=phpactor#Complete let g:phpactorCompletionIgnoreCase = 0 set number let g:ale_python_pylint_executable = 'pylint' let g:ale_python_pylint_options = '--indent-string=" "' let g:indentLine_enabled = v:true let g:indent_blankline_char = '│' set shiftwidth=2 set softtabstop=2 set expandtab set autoindent " set autowrite filetype plugin indent on let g:vdebug_options = {} let g:vdebug_options["port"] = 9000 let g:python_recommended_style = 0 call plug#begin('~/.config/nvim/plugged') let g:UltiSnipsExpandTrigger=" " let g:UltiSnipsJumpForwardTrigger=" " let g:UltiSnipsJumpBackwardTrigger=" " " PHP7 let g:ultisnips_php_scalar_types = 1 " Python let g:python3_host_prog = "/usbin/python3" " Misc Plug 'roxma/nvim-yarp' Plug 'roxma/vim-hug-neovim-rpc' Plug 'jiangmiao/auto-pairs' Plug 'machakann/vim-sandwich' Plug 'preservim/nerdcommenter' " Code Completion Plug 'ncm2/ncm2' Plug 'ncm2/ncm2-ultisnips' Plug 'phpactophpactor' , {'do': 'composer install', 'for': 'php'} Plug 'phpactoncm2-phpactor', {'for': 'php'} Plug 'https://github.com/ncm2/ncm2-jedi.git', { 'for': 'python' } " Debugging Plug 'vim-vdebug/vdebug' " Code Snippets Plug 'SirVeultisnips' Plug 'phux/vim-snippets' " Syntax Highlighting Plug 'StanAngeloff/php.vim', {'for': 'php'} Plug 'numirias/semshi', {'do': ':UpdateRemotePlugins', 'for': 'python'} " File Explorer Plug 'scrooloose/nerdTree' Plug 'tpope/vim-vinegar' " Surround code in brackets,parentheses, etc. Plug 'tpope/vim-surround' " Fuzzy finder for files and neovim buffers Plug 'ctrlpvim/ctrlp.vim' " Easy text navigation Plug 'easymotion/vim-easymotion' " Line for showing info ath the bottom Plug 'bling/vim-airline' " Implements various unix utilities as vim commands Plug 'tpope/vim-eunuch' " Git intergration Plug 'airblade/vim-gitgutter' " Linting Plug 'W0rp/ale' " Indent line Plug 'lukas-reineke/indent-blankline.nvim' call plug#end() augroup ncm2 au! autocmd BufEnter * call ncm2#enable_for_buffer() au User Ncm2PopupOpen set completeopt=noinsert,menuone,noselect au User Ncm2PopupClose set completeopt=menuone augroup END " parameter expansion for selected entry via Enter inoremap (pumvisible() ? ncm2_ultisnips#expand_or("\ ", 'n') : "\ ") " cycle through completion entries with tab/shift+tab inoremap pumvisible() ? "\ " : "\ " inoremap pumvisible() ? "\ " : "\ " filetype plugin on filetype indent on
2022.01.30 17:25 freddiehaddad LunarVim keeps indenting 4 spaces no matter my settings..
I notice whenever I press 'o' to enter edit mode on a new line, the indention is always 4 spaces even if the rest of the file is formatted with 2 space indentation and the local buffer settings for tabstop, swiftwidth, etc. are all set to 2. submitted by freddiehaddad to lunarvim [link] [comments] When I save the file :w, the auto-formatter fixes all the spacing. But I would still prefer the editor honor the current indenting rules while I'm editing. In this picture, the cursor was on the curly brace on line 18 and I pressed 'o' to add a blank row on line 19 and start editing. https://preview.redd.it/oaglhcztpue81.png?width=465&format=png&auto=webp&s=1fc615520c0d9dfec5a93d5e9823fa86b52307a2 UPDATE: Adding another example to further clarify the issue. For the code snippet: const ( cycles = 5 res = 0.001 size = 100 nframes = 64 delay = 8 ) If I put the cursor below the closing parenthesis and press Enter, the cursor begins with indented one level in. If I press backspace and move the cursor to the start of the row and hit enter gain, the next line gets indented. It seems like Either a LunarVim setting or possibly a problem more general to NeoVim and how it parses/resolves indentation while editing. I experimented with both smartindent and cindent options, neither seems to address the issue. Also tried turning on/off autoindent and manipulating the tabstop, shiftwidth, softtabstop, expandtab settings. |
2022.01.24 00:48 lf_araujo Help me understand this startup error
Error detected while processing /home/luis/.config/nvim/init.vim: line 201: E5108: Error executing lua ...are/nvimvimplug/nvim-lspconfig/lua/lspconfig/configs.lua:10: attempt to index local 'config_def' (a nil value) stack traceback: ...are/nvimvimplug/nvim-lspconfig/lua/lspconfig/configs.lua:10: in function '__newindex' ...hare/nvimvimplug/nvim-lspinstall/lua/lspinstall/util.lua:15: in function 'extract_config' ...mplug/nvim-lspinstall/lua/lspinstall/servers/angular.lua:1: in main chunk [C]: in function 'require' ...e/nvimvimplug/nvim-lspinstall/lua/lspinstall/servers.lua:2: in main chunk [C]: in function 'require' ...cal/share/nvimvimplug/nvim-lspinstall/lua/lspinstall.lua:1: in main chunk [C]: in function 'require' /home/luis/.config/nvim/lua/lsp.lua:85: in function 'setup_servers' /home/luis/.config/nvim/lua/lsp.lua:113: in main chunk [C]: in function 'require' [string ":lua"]:1: in main chunk Error detected while processing /home/luis/.local/share/nvimvimplug/vim-mucomplete/plugin/mucomplete.vim: line 26: E227: mapping already exists for ^Iit complains of a setup_server function within my lsp.lua file. See below:
local nvim_lsp = require('lspconfig') -- lsp setup -- Set Default Prefix. -- Note: You can set a prefix per lsp server in the lv-globals.lua file vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with( vim.lsp.diagnostic.on_publish_diagnostics, { virtual_text = false, -- { -- prefix = "", -- spacing = 0, -- }, signs = true, underline = true } ) -- symbols for autocomplete vim.lsp.protocol.CompletionItemKind = { " (Text) ", " (Method)", " (Function)", " (Constructor)", " ﴲ (Field)", "[] (Variable)", " (Class)", " ﰮ (Interface)", " (Module)", " 襁 (Property)", " (Unit)", " (Value)", " 練 (Enum)", " (Keyword)", " (Snippet)", " (Color)", " (File)", " (Reference)", " (Folder)", " (EnumMember)", " ﲀ (Constant)", " ﳤ (Struct)", " (Event)", " (Operator)", " (TypeParameter)" } local function documentHighlight(client, bufnr) -- Set autocommands conditional on server_capabilities if client.resolved_capabilities.document_highlight then vim.api.nvim_exec( [[ hi LspReferenceRead cterm=bold ctermbg=red guibg=#464646 hi LspReferenceText cterm=bold ctermbg=red guibg=#464646 hi LspReferenceWrite cterm=bold ctermbg=red guibg=#464646 augroup lsp_document_highlight autocmd! *autocmd CursorHold lua vim.lsp.buf.document_highlight() autocmd CursorMoved lua vim.lsp.buf.clear_references() augroup END ]], false ) end end local lsp_config = {} function lsp_config.common_on_attach(client, bufnr) documentHighlight(client, bufnr) end function lsp_config.tsserver_on_attach(client, bufnr) lsp_config.common_on_attach(client, bufnr) client.resolved_capabilities.document_formatting = false end local function make_config() return { -- map buffer local keybindings when the language server attaches on_attach = on_attach, } end local function setup_servers() require'lspinstall'.setup() local servers = require'lspinstall'.installed_servers() table.insert(servers, "r_language_server") for _, server in pairs(servers) do local config = make_config() -- language specific config if server == "html" then config.filetypes = {"html", "blade"}; end if server == "php" then config.init_options = { licenceKey = "/Users/fabianmundt/iCloud/Documents/Sicherheitscodes/intelephense.txt"; }; end if server == "lua" then config.settings = { Lua = { diagnostics = { -- Get the language server to recognize the `vim` global globals = {'vim'}, } } } end nvim_lsp[server].setup(config) end end setup_servers() -- Automatically reload after `:LspInstall ` so we don't have to restart neovim require'lspinstall'.post_install_hook = function () setup_servers() -- reload installed servers vim.cmd("bufdo e") -- this triggers the FileType autocmd that starts the server end -- Automatically reload after `:LspInstall ` so we don't have to restart neovim require'lspinstall'.post_install_hook = function () setup_servers() -- reload installed servers vim.cmd("bufdo e") -- this triggers the FileType autocmd that starts the server end -- LSP omnifunc sync version for MUComplete chains local omnifunc_cache function _G.omnifunc_sync(findstart, base) local pos = vim.api.nvim_win_get_cursor(0) local line = vim.api.nvim_get_current_line() if findstart == 1 then -- Cache state of cursor line and position due to the fact that it will -- change at the second call to this function (with `findstart = 0`). See: -- https://github.com/vim/vim/issues/8510. -- This is needed because request to LSP server is made on second call. -- If not done, server's completion mechanics will operate on different -- document and position. omnifunc_cache = {pos = pos, line = line} -- On first call return column of completion start local line_to_cursor = line:sub(1, pos[2]) return vim.fn.match(line_to_cursor, '\\k*$') end -- Restore cursor line and position to the state of first call vim.api.nvim_set_current_line(omnifunc_cache.line) vim.api.nvim_win_set_cursor(0, omnifunc_cache.pos) -- Make request local bufnr = vim.api.nvim_get_current_buf() local params = vim.lsp.util.make_position_params() local result = vim.lsp.buf_request_sync(bufnr, 'textDocument/completion', params, 2000) if not result then return {} end -- Transform request answer to list of completion matches local items = {} for _, item in pairs(result) do if not item.err then local matches = vim.lsp.util.text_document_completion_list_to_complete_items(item.result, base) vim.list_extend(items, matches) end end -- Restore back cursor line and position to the state of this call's start -- (avoids outcomes of Vim's internal line postprocessing) vim.api.nvim_set_current_line(line) vim.api.nvim_win_set_cursor(0, pos) return items end
" Installation {{{ call plug#begin(stdpath('data') . 'vimplug') Plug 'prabirshrestha/asyncomplete.vim' Plug 'xianzhon/vim-code-runner' " Plug 'folke/which-key.nvim' Plug 'EdenEast/nightfox.nvim' Plug 'RishabhRD/popfix' Plug 'RishabhRD/nvim-cheat.sh' "Plug 'kristijanhusak/orgmode.nvim' Plug 'scrooloose/nerdtree' Plug 'github/copilot.vim' Plug 'skywind3000/asynctasks.vim' Plug 'skywind3000/asyncrun.vim' Plug 'jistvim-nerdtree-tabs' Plug 'nvim-lua/plenary.nvim' Plug 'nvim-lua/popup.nvim' Plug 'nvim-telescope/telescope.nvim' Plug 'neovim/nvim-lspconfig' Plug 'kabouzeid/nvim-lspinstall' Plug 'glepnilspsaga.nvim' Plug 'nvim-treesittenvim-treesitter', {'do': ':TSUpdate'} Plug 'nvim-treesittenvim-treesitter-textobjects' Plug 'lifepillavim-mucomplete' " Plug 'itchyny/lightline.vim' " Plug 'nvim-lualine/lualine.nvim' Plug 'glepnigalaxyline.nvim' Plug 'kyazdani42/nvim-web-devicons' " needed for galaxyline icons Plug 'tpope/vim-ragtag' Plug 'tpope/vim-surround' Plug 'tpope/vim-unimpaired' Plug 'imkmf/ctrlp-branches' Plug 'hara/ctrlp-colorscheme' Plug 'simplenote-vim/simplenote.vim' Plug 'tpope/vim-eunuch' Plug 'tpope/vim-fugitive' Plug 'rhysd/vim-grammarous' Plug 'yegappan/greplace' Plug 'tomtom/tcomment_vim' Plug 'ompugao/ctrlp-locate' Plug 'endel/ctrlp-filetype.vim' Plug 'suy/vim-ctrlp-commandline' Plug 'mbbill/desertex' Plug 'mhinz/vim-startify' Plug 'jalvesaq/Nvim-R' Plug 'metakirby5/codi.vim' Plug 'ctrlpvim/ctrlp.vim' Plug 'ryanoasis/vim-devicons' Plug 'tacahiroy/ctrlp-funky' Plug 'dbeecham/ctrlp-commandpalette.vim' Plug 'dense-analysis/ale' " Plug 'https://github.com/prashanthellina/follow-markdown-links' Plug 'phongnh/ctrlp-fzy-matcher' Plug 'halkn/ripgrep.vim' call plug#end() " }}} " General settings {{{ if exists('+termguicolors') let &t_8f = "\[38;2;%lu;%lu;%lum" let &t_8b = "\ [48;2;%lu;%lu;%lum" set termguicolors endif colorscheme duskfox set guifont=Iosevka:h12 let g:molokai_original=1 let g:blamer_enabled = 1 let g:webdevicons_enable_ctrlp = 1 let g:disco_nobright = 1 let g:disco_red_error_only = 1 set bg=dark let g:yui_comments = "fade" let g:mapleader = "\ " let maplocalleader = "\ " set autochdir set sessionoptions-=blank " This fixes a problem with nerdtree and sessions set modelines=1 " set spell " set spelllang=en set mouse=a " Enable mouse support in insert mode. set clipboard+=unnamedplus " Use clipboard set guioptions+=a set backspace=indent,eol,start " To make backscape work in all conditions. set ma " To set mark a at current cursor location. " set number " To switch the line numbers on. set expandtab " To enter spaces when tab is pressed. set smarttab " To use smart tabs. set tabstop=2 " Two chars for a tab set shiftwidth=2 set autoindent " To copy indentation from current line set si " To switch on smart indentation. set ignorecase " To ignore case when searching. set smartcase " When searching try to be smart about cases. set hlsearch " To highlight search results. set incsearch " To make search act like search in modern browsers. set magic " For regular expressions turn magic on. set showmatch " To show matching brackets when text indicator set mat=2 " How many tenths of a second to blink syntax enable " Enable syntax highlighting. set encoding=utf-8 fileencodings=ucs-bom,utf-8,gbk,gb18030,latin1 termencoding=utf-8 set nobackup " Turn off backup. set nowb " Don't backup before overwriting a file. set noswapfile " Don't create a swap file. "set ffs=unix,dos,mac " Use Unix as the standard file type. "au! BufWritePost $MYVIMRC source % " auto source when writing to init.vm alternatively you can run :source $MYVIMRC " autocmd CursorHoldI * update " Saves when changing from insert mode set undofile " Maintain undo history between sessions set undodir=~/.vim/undodir " Return to last edit position when opening files au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") exe "normal! g'\"" endif " Reload vimrc on save " au BufWritePost ~/.config/nvim/*.{vim,lua} so $MYVIMRC "map q :quit " Quit with q " FIXME: (broken) ctrl s to save noremap :update vnoremap :update inoremap :update " exit insert mode " inoremap " Find map / " indent / deindent after selecting the text with (⇧ v), (.) to repeat. vnoremap > vnoremap < " Cut, Paste, Copy vmap d vmap p vmap y " Undo, Redo (broken) nnoremap :undo inoremap :undo nnoremap :redo inoremap :redo " This mapping makes Ctrl-Tab switch between tabs. " Ctrl-Shift-Tab goes the other way. noremap :tabnext noremap :tabprev map :tabnew " switch between tabs with cmd+1, cmd+2,..." map 1gt map 2gt map 3gt map 4gt map 5gt map 6gt map 7gt map 8gt map 9gt " until we have default MacVim shortcuts this is the only way to use it in " insert mode imap 1gt imap 2gt imap 3gt imap 4gt imap 5gt imap 6gt imap 7gt imap 8gt imap 9gt set completeopt=noselect,noinsert,menuone,preview " >> Lsp key bindings nnoremap gd lua vim.lsp.buf.definition() nnoremap lua vim.lsp.buf.definition() nnoremap gD lua vim.lsp.buf.declaration() nnoremap gr lua vim.lsp.buf.references() nnoremap gi lua vim.lsp.buf.implementation() nnoremap K Lspsaga hover_doc nnoremap lua vim.lsp.buf.signature_help() nnoremap Lspsaga diagnostic_jump_prev nnoremap Lspsaga diagnostic_jump_next nnoremap gf lua vim.lsp.buf.formatting() nnoremap gn lua vim.lsp.buf.rename() nnoremap ga Lspsaga code_action xnoremap ga Lspsaga range_code_action nnoremap gs Lspsaga signature_help lua < RDSendSelection nmap RDSendLine " }}} " CtrlP interface {{{ if executable('rg') let g:ctrlp_user_command = 'rg --files %s' let g:ctrlp_use_caching = 0 let g:ctrlp_working_path_mode = 'rw' endif let g:ctrlp_match_func = { 'match': 'fzy_matcher#match' } let g:ctrlp_map = ' ' let g:ctrlp_cmd = 'CtrlPCommandPalette' let g:ctrlp_extensions = ['mixed', 'line', 'filetype', 'commandline', 'colorscheme', 'funky', 'branches'] let g:ripgrep_options='--hidden \ -g "!/cache/*" \ -g "!/data/*" \ -g "!/reports/*" \ -g "!/.git/*" \ -- ' let g:commandPalette = { \ 'Ignorecase: Toggle': 'set ignorecase!', \ 'File: save and close': 'wq', \ 'Start R': 'call StartR("R")', \ 'Start Object Browser': 'call RObjBrowser()', \ 'Start Inim': 'T inim', \ 'Search files': 'CtrlPMixed', \ 'MRU': 'CtrlPMRU', \ 'Search within project': 'call feedkeys(":CtrlPRg ")', \ 'Search in this file': 'CtrlPLine', \ 'Commend lines': 'TComment', \ 'Check grammar': 'GrammarousCheck', \ 'Set filetype': 'CtrlPFiletype', \ 'Bye!': 'qa!', \ 'Command history': 'call ctrlp#init(ctrlp#commandline#id())', \ 'Find file anywhere in system': 'CtrlPLocate', \ 'Colorschemes': 'CtrlPColorscheme', \ 'Unfold all lines': 'call feedkeys("\ zR\ ")', \ 'Fold all lines': 'call feedkeys("\ zM\ ")', \ 'Unfold here': 'call feedkeys("\ zo\ ")', \ 'Navigate sections of this file': 'CtrlPFunkyMulti', \ 'Run!': 'call feedkeys("\ B\ ")', \ 'More!': 'Telescope builtin', \ 'Branches': 'CtrlPBranches'} let g:ctrlp_match_window = 'results:100' set wildignore+=*/.git/*,*/.hg/*,*/.svn/* " }}} " Startify {{{ function! s:gitModified() let files = systemlist('git ls-files -m 2>/dev/null') return map(files, "{'line': v:val, 'path': v:val}") endfunction " same as above, but show untracked files, honouring .gitignore function! s:gitUntracked() let files = systemlist('git ls-files -o --exclude-standard 2>/dev/null') return map(files, "{'line': v:val, 'path': v:val}") endfunction let g:startify_lists = [ \ { 'type': 'files', 'header': [' MRU'] }, \ { 'type': 'sessions', 'header': [' Sessions'] }, \ ] " }}} " Nerdtree {{{ nnoremap :NERDTreeTabsToggle " Start NERDTree when Vim starts with a directory argument. autocmd StdinReadPre * let s:std_in=1 autocmd VimEnter * if argc() == 1 && isdirectory(argv()[0]) && !exists('s:std_in') \ execute 'NERDTree' argv()[0] wincmd p enew execute 'cd '.argv()[0] endif "autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) q endif " Exit Vim if NERDTree is the only window left. autocmd BufEnter * if tabpagenr('$') == 1 && winnr('$') == 1 && exists('b:NERDTree') && b:NERDTree.isTabTree() \ quit endif let g:NERDTreeChDirMode = 2 " 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! \ w" execute 'buffer'.buf endif autocmd BufWinEnter * silent NERDTreeMirror " Open the existing NERDTree on each new tab. " }}} " ALE {{{ let g:ale_linters = { \ 'nim': ['nimlsp', 'nimcheck'], \ 'sh': ['shellcheck'] \} let g:ale_fixers = { \ '*': ['remove_trailing_lines', 'trim_whitespace'], \ 'rmd': ['styler'], \ 'nim': ['nimpretty'], \} let g:ale_fix_on_save = 1 let g:ale_linters_explicit = 1 let g:ale_set_loclist = 0 let g:ale_set_quickfix = 1 let g:ale_lint_on_text_changed = 'never' let g:ale_lint_on_insert_leave = 0 let g:ale_fix_on_save = 1 let g:ale_sign_error = '✖✖' let g:ale_sign_warning = '⚠⚠' highlight ALEErrorSign guifg=Red highlight ALEWarningSign guifg=Yellow " }}} " Nim configuration - asyncomplete {{{ au User asyncomplete_setup call asyncomplete#register_source({ \ 'name': 'nim', \ 'whitelist': ['nim'], \ 'completor': {opt, ctx -> nim#suggest#sug#GetAllCandidates({start, candidates -> asyncomplete#complete(opt['name'], ctx, start, candidates)})} \ }) " }}} " Nim configuration - CodeRunner and TREPL {{{ let g:CodeRunnerCommandMap = { \ 'nim' : 'nim c -r $fileName' \} let g:code_runner_save_before_execute = 1 let g:neoterm_callbacks = {} function! g:neoterm_callbacks.before_new() if winwidth('.') > 100 let g:neoterm_default_mod = 'botright vertical' else let g:neoterm_default_mod = 'botright' end endfunction nmap B CodeRunner autocmd FileType nim nmap d :TREPLSendLine " }}} " Grammarous {{{ let $PATH.=':/uslib64/openjdk-11/bin/' let $MYVIMRC='/home/luis/.config/nvim/init.vim' " }}} " MUCOMPLETE {{{ let g:mucomplete#enable_auto_at_startup = 1 let g:mucomplete#chains = { \ 'default' : ['omni', 'path', 'c-n'], \ } let g:mucomplete#chains['rmd'] = { \ 'default' : ['user', 'path', 'uspl'], \ 'rmdrChunk' : ['omni', 'path'], \ } " }}} " Async Run {{{ augroup renderRmd au! autocmd BufWritePost *.Rmd call Render() augroup end function! Render() abort :AsyncTask render endfunction let g:asyncrun_open = 6 " }}} " Vim Script let g:lightline = {'colorscheme': 'nightfox'} " vim:foldmethod=marker:foldlevel=0
2022.01.20 13:42 TectonicRock113 Concealment Issue with VimTeX
" --- general appearance settings --- " syntax enable set title "shows current filename " --- general behavior settings --- " set mouse=a "Mouse enabled for scrolling & resizing set spell "Enable spellchecking " command line tab completion set wildmenu set wildmode=longest:full,full set showmatch "shows matching bracket/brace set confirm "Display confirmation dialog when closing unsaved file set autochdir "current working directory is most recent accessed file filetype off " --- removing annoying features vim --- " set belloff=all set shortmess+=I "disable default vim startup message set backspace=indent,eol,start "allows backspace over anything set hidden "allows hiding buffers with unsaved changes " 'Q' in normal mode enters Ex mode. This is unwanted nmap Q" -- smarter searching behavior --- " set ignorecase "Ignore case when searching set smartcase "Auto switch search to case sens when cap letters typed set incsearch "Incremental search showing partial matches set nohlsearch "Disable search highlighting "set hlsearch "Enable search highlighting " --- ruler settings --- " set number "shows number of current line set relativenumber "lines numbers are relative to current line set colorcolumn=80 "line wrapping settings set wrap set linebreak set textwidth=80 " centers the screen on the cursor set scrolloff=999 " --- Indentation Option --- " set autoindent "New lines inherit indentation set expandtab "convert tabs to spaces set shiftround "round indentation to shiftwidth when shifting set shiftwidth=4 "when shifting, indent using four spaces set tabstop=4 "indent using four spaces set smarttab "Insert 'tabstop' number of spaces when tab is pressed filetype plugin indent on "enable file specific indentation rules " --- Custom keybindings --- " "below two commands allow access to os clipboard noremap oy "*y noremap op "*p noremap od "*d noremap ho :noh noremap bn :bn noremap bd :bd noremap bp :bp " Plugins will be downloaded under the specified directory call plug#begin('~/.vim/plugged') " Declare the list of plugins Plug 'vim-airline/vim-airline' Plug 'vim-airline/vim-airline-themes' Plug 'scrooloose/nerdtree' Plug 'tpope/vim-fugitive' Plug 'jiangmiao/auto-pairs' Plug 'tpope/vim-surround' Plug 'scrooloose/nerdcommenter' Plug 'scrooloose/syntastic' Plug 'lervag/vimtex' Plug 'kien/ctrlp.vim' Plug 'honza/vim-snippets' Plug 'sirveultisnips' Plug 'yggdroot/indentline' Plug 'fatih/vim-go' Plug 'valloric/youcompleteme' Plug 'arcticicestudio/nord-vim' " Call ends here plugins are not visible to vim after here call plug#end() " --- vimtex settings --- " let g:vimtex_view_method='skim' let g:vimtex_quickfix_mode=0 set conceallevel=2 let g:tex_conceal="abdgm" " --- appearance settings --- " colorscheme nord " --- nerdtree settings --- " "close the tab is NERDTree is the only window remaining in it autocmd BufEnter * if winnr('$') == 1 && exists('b:NERDTree') && b:NERDTree.isTabTree() quit endif "custom nerdtree keybindings nnoremap nt :NERDTreeToggle nnoremap nf :NERDTreeFind " --- vimairline settings --- " let g:airline#extensions#tabline#enabled = 1 "Shows buffers as 'tabs' let g:airline_theme='monochrome' " --- ctrlp settings ---" nnoremap cp :CtrlP nnoremap cb :CtrlPBuffer " --- youcompleteme settings ---" let g:ycm_autoclose_preview_window_after_completion = 1
2021.12.21 20:19 ardms Issue with popup window in Debian 11
"Use Vim settings, rather than Vi settings set nocompatible filetype off "---------------------------------------------------------- " GENERAL "---------------------------------------------------------- " Do not keep any history set viminfo='0,:0,<0,@0,f0 set nobackup set nowb set noswapfile " mouse support set mouse=a " clipboard support set clipboard+=unnamedplus " Disable bells set noerrorbells set visualbell set t_vb= " Ignore case when searching set ignorecase set smartcase " Set working directory same as file being edited " set autochdir " Needed for Deopleete and relavant plugins set encoding=utf-8 set pyxversion=3 " Set , as the leader key let mapleader = "," " Add all directories under current directory recursively set path=.,,** " Open splits on the right instead of the left set splitright "---------------------------------------------------------- " Terminal mode mappings "---------------------------------------------------------- tnoremap"---------------------------------------------------------- " Plugin Managment "---------------------------------------------------------- " Specify a directory for plugins " - For Neovim: stdpath('data') . '/plugged' " - Avoid using standard Vim directory names like 'plugin' call plug#begin('~/.config/vim/plugged') " Make sure you use single quotes Plug 'dense-analysis/ale' Plug 'jiangmiao/auto-pairs' " Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' } " Autocomplestion from memory Plug 'davidhaltejedi-vim' " Autocomplestion for Python Plug 'ayu-theme/ayu-vim' " colorscheme Plug 'morhetz/gruvbox' Plug 'Yggdroot/indentLine' " displaying thin vertical lines at each indentation level Plug 'pangloss/vim-javascript' " Nice formating for Javascript files use x for autocompletion Plug 'valloric/MatchTagAlways' " highlight Matching HTML Tags " Initialize plugin system call plug#end() "---------------------------------------------------------- " LOOK AND FELL "---------------------------------------------------------- " Set the colorscheme and window transparency colorscheme gruvbox set background=dark " set termguicolors " let ayucolor="mirage" " colorscheme ayu " Show matching bracets set showmatch " Show ruler and command visual aid set ruler set showcmd " Highlight the cursor line set cursorline " Show line number and listchars set list set nu " Vertical like at column 80 set colorcolumn=80 " Spesifics for indentLine plugin " let g:indentLine_char_list = ['', '¦', '┆', '┊'] let g:indentLine_setColors = 0 set lcs+=space:· " This is spesific for the MatchTagAlways plugin " will allow the pluin to work in all tose file types let g:mta_filetypes = { \ 'html' : 1, \ 'xhtml' : 1, \ 'xml' : 1, \ 'jinja' : 1, \ 'javascript' : 1, \} "----------------------------------------------------------- " Python spesific PEP8 indentation "----------------------------------------------------------- set tabstop=4 set softtabstop=4 set shiftwidth=4 "set textwidth=79 set expandtab "set autoindent "set fileformat=unix let g:pymode_python = 'python3' "let g:ale_python_flake8_executable = 'python3' " Check Python files with flake8 and pylint. let b:ale_linters = ['flake8', 'pylint'] " Keep the sign gutter open at all times let g:ale_sign_column_always = 1 " Disable Python 2 support "let g:loaded_python_provider = 0 "----------------------------------------------------------- " Python autocomplete "----------------------------------------------------------- " Atempts to make jedi plygin faster let g:pymode_rope=0 let g:pymode_folding=0 " Disable opening documentation window when autocompleting with jedi set completeopt-=preview " Disable popup window with option and arguments when autocompleting let g:jedi#show_call_signatures=0 let g:jedi#use_splits_not_buffers="right" "------------------------------------------------------------------------------ " Status line configuration "------------------------------------------------------------------------------ " format markers: " %t File name (tail) of file in the buffer " %m Modified flag, text is " [+]"; " [-]" if 'modifiable' is off. " %r Readonly flag, text is " [RO]". " %y Type of file in the buffer, e.g., " [vim]". " %= Separation point between left and right aligned items. " %l Line number. " %L Number of lines in buffer. " %c Column number. " %P percentage through buffer set statusline=%{toupper(mode())}\\ \~%t\ %m%r%y%=(ascii=\%03.3b,hex=\%02.2B)\ (%l/%L,%c)\ (%P) set laststatus=2 " change highlighting based on mode if version >= 700 highlight statusLine cterm=bold ctermfg=7 ctermbg=3 au InsertLeave * highlight StatusLine cterm=bold ctermfg=7 ctermbg=3 au InsertEnter * highlight StatusLine cterm=bold ctermfg=7 ctermbg=6 endif "------------------------------------------------------------------------------ " Change the color of the line numbers when in Incert mode "------------------------------------------------------------------------------ " Default Colors for CursorLine and Cursor " highlight CursorLine ctermfg=7 ctermbg=grey " Change Color when entering Insert Mode autocmd InsertEnter * highlight CursorLineNr cterm=bold ctermfg=6 " Revert Color to default when leaving Insert Mode autocmd InsertLeave * highlight CursorLineNr cterm=bold ctermfg=None "------------------------------------------------------------------------------ " General Snippets "------------------------------------------------------------------------------ "Add Python hidder every time a new python file is cretaed " autocmd BufNewFile *.py -1r C:\Users\Aris.Dimopoulus\bin\nvim\Python_File_header.txt " Add comment section every time you type pc " nnoremap pc :-1read C:\Users\Aris.Dimopoulus\bin\nvim\Python_comment.txt jla "---------------------------------------------------------- " This litle snipet found in stackoverflow will create a " nice looking tabline with the addition of a + if changes " have been made to the file "---------------------------------------------------------- set tabline=%!MyTabLine() " custom tab pages line function! MyTabLine() let s = '' " loop through each tab page for i in range(tabpagenr('$')) if i + 1 == tabpagenr() let s .= '%#TabLineSel#' else let s .= '%#TabLine#' endif if i + 1 == tabpagenr() let s .= '%#TabLineSel#' " WildMenu else let s .= '%#Title#' endif " set the tab page number (for mouse clicks) let s .= '%' . (i + 1) . 'T ' " set page number string let s .= i + 1 . '' " get buffer names and statuses let n = '' " temp str for buf names let m = 0 " &modified counter let buflist = tabpagebuflist(i + 1) " loop through each buffer in a tab for b in buflist if getbufvar(b, "&buftype") == 'help' " let n .= '[H]' . fnamemodify(bufname(b), ':t:s/.txt$//') elseif getbufvar(b, "&buftype") == 'quickfix' " let n .= '[Q]' elseif getbufvar(b, "&modifiable") let n .= fnamemodify(bufname(b), ':t') . ', ' " pathshorten(bufname(b)) endif if getbufvar(b, "&modified") let m += 1 endif endfor " let n .= fnamemodify(bufname(buflist[tabpagewinnr(i + 1) - 1]), ':t') let n = substitute(n, ', $', '', '') " add modified label if m > 0 let s .= '+' " let s .= '[' . m . '+]' endif if i + 1 == tabpagenr() let s .= ' %#TabLineSel#' else let s .= ' %#TabLine#' endif " add buffer names if n == '' let s.= '[New]' else let s .= n endif " switch to no underlining and add final space let s .= ' ' endfor let s .= '%#TabLineFill#%T' " right-aligned close button " if tabpagenr('$') > 1 " let s .= '%=%#TabLineFill#%999Xclose' " endif return s endfunction
2021.07.19 18:57 diggitydata Auto indent over-indents in python
2021.07.10 11:51 lestrenched No plugin Vim setups
2021.05.28 04:18 Tommysw Smarter indentation
2021.03.28 23:24 eXoRainbow Some mappings, what do you think?
" Leader key space let mapleader=" " " Make sure spacebar does not have any mapping beforehand. nnoremapNormal mode mappings" Source vim configuration without restarting. command S source ~/.vimrc " Insert output of command as if it was piped from terminal. cnoremap read ! nnoremap :read ! inoremap :read !
" Toggle between search highlight on off. nnoremapInsert mode mappingsh :setlocal hlsearch! " Toggle between spellcheck on off. nnoremap s :setlocal spell! " Toggle autowrap at window border for display without changing the content. nnoremap l :setlocal wrap! " Toggle colorcolumn line. nnoremap c :execute "set colorcolumn=" \ . (&colorcolumn == "" ? 80 : "") " Toggle textwidth on and off for automatic linebreak nnoremap t :execute "set textwidth=" \ . (&textwidth == 0 ? 79 : 0) " search next ", ', [, ], {, }, (, ), <, > and replace inside pair nnoremap c" /" ci" nnoremap c' /' ci' nnoremap c[ /[ ci[ nnoremap c] /] ci] nnoremap c{ /{ ci{ nnoremap c} /} ci} nnoremap c( /( ci( nnoremap c) /) ci) nnoremap c< /< ci< nnoremap c> /> ci> " Create new line with auto indentation. A replacement for "o", when indentation of next line should be added automatically by autoindent of vim nnoremap A " Indent text from current position, instead of entire line. nnoremap i w " Backspace from current position, especially to remove indentation. nnoremap i l " Easy to remember shortcut to reflow current paragraph. nnoremap f gwip
" Start a new change before deleting with Ctr+u, so a normal mode "u" can still " recover the deleted word or line. Normally Ctrl+u while in insert mode " would delete the text without undo history and it would be lost forever. inoremapu inoremap u " Autocompletion of filenames in insert mode. Ctrl+d will abort. inoremap " Complete and go in folder. inoremap
2021.03.07 02:50 coffeeb4code Tab spacing and Visualization
function myfunc() { this.document = null; }It visually has two spaces in vim, but is 1 tab, and auto indent adds only 1 tab when I type { and hit enter.
2021.01.08 21:48 deicosaic help: copyindent fails when i install vimplug
"call plug#begin('~/.vim/plugged') "call plug#end() syntax on set tabstop=8 set softtabstop=0 set shiftwidth=8 set autoindent set nosmartindent set nocindent set copyindentI open a file called temp.c and type in the sequence:
2020.12.15 05:46 backtickbot https://np.reddit.com/r/learnprogramming/comments/kddqdi/is_vimneovim_worth_using/gfw3zew/
" This is boring technical stuff, just do it set nocompatible set wildmenu set backspace=indent,eol,start " Turn on line numbers at the bottom and beside your text set number set ruler " Syntax higlighting and indenting syntax on filetype plugin indent on " Turn off the arrow keys to force you to learn hjkl :P you don't need to use this if you don't want noremapQuite a lot! Then I recommend these plugins (language-independent):noremap noremap noremap " Lets you use Tab as Esc to save reaching for the escape key. " You can also remap something else. Some people use Caps Lock instead. noremap " Make your tabs automatically turn to spaces and turn on indentation set expandtab set autoindent " These guys are for plugins. A lot of plugins require a 'leader' key and a 'local leader' " I like \ for leader and space for local leader. Other people like other things. Your call. let mapleader = '\' let maplocalleader = ' ' " Git commit max message width autocmd Filetype gitcommit setlocal spell textwidth=72 " Make vim show you trailing spaces as well as tabs set list set listchars=tab:•\ ,trail:•,extends:»,precedes:« " Lets you type %% in command mode to expand to the CWD cabbr %% expand('%:p:h') " fzf.vim nnoremap :Files " Colorscheme. Pick one you like. I like papercolor set background=dark colorscheme papercolor " Tell ALE to automatically kill extra whitespace let g:ale_fixers = { \ '*': ['trim_whitespace'], \} let g:ale_linters_explicit = 1 let g:ale_fix_on_save = 1 " ALE display config let g:ale_sign_error = '✘' let g:ale_sign_warning = '⚠' highlight ALEErrorSign ctermbg=NONE ctermfg=red highlight ALEWarningSign ctermbg=NONE ctermfg=yellow " vim-signify display config let g:signify_sign_add = '┃' let g:signify_sign_change = '┃' let g:signify_sign_delete = '•' let g:signify_sign_show_count = 0 " Hide number of deleted lines
2020.06.26 17:06 rishabhdeepsingh98 How do I highlight the whole searched text?
2020.05.06 16:34 Phildos can't get vim-cpp-enhanced-highlight to work on windows w/ gvim
" for win vundle set nocompatible filetype off set rtp+=~/.vim/bundle/Vundle.vim call vundle#begin() Plugin 'VundleVim/Vundle.vim' " end win vundle " win vundle plugins Plugin 'octol/vim-cpp-enhanced-highlight' " end win vundle plugins so C:\Users\phildo\.vim\plugin\a.vim colorscheme slate " for a.vim - finds counterpart 'h'->'c' files nnoremapIf I open a .cpp file (with valid c++ syntax) it's just white-on-black text (same as any text file).:A " Autoindent set autoindent " Tabs set expandtab set smarttab set shiftwidth=2 set softtabstop=2 " Backspace set backspace=2 " Wrap set nowrap set hidden " Line # set number " Ignore case intelligently set ignorecase set smartcase " Incremental search set incsearch " Highlight search set hlsearch " sets quick timeout for paren matching let g:matchparen_insert_timeout=5 " leave insert mode quickly set timeout timeoutlen=1000 ttimeoutlen=100 " buffer switching with g nnoremap gp :bp nnoremap gn :bn nnoremap gl :ls nnoremap gb :ls :b " saves/quits all without warning (even if 'unvisited buffers' exist) nnoremap ZZ :wqa! " remove highlights nnoremap :nohl " set guifont=Consolas:h11 " set autochdir
2020.04.15 16:49 kj4ohh neovim ignoring foldlevel=99?
" Show line numbers set nu " Window split preferences set splitbelow " horizontal splits open below set splitright " vertical splits open to the right " Navigation for split windows nnoremapAnd here is my ~/.vim/afteftplugin/python.vim:" move to window below nnoremap " move to window above nnoremap " move to window to the right nnoremap " move to window to the left " YouCompleteMe preferences let g:ycm_autoclose_preview_window_after_completion=1 map g :YouCompleter GoToDefinitionElseDeclaration " Map Ctrl-N to togglet NERDTree map :NERDTreeToggle " Enable Powerline font for vim-airline let g:airline_powerline_fonts = 1 """ Begin vundle setup, next two lines are required set nocompatible " required to begin vundle setup filetype off " required to begin vundle setup " set the runtime path to include vundle and initialize set rtp+=~/.vim/bundle/Vundle.vim call vundle#begin() " let vundle manage vundle, required... Plugin 'gmarik/Vundle.vim' " add all other plugins here for vundle to manage Plugin 'vim-scripts/indentpython.vim' " better python indenting plugin Plugin 'tmhedberg/SimpylFold.git' " better python code folding plugin Plugin 'Konfekt/FastFold.git' " Improves folding speed Plugin 'Valloric/YouCompleteMe' " Auto-complete tool Plugin 'vim-syntastic/syntastic' " Syntax checker Plugin 'nvie/vim-flake8' " PEP 8 style enforcement Plugin 'scrooloose/nerdtree' " File browser for vim Plugin 'kien/ctrlp.vim' " Ctrl-P Super Search plugin Plugin 'tpope/vim-fugitive' " git integration for vim Plugin 'vim-airline/vim-airline' " Powerline status bar for vim Plugin 'vim-airline/vim-airline-themes' " Themes for vim-airline Plugin 'stephpy/vim-yaml' " YAML syntax for vim " ... """ End vundle setup - All plugins must be defined above this line call vundle#end() " required to end vundle setup filetype plugin indent on " required to end vundle setup
" Set python3 to be make program :set makeprg=python3\ % :set autowrite " autosave python script before running it " Enable UTF-8 support for Python set encoding=utf-8 " set fold preferences set foldmethod=indent set foldlevel=99 nnoremapza " Python PEP 8 indentation setlocal tabstop=4 setlocal softtabstop=4 setlocal shiftwidth=4 setlocal textwidth=79 setlocal expandtab setlocal autoindent setlocal fileformat=unix " Mark unnecesary whitespace highlight ExtraWhitespace ctermbg=red guibg=red match ExtraWhitespace /\s\+$/ " Make python code look better let python_highlight_all=1 syntax on " Virtualenv support py3 << EOF import os import sys if 'VIRTUAL_ENV' in os.environ: project_base_dir = os.environ['VIRTUAL_ENV'] activate_this = os.path.join(project_base_dir, 'bin/activate_this.py') execfile(activate_this, dict(__file__=activate_this)) EOF
2019.08.17 22:08 nicolassilva Vimrc shortcut not working