Vim autoindent off

Vim Plugins

2009.12.30 14:45 pkrumins Vim Plugins

Place to share your Vim plugins!
[link]


2012.03.28 05:15 anarcholibertarian Vim Magic

[link]


2024.01.31 05:16 drunkenblueberry Auto-indent in TeX files

When editing TeX files, neovim sometimes indents new lines 2x or even 3x. I also see it happen when I type a '{' or '('. I have tried changing .config/nvim/afteftplugin/tex.vim:
setlocal autoindent let g:tex_indent_brace=0 let g:tex_indent_and=0 let g:tex_indent_items=0 
I 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.
submitted by drunkenblueberry to neovim [link] [comments]


2024.01.09 13:07 JitStill Auto Indentation Differences: Neovim vs. Vim

I recently switched from Vim to Neovim. I'm trying to understand the differences in how Neovim handles indentation compared to regular Vim. In my current init.lua and .vimrc files, I have the following indentation settings:
set autoindent autocmd FileType * setlocal formatoptions-=cro
It seems that Neovim is still not behaving exactly like Vim. I want to keep a consistent user experience between Vim and Neovim, as I still may need to use Vim in the future. Having indentation behave the same across both programs is important to me. Here is an example where Neovim and Vim indentation doesn't behave the same, despite using the the same settings.
Vim on the Left, Nvim on the Right.
Thanks.
Update:
I have since fixed this.
I didn't know that Nvim loads a couple more built in plugins compared to regular Vim. Running :scriptnames helped me identify indent.vim and couple other language specific plugins like python.vim. In fact, the Python plugin was setting my indentation to the recommend PEP8, which I didn't want. I'm on macOS and installed Nvim through Homebrew. These files are located in /uslocal/Cellaneovim/0.9.5/share/nvim/runtime, if anyone is curious. At first I was just going to delete these files, but then I realized I just needed to add filetype indent off and filetype plugin off to my init.lua file. With these settings, I also no longer needed set autoindentautocmd FileType * setlocal formatoptions-=cro, which I was using to avoid adding auto comments on a new line in Nvim. Of course, I know this means that I turned off all the language specific features, but now it's behaving exactly like regular Vim, which is what I wanted. Reading this was also really helpful: https://neovim.io/doc/usevim_diff.html#nvim-defaults
Also, I just wanted to clarify that there is auto indentation on the Vim picture on the left. The difference is that the auto indentation depends on the indentation of the previous line, from what I'm used to. For example, if I was writing a for loop and it was indented 2 spaces over, then the line right underneath the for loop declaration would also be indented 2 spaces over. I would need to hit tab one more time on that line to start writing inside the for loop body, 4 spaces over. Here is more info on this behavior: https://vi.stackexchange.com/questions/5818/what-is-the-difference-between-autoindent-and-smartindent-in-vimrc
submitted by JitStill to neovim [link] [comments]


2023.04.22 21:33 Punkt_Punkt_Punkt Matching of Bracket Under Cursor Not Working

