" setup cursor shape to block in diff modefunction!CursorShapeInDiffMode()if&diffif $TERM_PROGRAM =~"iTerm" let &t_SI ="\<Esc>]50;CursorShape=1\x7" let &t_SR ="\<Esc>]50;CursorShape=2\x7" let &t_EI ="\<Esc>]50;CursorShape=2\x7"else let &t_SI ="\e[1 q" let &t_SR ="\e[2 q" let &t_EI ="\e[2 q"endifendifendfunctionautocmd BufRead,BufEnter,BufNewFile * :call CursorShapeInDiffMode()
" go back to insert mode when entering the terminal windowautocmd BufEnter * if &buftype == 'terminal' | :startinsert | endiffunction! NeovimTermOpen() :split :terminal :startinsertendfunctioncabbrev ter call NeovimTermOpen()
or and use: for f in GetFiletypes() | echo f | endfor
function!GetFiletypes() " Get a list of all the runtime directories by taking the value of that " option and splitting it using a comma as the separator. let rtps =split(&runtimepath, ",") " This will be the list of filetypes that the function returns let filetypes = [] " Loop through each individual item in the list of runtime pathsforrtpin rtps let syntax_dir =rtp . "/syntax" " Check to see if there is a syntax directory in this runtimepath.if (isdirectory(syntax_dir)) " Loop through each vimscript file in the syntax directoryfor syntax_file insplit(glob(syntax_dir . "/*.vim"), "\n") " Add this file to the filetypes list with its everything " except its name removed. call add(filetypes, fnamemodify(syntax_file, ":t:r"))endforendifendfor " This removes any duplicates and returns the resulting list. " NOTE: This might not be the best way to do this, suggestions are welcome.returnuniq(sort(filetypes))endfunction
- [Vim documentation: pattern](http://vimdoc.sourceforge.net/htmldoc/pattern.html#/%5Cr) : - `\n` matches an end of line (newline) - `\r` matches a carriage return (more precisely it’s treated as the input `CR`))
# last line$vim+/path/to/file# specific line$vim+123/path/to/file" or https://til.hashrocket.com/posts/joyovn3pau-go-to-file-with-line-number$ vim /path/to/file:123
set iskeyword-=_
nnoremap <leader>e :set iskeyword-=_<cr>diw:set iskeyword+=_<cr>i
run vim commands in terminal
[!NOTE|label:manual:]
$ man vim
...
OPTIONS
+{command}
-c {command}
{command} will be executed after the first file has been read. {command} is interpreted
as an Ex command. If the {command} contains spaces it must be enclosed in double quotes
(this depends on the shell that is used). Example: Vim "+set si" main.c
Note: You can use up to 10 "+" or "-c" commands.
--cmd {command}
Like using "-c", but the command is executed just before processing any vimrc file. You
can use up to 10 of these commands, independently from "-c" commands.
" DrChip's additional man.vim stuff
syn match manSectionHeading "^\s\+[0-9]\+\.[0-9.]*\s\+[A-Z].*$" contains=manSectionNumber
syn match manSectionNumber "^\s\+[0-9]\+\.[0-9]*" contained
syn region manDQString start='[^a-zA-Z"]"[^", )]'lc=1 end='"' contains=manSQString
syn region manSQString start="[ \t]'[^', )]"lc=1 end="'"
syn region manSQString start="^'[^', )]"lc=1 end="'"
syn region manBQString start="[^a-zA-Z`]`[^`, )]"lc=1 end="[`']"
syn region manBQSQString start="``[^),']" end="''"
syn match manBulletZone transparent "^\s\+o\s" contains=manBullet
syn case match
syn keyword manBullet contained o
syn match manBullet contained "\[+*]"
syn match manSubSectionStart "^\*" skipwhite nextgroup=manSubSection
syn match manSubSection ".*$" contained
hi link manSectionNumber Number
hi link manDQString String
hi link manSQString String
hi link manBQString String
hi link manBQSQString String
hi link manBullet Special
hi manSubSectionStart term=NONE cterm=NONE gui=NONE ctermfg=black ctermbg=black guifg=navyblue guibg=navyblue
hi manSubSection term=underline cterm=underline gui=underline ctermfg=green guifg=green
:redir @a | silent digraph | redir END | new +setl\ buftype=nofile\ bufhidden=wipe | put! a
: or
:redir @a | silent digraph | redir END | new +setl\ buftype=nofile\ bufhidden=wipe | put! a | on
if has('statusline')
set laststatus=2
set statusline=%#User2#%m%r%*\ %F\ %y,%{&fileformat}
" set statusline+=\ %{FugitiveStatusline()} " set statusline+=\ %{fugitive#statusline()}
set statusline+=%=\ %-{strftime(\"%H:%M\ %d/%m/%Y\")}\ %b[A],0x%B\ %c%V,%l/%L\ %1*--%n%%--%*\ %p%%\ |
endif