I have these lines or underscores I am trying to remove on vim text editor:
The horizontal lines disappear when there is some text or code on a line.
Please let me know if you came across this before! Thanks.
Here is my .vimrc:
call plug#begin('~/.vim/plugged')
" The default plugin directory will be as follows:
" - Vim (Linux/macOS): '~/.vim/plugged'
" - Vim (Windows): '~/vimfiles/plugged'
" - Neovim (Linux/macOS/Windows): stdpath('data') . '/plugged'
" You can specify a custom plugin directory by passing it as the argument
" - e.g. `call plug#begin('~/.vim/plugged')`
" - Avoid using standard Vim directory names like 'plugin'
" Make sure you use single quotes
Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'}
" Shorthand notation; fetches https://github.com/junegunn/vim-easy-align
Plug 'junegunn/vim-easy-align'
" Any valid git URL is allowed
Plug 'https://github.com/junegunn/vim-github-dashboard.git'
" Multiple Plug commands can be written in a single line using | separators
Plug 'SirVer/ultisnips' | Plug 'honza/vim-snippets'
" On-demand loading
Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' }
Plug 'tpope/vim-fireplace', { 'for': 'clojure' }
" Using a non-default branch
Plug 'rdnetto/YCM-Generator', { 'branch': 'stable' }
" Using a tagged release; wildcard allowed (requires git 1.9.2 or above)
Plug 'fatih/vim-go', { 'tag': '*' }
" Plugin options
Plug 'nsf/gocode', { 'tag': 'v.20150303', 'rtp': 'vim' }
" Plugin outside ~/.vim/plugged with post-update hook
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
" Unmanaged plugin (manually installed and updated)
Plug '~/my-prototype-plugin'
" Initialize plugin system
" - Automatically executes `filetype plugin indent on` and `syntax enable`.
call plug#end()
" You can revert the settings after the call like so:
" filetype indent off " Disable file-type-specific indentation
" syntax off " Disable syntax highlighting
Plug 'crispybaccoon/dawn.vim'
set background=dark
colorscheme dawn
" Access full color space
if (has("termguicolors"))
set termguicolors
endif
" sometimes fixes problems on some terminals
set t_Co=256
" Disable compatibility with vi which can cause unexpected issues.
set nocompatible
" Enable type file detection. Vim will be able to try to detect the type of file in use.
filetype on
" Enable plugins and load plugin for the detected file type.
filetype plugin on
" Load an indent file for the detected file type.
filetype indent on
" Turn syntax highlighting on.
syntax on
" Add numbers to each line on the left-hand side.
set number
" Highlight cursor line underneath the cursor horizontally.
"set cursorline
" Highlight cursor line underneath the cursor vertically.
"set cursorcolumn
" Set shift width to 4 spaces.
set shiftwidth=4
" Set tab width to 4 columns.
set tabstop=4
" Use space characters instead of tabs.
set expandtab
" Do not save backup files.
set nobackup
" Do not let cursor scroll below or above N number of lines when scrolling.
set scrolloff=10
" Do not wrap lines. Allow long lines to extend as far as the line goes.
set nowrap
" While searching though a file incrementally highlight matching characters as you type.
set incsearch
" Ignore capital letters during search.
set ignorecase
" Override the ignorecase option if searching for capital letters.
" This will allow you to search specifically for capital letters.
set smartcase
" Show partial command you type in the last line of the screen.
set showcmd
" Show the mode you are on the last line.
set showmode
" Show matching words during a search.
set showmatch
" Use highlighting when doing a search.
set hlsearch
" Set the commands to save in history default number is 20.
set history=1000
" Enable auto completion menu after pressing TAB.
set wildmenu
" Make wildmenu behave like similar to Bash completion.
set wildmode=list:longest
" There are certain files that we would never want to edit with Vim.
" Wildmenu will ignore files with these extensions.
set wildignore=*.docx,*.jpg,*.png,*.gif,*.pdf,*.pyc,*.exe,*.flv,*.img,*.xlsx
I have been trying to customize my vim text editor. I also have tried to install plugins for different themes. I tried using tree-sitter as well but that is not really working for me right now.
seems like the line
colorscheme dawn
was the one causing this issue.
i have contacted the theme creator and posted the issue on the github repository that i got it from. thanks guys!
Related
No idea how I've just broken my vimrc, but I have. I have solarized installed, but syntax highlighting is no longer working automatically - I have to retype "syntax enable" every time I open the editor.
My vimrc is below - any help much appreciated!
" ----- BASICS -----
set nocompatible "compatible with vi
if !exists("g:syntax_on")
syntax enable
endif
filetype on "QS not sure about this one !
set number "add line numbers
set showcmd "show command in bottom bar
set cursorline "highlight cursor line
set wildmenu "commandline tab completion
set mouse=a "make vim useable with mouse
set backspace=indent,eol,start " make backspace work like in most editors.
set showmatch " highlight matching [{()}]
" ----- COLORSCHEME -----
let g:solarized_termcolors = 256
set background=light
colorscheme solarized
" ------ NAVIGATION -----
" long line navigation in normal mode
nnoremap j gj
nnoremap k gk
" ------ TABS & SPACES -----
set tabstop=4 "number of visual spaces per TAB
set shiftwidth=4 "size of indent with tab
set softtabstop=0
set noexpandtab "if you are using tab character inside your source
"code - these are defensive settings to avoid conversion
" ---------Searching ----------
set incsearch " search as characters are entered
set hlsearch " highlight matches
" ----------Folding -----------
set foldenable " enable folding
set foldlevelstart=10 " open most folds by default
set foldnestmax=10 " 10 nested fold max
nnoremap <space> za
"space open/closes folds
set foldmethod=indent " fold based on indent level
set smartindent " indents your code automatically
filetype off " required
The last line in your ~/.vimrc disables filetype detection. Without that, Vim treats every opened file as plain text, and therefore does not load any syntax plugin. Drop that line, it doesn't make sense.
filetype off " required
In order to benefit from the built-in filetype and indent plugins, rather turn on everything:
filetype plugin indent on
See :help :filetype for further details.
When I edit html, I have highlights like this picture
I don't want it highlighted. FYI this is my .vimrc
set nocompatible " be iMproved, required
filetype off " required
set rtp+=~/.vim/bundle/vundle/ " set the runtime path to include Vundle and initialize
call vundle#rc()
" Bundle 'gmarik/vundle' " let Vundle manage Vundle, required
Bundle "wookiehangover/jshint.vim"
Bundle "mru.vim"
Bundle 'godlygeek/tabular'
Bundle 'plasticboy/vim-markdown'
filetype plugin indent on " required
syntax on " Enable syntax highlighting
set wildmenu " Better command-line completion
set showcmd " Show partial commands in the last line of the screen
set hlsearch
set autoindent
set shiftwidth=2
set softtabstop=2
set expandtab " Allow backspacing over autoindent, line breaks and start of insert action
set ignorecase " for case insensitive search
set smartcase " except when using capital letters
set backup
set backupdir=~/.vim/backup
set directory=~/.vim/tmp
set splitright " when vertically split, open new window on the right(default, left)
set splitbelow " when horizontally split, open new window on the bottom(default, top)
" Keyboard Mapping
nnoremap <Leader>b :MRU<CR> " \b to see the most recent used files
" = to run tidy on html
au FileType html setlocal equalprg=tidy\ -q\ -i\ --show-errors\ 0\ --tab-size\ 4\ --wrap\ 200\ --indent-spaces\ 4
" for markdown plugin
let g:vim_markdown_folding_disabled=1
let g:vim_markdown_no_default_key_mappings=1
EDIT ----
I love this SO community.
I followed all comments and answers, and found out the following soultion;
changed <i/> to <i></i>
syntax off
syntax on
It might be because of the <i/> tag... your syntax highlighting might not recognize that you self-closed it.
Otherwise you might have the 'list' option set (it's not in your vimrc, but a plugin might have added it)... If some of your code is indented with tabs and other parts spaces, then if 'list' is set then it will highlight just the tabs, for example.
Try doing :set nolist and see if the highlighted areas go away. You can remove stray tabs or spaces (depending on your expandtab setting) by doing :retab.
The visual result of :set list depends on your colorscheme and your setting for listchars. For example, I have set listchars=tab:▸\ ,eol:¬ in my .vimrc at home. See :help 'listchars' for more information.
If you want to still have some visual distinction between leading tabs and spaces, you can modify your colorscheme. This is a bit more involved. From the Vim help:
The "NonText" highlighting will be used for "eol", "extends" and
"precedes". "SpecialKey" for "nbsp", "tab" and "trail".
To change the visual appearance of these syntax groups, add your own :highlight commands in your .vimrc or edit a colorscheme file.
In VIM I've, all my tabs are 2 spaces. But when I push to github, they get converted to 4 spaces. Can anyone help me figure out how to prevent them from getting converted to 4 spaces?
My vimrc file:
call pathogen#infect()
call pathogen#runtime_append_all_bundles()
" search
set hlsearch " highlight the search
set incsearch " incremental search
set ignorecase " search ignoring case
set showmatch " show matching bracket
" colors
set background=dark
let g:solarized_termcolors=8 " proper solarized coloring
colorscheme peachpuff
" syntax
syntax on
filetype on " Enable filetype detection
filetype plugin on " Enable filetype-specific plugins
filetype indent on " Enable filetype-specific indenting
set ruler " show the line number on the bar
set more " use more prompt
set autoread " watch for file changes
set number " line numbers
set hidden
set noautowrite " don't write old file out when switching files
set lazyredraw " don't redraw when don't have to
set showmode
set showcmd
set nocompatible " vim, not vi
set autoindent smartindent " auto/smart indent
set smarttab " tab and backspace are smart
set tabstop=2 " 6 spaces
set shiftwidth=2
set scrolloff=5 " keep at least 5 lines above/below
set sidescrolloff=5 " keep at least 5 lines left/right
set history=200
set backspace=indent,eol,start
set linebreak
set cmdheight=2 " command line two lines high
set undolevels=1000 " 1000 undos
set updatecount=100 " switch every 100 chars
set complete=.,w,b,u,U,t,i,d " do lots of scanning on tab completion
set ttyfast " we have a fast terminal
set noerrorbells " No error bells please
set shell=bash
set fileformats=unix
set ff=unix
set wildmode=longest:full
set wildmenu " menu has tab completion
set laststatus=2
set diffopt=filler,iwhite " ignore all whitespace and sync
" scss formatting
autocmd BufRead,BufNewFile *.scss ""set ft=scss.css
" jade formatting
autocmd BufRead,BufNewFile *.jade setlocal ft=jade noexpandtab
autocmd FileType jade :setlocal sw=2 ts=2 sts=2
autocmd VimEnter * NERDTree
autocmd VimEnter * wincmd p
autocmd Filetype javascript setlocal ts=2 sw=2 sts=0 noexpandtab
The standard representation of a tab character is 8 spaces. In reality, the tab is a control character and as such doesn't have an associated glyphs or a set width. This allows most programs to offer a way to modify how it is displayed but no program ever change its width because it doesn't have one to start with: a tab is still a tab, no matter the value of tabstop.
Your Vim settings only alter how tabs are displayed in Vim: they have no bearings on how they are displayed outside of Vim.
You have two solutions:
set GitHub and Vim to use the same tab width
use spaces
Since we are at it…
set background=dark
let g:solarized_termcolors=8 " proper solarized coloring
colorscheme peachpuff
You can delete the solarized line if you don't use it and set background is useless because your colorscheme takes care of that.
set noautowrite
is also useless because autowrite is off by default.
And
call pathogen#runtime_append_all_bundles()
serves no purpose whatsoever.
I would recommend reading this on how to change tabsize for Github
There appears to be a browser extension called Stylish that changes tabs in Github by downloading the style "Better sized tabs in code"
Download the browser extension and use the style and change the tab spacing to two space tabs.
Hope this helped!
I am fairly new to vim and trying to get syntax highlighting in place. i made and edited my vimrc file and when i look at that file it is colored. But when i go to my python files they have no highlighting. Any help would be great!
L: http://vim.wikia.com/wiki/Example_vimrc
" Authors: http://vim.wikia.com/wiki/Vim_on_Freenode
" Description: A minimal, but feature rich, example .vimrc. If you are a
" newbie, basing your first .vimrc on this file is a good choice.
" If you're a more advanced user, building your own .vimrc based
" on this file is still a good idea.
"------------------------------------------------------------
" Features {{{1
"
" These options and commands enable some very useful features in Vim, that
" no user should have to live without.
" Set 'nocompatible' to ward off unexpected things that your distro might
" have made, as well as sanely reset options when re-sourcing .vimrc
set nocompatible
" Attempt to determine the type of a file based on its name and possibly its
" contents. Use this to allow intelligent auto-indenting for each filetype,
" and for plugins that are filetype specific.
filetype indent plugin on
" Enable syntax highlighting
syntax on
"------------------------------------------------------------
" Must have options {{{1
"
" These are highly recommended options.
" Vim with default settings does not allow easy switching between multiple files
" in the same editor window. Users can use multiple split windows or multiple
" tab pages to edit multiple files, but it is still best to enable an option to
" allow easier switching between files.
"
" One such option is the 'hidden' option, which allows you to re-use the same
" window and switch from an unsaved buffer without saving it first. Also allows
" you to keep an undo history for multiple files when re-using the same window
" in this way. Note that using persistent undo also lets you undo in multiple
" files even in the same window, but is less efficient and is actually designed
" for keeping undo history after closing Vim entirely. Vim will complain if you
" try to quit without saving, and swap files will keep you safe if your computer
" crashes.
set hidden
" Note that not everyone likes working this way (with the hidden option).
" Alternatives include using tabs or split windows instead of re-using the same
" window as mentioned above, and/or either of the following options:
" set confirm
" set autowriteall
" Better command-line completion
set wildmenu
" Show partial commands in the last line of the screen
set showcmd
" Highlight searches (use <C-L> to temporarily turn off highlighting; see the
" mapping of <C-L> below)
set hlsearch
" Modelines have historically been a source of security vulnerabilities. As
" such, it may be a good idea to disable them and use the securemodelines
" script, <http://www.vim.org/scripts/script.php?script_id=1876>.
" set nomodeline
"------------------------------------------------------------
" Usability options {{{1
"
" These are options that users frequently set in their .vimrc. Some of them
" change Vim's behaviour in ways which deviate from the true Vi way, but
" which are considered to add usability. Which, if any, of these options to
" use is very much a personal preference, but they are harmless.
" Use case insensitive search, except when using capital letters
set ignorecase
set smartcase
" Allow backspacing over autoindent, line breaks and start of insert action
set backspace=indent,eol,start
" When opening a new line and no filetype-specific indenting is enabled, keep
" the same indent as the line you're currently on. Useful for READMEs, etc.
set autoindent
" Stop certain movements from always going to the first character of a line.
" While this behaviour deviates from that of Vi, it does what most users
" coming from other editors would expect.
set nostartofline
" Display the cursor position on the last line of the screen or in the status
" line of a window
set ruler
" Always display the status line, even if only one window is displayed
set laststatus=2
" Instead of failing a command because of unsaved changes, instead raise a
" dialogue asking if you wish to save changed files.
set confirm
" Use visual bell instead of beeping when doing something wrong
set visualbell
" And reset the terminal code for the visual bell. If visualbell is set, and
" this line is also included, vim will neither flash nor beep. If visualbell
" is unset, this does nothing.
set t_vb=
" Enable use of the mouse for all modes
set mouse=a
" Set the command window height to 2 lines, to avoid many cases of having to
" "press <Enter> to continue"
set cmdheight=2
" Display line numbers on the left
set number
" Quickly time out on keycodes, but never time out on mappings
set notimeout ttimeout ttimeoutlen=200
" Use <F11> to toggle between 'paste' and 'nopaste'
set pastetoggle=<F11>
"------------------------------------------------------------
" Indentation options {{{1
"
" Indentation settings according to personal preference.
" Indentation settings for using 2 spaces instead of tabs.
" Do not change 'tabstop' from its default value of 8 with this setup.
set shiftwidth=2
set softtabstop=2
set expandtab
" Indentation settings for using hard tabs for indent. Display tabs as
" two characters wide.
"set shiftwidth=2
"set tabstop=2
"------------------------------------------------------------
" Mappings {{{1
"
" Useful mappings
" Map Y to act like D and C, i.e. to yank until EOL, rather than act as yy,
" which is the default
map Y y$
" Map <C-L> (redraw screen) to also turn off search highlighting until the
" next search
nnoremap <C-L> :nohl<CR><C-L>
"------------------------------------------------------------
File in in location of :
/home/pi
Solved, using sudo to launch vim and was referencing the from vimrc
How do the sections of code in the _vimrc file interact with each other?
My current file looks like the following but I'm wondering if it matters if a line such as filetype plugin indent on is at the start or the end of this file?
Does it matter if a line like filetype plugin indent on is repeated twice in the file?
Should the Pathogen settings be near the start?
"------------------------------------------------------------
" Must have options {{{1
"this will make the window maximized on startup
au GUIEnter * simalt ~x
" Attempt to determine the type of a file based on its name and possibly its
" contents. Use this to allow intelligent auto-indenting for each filetype,
" and for plugins that are filetype specific.
filetype indent plugin on
set omnifunc=syntaxcomplete#Complete
" Enable syntax highlighting
syntax on
"set highlight search always on
:set hlsearch
"------------------------------------------------------------
" Usability options {{{1
" Show partial commands in the last line of the screen
set showcmd
" Use case insensitive search, except when using capital letters
set ignorecase
set smartcase
" Allow backspacing over autoindent, line breaks and start of insert action
set backspace=indent,eol,start
" When opening a new line and no filetype-specific indenting is enabled, keep
" the same indent as the line you're currently on. Useful for READMEs, etc.
set autoindent
" Stop certain movements from always going to the first character of a line.
" While this behaviour deviates from that of Vi, it does what most users
" coming from other editors would expect.
set nostartofline
" Display the cursor position on the last line of the screen or in the status
" line of a window
set ruler
" Always display the status line, even if only one window is displayed
set laststatus=2
" Instead of failing a command because of unsaved changes, instead raise a
" dialogue asking if you wish to save changed files.
set confirm
" Use visual bell instead of beeping when doing something wrong
set visualbell
" And reset the terminal code for the visual bell. If visualbell is set, and
" this line is also included, vim will neither flash nor beep. If visualbell
" is unset, this does nothing.
set t_vb=
" Enable use of the mouse for all modes
set mouse=a
" Set the command window height to 2 lines, to avoid many cases of having to
" "press <Enter> to continue"
set cmdheight=2
" Display line numbers on the left
set number
" Quickly time out on keycodes, but never time out on mappings
set notimeout ttimeout ttimeoutlen=200
" Use <F11> to toggle between 'paste' and 'nopaste'
set pastetoggle=<F11>
"------------------------------------------------------------
" Indentation options {{{1
"
" Indentation settings according to personal preference.
" Indentation settings for using 2 spaces instead of tabs.
" Do not change 'tabstop' from its default value of 8 with this setup.
"set shiftwidth=2
"set softtabstop=2
"set expandtab
" Indentation settings for using hard tabs for indent. Display tabs as
" two characters wide.
set shiftwidth=2
set tabstop=2
"------------------------------------------------------------
" Look and Feel {{{1
"
" Use CTRL-S for saving, also in Insert mode
:nnoremap <C-S> :<C-U>update<CR>
:vnoremap <C-S> :<C-U>update<CR>gv
:cnoremap <C-S> <C-C>:update<CR>
:inoremap <C-S> <C-O>:update<CR>
"color scheme setting
" Set nice colors
" background for normal text is light grey
" Text below the last line is darker grey
" Cursor is green, Cyan when ":lmap" mappings are active
" Constants are not underlined but have a slightly lighter background
set guifont=Consolas:h16:cANSI
colorscheme pyte
"highlight Normal guibg=grey90
"highlight Cursor guibg=Green guifg=NONE
"highlight lCursor guibg=Cyan guifg=NONE
"highlight NonText guibg=grey80
"highlight Constant gui=NONE guibg=grey95
"highlight Special gui=NONE guibg=grey95
"a quick way to locate python files
nnoremap <Leader>p :pyf P:\Computer Applications\Python\
"quick quit command
noremap <Leader>e :quit<CR> "quits the current window
"------------------------------------------------------------
" NERTtree settings {{{1
"
"get NERDTree command quick
nnoremap <Leader>nd :NERDTree M:\
map <F2> :NERDTreeToggle<CR>
let NERDTreeQuitOnOpen = 1
" Rebind <Leader> key...not sure about this one
"let mapleader = ","
map <Leader>n <esc>:tabprevious<CR>
map <Leader>m <esc>:tabnext<CR>
"------------------------------------------------------------
" dbext settings {{{1
"
"let g:sql_type_default = 'SQLSVR'
" Since I repeatedly need to edit stored procedures, the CREATE PROCEDURE
" statement is preceeded by an IF ... END IF block which will drop
" the procedure or it uses the CREATE OR REPLACE syntax.
" This function will visually select the IF block to the END; statement
" of the stored procedure and execute it. Or check for the
" CREATE OR REPLACE and stop there and look to the end.
function! SQLExecuteIfCreateReplace()
let l:old_sel = &sel
let &sel = 'inclusive'
let saveWrapScan=&wrapscan
let saveSearch=#/
let l:reg_z = #z
let &wrapscan=0
let #z = ''
let found = 0
let startLine = 0
let endLine = 0
let curLine = line(".")
let curCol = virtcol(".")
" Must default the command terminator
let l:dbext_cmd_terminator = ";"
try
" Search backwards and do NOT wrap
" Find the line beginning with an IF clause
" IF EXISTS( SELECT 1 ...
" or find an or replace clause
" CREATE OR REPLACE PROCEDURE ...
" And execute it until we find an
" END
" at the beginning of a line.
let startLine = search('\c\(^\<if\>\|^\<alter\s\+procedure\>\|\<or\s\+replace\>\)', 'bcnW' )
if startLine > 0
" Search forward and visually select all lines
" until we find an END; clause
let endLine = search('^END'.l:dbext_cmd_terminator.'\s*$', 'cnW')
exec startLine.','.endLine.'DBExecRangeSQL'
endif
finally
call cursor(curLine, curCol)
noh
let l:query = #z
let #z = l:reg_z
let #/=saveSearch
let &wrapscan=saveWrapScan
let &sel = l:old_sel
endtry
endfunction
"------------------------------------------------------------
" pathogen settings {{{1
"pathogen customization
"set nocp
" Use pathogen to easily modify the runtime path to include all plugins under
" the ~/.vim/bundle directory
filetype off " force reloading *after* pathogen loaded
call pathogen#infect()
call pathogen#helptags()
call pathogen#runtime_append_all_bundles()
syntax on
filetype plugin indent on " enable detection, plugins and indenting in one step
The order does matter.
e.g. you have two lines:
Options:
set nu
set nonu
the latter will overwrite the previous setting.
for functions, if you declared a function at the end of your file, but called it at the 1st line. When you load your vimrc the first time, you will get the error Unknown function: function name
Also if you manually set some hi group before the color scheme (if you used one) loading, the color scheme is gonna overwrite your settings too.
If you call some command/function defined in a plugin before it was loaded, you will have error message too.
so , it is ok if you have some command/setting in vimrc multiple times, but the last one will take effect.
tl;dr: Some do, some don't; use a logical structure from simple to complex.
Pathogen wants its settings to appear at the top, because it modifies the way other scripts are loaded (explicitly via :runtime, or as a side effect of calling autoload functions).
The order of :set usually doesn't matter (unless you have conflicting settings), and any mappings or autocmds you define are only activated after the startup, so you can put them anywhere.
In general, I'd recommend a logical structure, starting with basic stuff like Pathogen, settings, plugin configuration, followed by custom mappings and more involved adaptations like autocmds.
Also, I'd avoid putting filetype-specific stuff into ~/.vimrc; rather, put those into the corresponding ~/.vim/after/ftplugin/<filetype>.vim script and use filetype plugin on.