Hey guys,
today I reconfigured my Neovim. For the most part I'm satisfied now, but strangely the matching bracket to the bracket under the cursor is not highlighted. After some research it seems that matchparen is the standard plugin responsible for the functionality. As far as I'm aware I haven't explicitly turned it off.
These are my configurations: ``` local opt = vim.opt -- To save you some typing
-- Visual Appearance opt.termguicolors = true -- Enable 24-bit RGB colors opt.showmatch = true -- Show matching brackets (typing and on cursor-over) opt.background = 'dark' -- Default for colorschemes with light and dark mode opt.signcolumn = "yes" -- A symbol/character column used by certain plugins opt.cursorline = true -- Highlight the current line opt.cmdheight = 1 -- Height of the command bar
-- Line Numbers opt.relativenumber = true -- Show relative line numbers (for direct jumps) opt.number = true -- Show the absolute number of the current line
-- Tabs opt.tabstop = 4 opt.shiftwidth = 4 opt.softtabstop = 4 opt.expandtab = true
-- Search Behavior opt.incsearch = true -- Show matches while typing (as in modern browsers) opt.ignorecase = true -- Lower-case characters match upper-case characters opt.smartcase = true -- Upper-case characters match only upper-case characters opt.hlsearch = true -- Turn off: vim.keymap.set("n", "nh", ":nohl")
-- Text Wrapping opt.wrap = true -- Use separate visual lines for long lines opt.breakindent = true -- Line wrapping preserves indentation opt.linebreak = true -- Primarily to prevent wrapping within words
-- Split Windows opt.splitright = true -- Prefer windows splitting to the right opt.splitbelow = true -- Prefer windows splitting to the bottom
-- Miscellaneous opt.belloff = "all" -- Never ring the unwanted bell opt.clipboard = "unnamedplus" -- ALWAYS use the clipboard for ALL operations -- (instead of interacting with '+'/'*' registers opt.mouse = "a" -- It's okay to use the mouse -- opt.foldmethod = "indent" -- Fold levels are defined by indentation opt.autoindent = true opt.cindent = true opt.updatetime = 1000 -- Relevant for CursorHold (as used by some plugins) -- opt.scrolloff = 10 -- There are always ten lines below/above cursor
opt.formatoptions:remove("a") -- Prevent auto formatting opt.formatoptions:remove("t") -- Don't auto format my code (I use linters instead) opt.formatoptions:append("c") -- Comments should respect textwidth opt.formatoptions:append("q") -- Allow formatting comments w/ gq opt.formatoptions:remove("o") -- O and o, don't continue comments opt.formatoptions:append("r") -- But do continue when pressing enter opt.formatoptions:append("n") -- Indent past the formatlistpat, not underneath it opt.formatoptions:append("j") -- Auto-remove comments if possible opt.formatoptions:remove("2") -- -- Check :verbose set formatoptions? if you feel like this is overwritten somehow
-- Highlight on yank (copy). It will do a nice highlight blink of the thing you just copied. vim.api.nvim_exec( [[ augroup YankHighlight autocmd! autocmd TextYankPost * silent! lua vim.highlight.on_yank() augroup end ]], false ) (`/plugin/options.lua`) require('onedark').setup { style = 'deep' } require('onedark').load()
-- Transparent backgrounds for the Diagnostics messages vim.cmd([[highlight DiagnosticVirtualTextError guibg=none]]) vim.cmd([[highlight DiagnosticVirtualTextWarn guibg=none]]) vim.cmd([[highlight DiagnosticVirtualTextInfo guibg=none]]) vim.cmd([[highlight DiagnosticVirtualTextHint guibg=none]])
-- The grey matching color makes the parenthesis disappear when cursor is on the next position vim.cmd([[highlight MatchParen guibg=purple]]) `` (/plugin/colorscheme.lua`)
With formatoptions I had problems with /usshare/nvim/runtime/ overwriting things, so maybe something similar is the problem here?
Thanks for your input!
submitted by Punkt_Punkt_Punkt to neovim [link] [comments]


2022.12.05 06:34 benbrastmckie Auto Indent in LaTeX

I'm struggling to get the autoindent to work for LaTeX files. For instance, I'm getting the following: ``` \begin{enumerate} \item[\it Label:] \item[\it Label:] \item[\it Label:]
\end{enumerate} When what I'd like to get is: \begin{enumerate} \item[\it Label:] \item[\it Label:] \item[\it Label:]
\end{enumerate} I've tried turning autoindent off and on, and the same for smartindent. I've tried the following: vim.g['tex_flavor'] = 'latex' vim.g['tex_indent_items'] = false vim.g['tex_indent_and'] = false vim.g['tex_indent_brace'] = false ``` It does also do annoying things if I open an brace, indenting the whole line while in insert mode. Anyhow, any pointers would much appreciated.
submitted by benbrastmckie to neovim [link] [comments]


2022.10.07 00:21 OomMielie Need help with coc.nvim settings

I recently started using Vim for my code development, so please bear with me.
I am a final year CS student and mostly use Java or C to code. I have been very reliant on IDEs (especially IntelliJ) for my coding and thought Vim would be a nice change.
I installed Vim-Plug as my plugin manager and used this to get coc.nvim to keep some of the IDE nice-to-haves. The code completion is working nicely as I combined it with coc-tabnine. I also installed coc-java for my java development. However, it doesn't seem like everything is working correctly...
Firstly, when I open Vim, it gives this error. Here is what my java installations look like and to which one my JAVA_HOME is pointing (OpenJDK-18). I imagine this is what is causing the following things to break:
When I auto-complete code, it does not automatically add the necessary import at the top as it should. I also do not get any error indicators in the code (not as big a problem). The import functionality would be very useful as it is very tedious in java to add imports for everything manually.
I'd appreciate any help!

My vimrc if it helps (located in ~/.vim):
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 
submitted by OomMielie to vim [link] [comments]


2022.09.20 19:19 shmerl Adding a line break without applying indentation?

Consider such scenario. There is text with a few preceding spaces:
foo
I wanted to simply add a new line at the beginning, without losing those spaces. But with vim if autoindent is on, simply pressing Enter before that in Insert mode will swallow all the spaces. Is there some easy way (that can be mapped to Ctrl + Enter may be?) to add a line break without going through turning autoindent off and on back?
UPDATE:
Here is a rough method I came up with. Binding something to Ctrl+Enter didn't work, so I used Ctrl+L:
:inoremap :set paste:set nopaste
Ideally it should be improved to read the current value of paste, and restoring it after the operation. So may be some kind of function would work better.
UPDATE 2:
Slightly improved version:
:inoremap set pasteset nopaste
For Shift + Enter to work, Konsole needed a configuration change for the keyboard combos, to emit \x1b[13;2u for Return+Shift.
submitted by shmerl to vim [link] [comments]


2022.03.31 01:42 Sol33t303 Can't figure out how to setup the indent-blankline plugin?

I'm trying to figure out how to setup https://github.com/lukas-reineke/indent-blankline.nvim. Decided to ask about it here instead of opening up an issue because it's probably something I don't understand about neovim (currently trying to setup my neovim environment for the first time, using vim-plugged).
I have been trying to setup, but it simply does not appear to do anything. I can't for the life of me figure out where I am supposed to put the following lua code:
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.
Here is my full config:
" 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 
submitted by Sol33t303 to neovim [link] [comments]


2022.01.30 17:25 freddiehaddad LunarVim keeps indenting 4 spaces no matter my settings..

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.
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.
submitted by freddiehaddad to lunarvim [link] [comments]


2022.01.24 00:48 lf_araujo Help me understand this startup error

Hi everyone,
Fist time posting here, so sorry if I am doing anything wrong.
I have this old vim setup for R data science, that evolved into a nvim setup and which was updated to a PERFECT partially lua setup. It has everything the way I wanted. But somehow, with some upstream change it stopped working after I updated my packages.
The error is:
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 ^I 
it 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 
My init.vim file:
" 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 
submitted by lf_araujo to neovim [link] [comments]


2022.01.20 13:42 TectonicRock113 Concealment Issue with VimTeX

VimTeX has a feature where LaTeX code is concealed when the cursor is not on that line. Although this is a helpful feature, I've been unable to resolve an issue where the concealment remains on the line where my cursor is on. I'd expect the concealment to be removed on the line that my cursor is on, but now I am forced to manually toggle the concealment. Oddly enough, entering visual selection mode unconceals the current line.
Any advice on how to resolve this issue?
" --- 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 
submitted by TectonicRock113 to vim [link] [comments]


2021.12.21 20:19 ardms Issue with popup window in Debian 11

I have recently upgraded an old laptop Debian to Bullseye that hasn't been used from some time. I don't know if this is the expected behavior but vim is not showing any of the popup windows. Either in command mode when looping through commands or files or in insest mode when trying to autocomplete. My vimrc under. I'm able to autocomplete both in command mode and insert mode using to loop through the options but I'm not able to see the options.
"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.txtjla "---------------------------------------------------------- " 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 
submitted by ardms to vim [link] [comments]


2021.07.19 18:57 diggitydata Auto indent over-indents in python

I've tried changing every single indentation setting in vim to get the right indendation in python and I can't get it to work. I don't want to turn off auto indent, I just want it to work correctly. It mostly works, but there is one case where it does not. If I type something like an opening paren and then hit enter, I get indented two levels instead of one. If I do a colon, e.g. for x in y: it automatically gives me a single indent level correctly. But if I do long_function_name( and hit enter, it indents two levels (8 spaces). Can anyone help? Here are my indent settings right now, however I have changed all of these and others all around and this double indent never goes away. This is located at the very bottom of my .vimrc. I'm guessing I need something in /afteplugin or whatever.
filetype plugin indent on set expandtab tabstop=4 softtabstop=4 shiftwidth=4 autoindent autocmd FileType python setlocal expandtab shiftwidth=4 softtabstop=4
submitted by diggitydata to vim [link] [comments]


2021.07.10 11:51 lestrenched No plugin Vim setups

Hi everyone! Vim noob here, literally started using Vim yesterday lol.
I have decided to go the no plug-in route, as a personal choice. Because I'm a noob, I wanted to see what other redditors having put in their .vmirc.
Here's my .vimrc as of now:
``` " BASIC SETUP:
" enter the current millenium set nocompatible
" enable syntax, plugins (for netrw) and indentation syntax enable filetype plugin indent on set autoindent
" Setting up the tabs from the Vim wiki on reddit set tabstop=8 set softtabstop=4 set shiftwidth=4 set expandtab
" omnifunc settings au FileType python setl ofu=pythoncomplete#CompletePython
" FINDING FILES:
" Search down into subfolders " Provides tab-completion for all file-related tasks set path+=**
" Display all matching files when we tab complete set wildmenu
" NOW WE CAN: " - Hit tab to :find by partial match " - Use * to make it fuzzy
" THINGS TO CONSIDER: " - :b lets you autocomplete any open buffer
" FILE BROWSING:
" Tweaks for browsing let g:netrw_banner=0 " disable annoying banner let g:netrw_browse_split=4 " open in prior window let g:netrw_altv=1 " open splits to the right let g:netrw_liststyle=3 " tree view let g:netrw_list_hide=netrw_gitignore#Hide() let g:netrw_list_hide.=',(\s\s)\zs.\S+'
" NOW WE CAN: " - :edit a folder to open a file browser " - /v/t to open in an h-split/v-split/tab " - check netrw-browse-maps for more mappings
" MISCELLANEOUS:
" highlight matching [{()}] set showmatch
" show line numbers set number
" improve text search inside a file set incsearch set hlsearch
" code folding set foldenable set foldlevelstart=10 set foldmethod=syntax
" Have lines wrap instead of continue off-screen set linebreak
" Gives Vim access to a broader range of colours set termguicolors
" MARKDOWN SPECIFIC CONFIGURATION
" Most distributions will not have a coffee.vim in " /usshare/vim/vim$$/syntax/, in which case, you can simply download it from " here: https://github.com/duythinht/vim-coffee/blob/mastecolors/coffee.vim " It's needed to bring a better colour scheme for .md files
" Specifying fenced-in languages. let g:markdown_fenced_languages = ['javascript', 'ruby', 'sh', 'yaml', 'javascript', 'html', 'vim', 'coffee', 'json', 'diff']
augroup MarkdownHelp autocmd! " Treat all .md files as markdown autocmd BufNewFile,BufRead *.md set filetype=markdown " Spellcheck in British English autocmd FileType markdown setlocal spell spelllang=en_gb augroup END
" PYTHON SPECIFIC COMMANDS
augroup PythonLinting autocmd! " Treat all .py files as markdown autocmd BufNewFile,BufRead .py set filetype=python " Linting Python, the vanilla way autocmd FileType python setlocal makeprg=pylint " Automatic execution on :write autocmd BufWritePost *.py silent make! silent redraw! " Automatic opening of the quickfix window autocmd QuickFixCmdPost [l] cwindow augroup END
" KEY MAPPINGS " In order, " mapped , as the " mapped :q! to ,q " mapped :wq to ,wq " mapped :vertical terminal to ,t " mapped the action to open :help in a vertical tab to ,vh
" copied a command from a reddit comment to invoke the help command with an " argument, but vertically
" mapped keys to move around windows
let g:mapleader=","
cnoremap q :q! cnoremap wq :wq cnoremap t :vertical terminal cnoremap vh :vert help command! -nargs=? -complete=help Vh vert help
nnoremap h nnoremap j nnoremap k nnoremap l ```
I would like to know what you think of it, and also mistakes I've made and how to avoid them.
Please do post your own .vimrc in the comments, I'm very interested in knowing all of the cool stuff you can do without using plug-ins. Thanks a lot!
Edit: edited my .vimrc, eager for you guys to show me towards more cool no plug-in stuff! If you want to take a look at my .vimrc after I've stopped updating this post, click here
submitted by lestrenched to vim [link] [comments]


2021.05.28 04:18 Tommysw Smarter indentation

Hi! I'm having an issue configuring vim's indentation.
TL;DR: How do I make my next line use my previous line indentation?

I've been using tabs for my indentation for most of my software developer career, and a long time ago, I configured my vimrc to use tabs as indentation. It worked just as expected, taking into account the previous line indentation, when a code block started or ended, and all of that good stuff.
The problem started when I jumped to a new company, and there are projects using tabs, projects using spaces, and even projects with a mix of both.
I can't seem to find the correct way to set something as simple as 'use the previous line METHOD of indentation (it already uses the amount of indentation). Here's an example:
Before pressing o. There are 2 spaces on line 45
After pressing o. A tab was inserted as indentation at line 46.
I'm using neovim, and can upload my vimrc if needed (init.vim).
I've got autoindent on, and tried toggling on or off smartindent, without success. filetype plugin and filetype indent are both on
How can I configure mi Vim configuration to work this way?
submitted by Tommysw to vim [link] [comments]


2021.03.28 23:24 eXoRainbow Some mappings, what do you think?

I have some remaps that I want to share, plus ask for comment what you think. Maybe there is a collision I do not realize or a better way of doing. Or it is a bad idea for whatever reason I can't think of now. For the context, I use Vim mostly for programming (mainly but not exclusively Python, shell scripts and nowdays learning Rust, plus occasionally Markdown and Vimwiki) and without many plugins at all. This is not the entire file, just a few lines I cherry picked.
General mappings
" Leader key space let mapleader=" " " Make sure spacebar does not have any mapping beforehand. nnoremap    " 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 ! 
Normal mode mappings
" Toggle between search highlight on off. nnoremap  h :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  iw " Backspace from current position, especially to remove indentation. nnoremap  il " Easy to remember shortcut to reflow current paragraph. nnoremap f gwip 
Insert mode mappings
" 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. inoremap  u inoremap  u " Autocompletion of filenames in insert mode. Ctrl+d will abort. inoremap   " Complete and go in folder. inoremap   
submitted by eXoRainbow to vim [link] [comments]


2021.03.07 02:50 coffeeb4code Tab spacing and Visualization

I'm finding when I copy something from vim, and display it elsewhere, or if teammates are opening my code files in other editors. The tabbing is off. It seems inconsistent when I physically press TAB, or when the autoindent automatically adds the tabs.
I want all code indention lines, to be 1 tab, and that visually take up 2 spaces, and when it gets copied somewhere it also be 1 tab. Like so.
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.
I would prefer to remove all tabs and use actual spaces, but this is isn't possible with the style guide where I work.
submitted by coffeeb4code to vim [link] [comments]


2021.01.08 21:48 deicosaic help: copyindent fails when i install vimplug

[SOLVED]: solved by adding filetype indent off to my .vimrc
My issue is: running vim-plug ruins my indenting.
Consider me having the following .vimrc:
"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 copyindent 
I open a file called temp.c and type in the sequence:
submitted by deicosaic to vim [link] [comments]


2020.12.15 05:46 backtickbot https://np.reddit.com/r/learnprogramming/comments/kddqdi/is_vimneovim_worth_using/gfw3zew/

It's long and boring and in a private repo on github just because it's kind of a mess and I don't want people directly copying it as a result (there's a lot of embarrassing cruft in there from like a decade ago that I'm self conscious about :P) but here are some places to get started. Warning: this is going to highlight what I said about being really overwhelming!
Unclosed strings (" with no terminator) are comments in vim. Takes some getting used to.
Stuff that goes in your .vimrc or nvim equivalent:
" 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 noremap   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 
Quite a lot! Then I recommend these plugins (language-independent):
I have a ton more plugins floating around, and this doesn't even get in to language specific plugins, but this is enough to get you properly overwhelmed and you can worry about more later :P
For plugin management I just use vim's built-in package manager, but some people like plugin managers. I don't really see the point, but whatever makes people happy.
submitted by backtickbot to backtickbot [link] [comments]


2020.06.26 17:06 rishabhdeepsingh98 How do I highlight the whole searched text?

Whenever I search the character behind the cursor just shows different. I want the whole text to show different colors and the pointer to show the 3rd color. Is there any plugin I can use? ``` syntax on set tabstop=2 set shiftwidth=2 set expandtab set autoindent set smartindent set hlsearch set incsearch set ruler set history=7000 set showcmd set wildmenu set scrolloff=32 set ignorecase set smartcase set shiftround set expandtab set noswapfile set termguicolors set paste
" Having longer updatetime (default is 4000 ms = 4 s) leads to noticeable " delays and poor user experience. set updatetime=50 " Give more space for displaying messages. set cmdheight=2
" e one space, not two, after punctuation. set nojoinspaces " Numbers set number relativenumber set numberwidth=4 filetype off set nocompatible let &t_ZH="\e[3m" let &t_ZR="\e[23m" highlight Comment cterm=italic gui=italic
set rtp+=~/.vim/bundle/Vundle.vim call vundle#begin()
Plugin 'w0rp/ale' Plugin 'taglist.vim' Plugin 'fatih/vim-go' Plugin 'tpope/vim-sensible' Plugin 'airblade/vim-gitgutter' Plugin 'google/vim-searchindex' Plugin 'vim-airline/vim-airline' Plugin 'scrooloose/nerdcommenter' Plugin 'terryma/vim-multiple-cursors' Plugin 'jeffkreeftmeijevim-numbertoggle' Plugin 'roman/golden-ratio' Plugin 'scrooloose/nerdtree' Plugin 'vim-airline/vim-airline-themes' Plugin 'matchit.zip' Plugin 'junegunn/vim-easy-align' Plugin 'bash-support.vim' Plugin 'gruvbox-community/gruvbox' Plugin 'flazz/vim-colorschemes' Plugin 'junegunn/fzf' call vundle#end()
filetype plugin indent on let g:gruvbox_contrast_dark='hard' let g:gruvbox_hls_cursor='red' let g:gruvbox_italic=1 colorscheme gruvbox set background=dark ```
submitted by rishabhdeepsingh98 to vim [link] [comments]


2020.05.06 16:34 Phildos can't get vim-cpp-enhanced-highlight to work on windows w/ gvim

The plugin I'm trying to use is here: https://github.com/octol/vim-cpp-enhanced-highlight
here's my .vimrc file in its entirety:
" 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 nnoremap  :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 
If I open a .cpp file (with valid c++ syntax) it's just white-on-black text (same as any text file).
at the top I have filetype off, because that's what Vundle says is required. but if I include filetype plugin on and syntax on at the bottom of the .vimrc, I get some very minor syntax highlighting, which I assume is just default vim.
also, I have ran :PluginInstall, and it shows up as having successfully installed Vundle and vim-cpp-enhanced-hilight.
I have no idea what I'm doing wrong, and am confused why this isn't a straightforward process.
any help is appreciated! (Also, if you have tips/critiques for the rest of my .vimrc file, I'd love to hear them!)
submitted by Phildos to vim [link] [comments]


2020.04.15 16:49 kj4ohh neovim ignoring foldlevel=99?

I have neovim loading my .vimrc and I'm also using Vundle and have python syntax defined in the after directory...
When I open a python file, all foldable sections are already folded, even though I have foldlevel set to 99.
I have the space bar mapped to fold/unfold, which worked in vim. It does work to unfold in neovim but stops working after the unfold.

Here is my .vimrc / init.vim:
" 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 nnoremap   " 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 
And here is my ~/.vim/afteftplugin/python.vim:
" 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 nnoremap  za " 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 
submitted by kj4ohh to neovim [link] [comments]


2019.08.17 22:08 nicolassilva Vimrc shortcut not working

I'm trying to remap in Vim to jk, but vim is ignoring it, any ideas?
I'm using the below in my vimrc
"SHORTCUTS
let mapleader=" " "leader is the comma
"esc change - is too far :)
inoremap
inoremap jk

The complete vimrc below

ArchCarbon% cat .vimrc
"SPACING
set tabstop=4
set softtabstop=4 " number of spaces in tab when editing
set shiftwidth=4
set expandtab "tabs are spaces
set autoindent

"SHOW
set number "show line numbers
set showcmd "show command in bottom bar
filetype indent on "load filetype specific indent files
set wildmenu "visual autocomplete

"HIGHLIGHTING
set showmatch "highlight matching [{()}]
let python_highlight_all = 1
set cursorline "highlight current line
"Enable syntax processing
syntax enable

"SEARCHING
set incsearch "searc as character are entered
set hlsearch "highlight matches
"Turn off highlighting
nnoremap :nohlsearch

"MOVEMENT
"move vertically by visual line (skip fake long lines)
nnoremap j gj
nnoremap k gk
"move to Beginning/end of line (for comfort)
nnoremap B ^
nnoremap E $
"split navigation
nnoremap
nnoremap
nnoremap
nnoremap
"muscle memory
inoremap
inoremap
inoremap
inoremap
nnoremap
nnoremap
nnoremap
nnoremap

"ENABLE FOLDING
"set foldenable "enable folding
"set foldmethod=indent "fold based on indent level
"set foldlevelstart=10 "open most fold by default
"set foldnestmax=10 "10 nested fold max
"set foldlevel=99
"enable folding with the space bar
"nnoremap za

"SHORTCUTS
let mapleader=" " "leader is the comma
"esc change - is too far :)
inoremap
inoremap jk


"UTF-8 SUPPORT
set encoding=utf-8

"SYSTEM CLIPBOARD
set clipboard=unnamed
set paste

"EXECUTING
"Execute script within vim with F9
nnoremap :exec '!clear;python' shellescape(@%,1)

"COMPLETION
set completeopt=longest,menuone
"change Enter to popup menu is visible
inoremap pumvisible() ? "\" : "\u\"
"PLUGINS
call plug#begin('~/.vim/plugged')
call plug#end()
submitted by nicolassilva to vim [link] [comments]


http://swiebodzin.info