print load filetype from *.vim file
:set filetype?
set filetype based on filename extension, put in ~/.vimrc
augroup filetypedetect
au BufNewFile,BufRead *.yaml,*.yml set filetype=yaml
au BufRead,BufNewFile *.html.j2 *.html set filetype=html
augroup END
set filetype inside the file,put it in the begging of the file
# vi: set ft=ini : - ini file# vi: set ft=yml : - yml file# vi: set ft=python : - py file# vi: set ft=ruby : - ruby filehttps://vim.rtorr.com/
CTRL-o and then 0CTRL-o and then ^CTRL-o and then $:%s/[A-Z]/\L&/g:%s/[a-z]/\U&/gset nocompatible
filetype off
filetype plugin indent on
set ttyfast
set laststatus=2
set encoding=utf-8
set autoread
set autoindent
set backspace=indent,eol,start
set incsearch
set hlsearch
colorscheme elflord
syntax on
" Basic vim settings
set hidden
set visualbell
set number
set nobackup
set noswapfile
set showmode
" Set the terminal's title
set title
" Global tab width.
set tabstop=2
set shiftwidth=2
set softtabstop=2
set expandtab
" Set ruler
set ruler
" Set to show invisibles (tabs & trailing spaces) & their highlight color
set list listchars=tab:»\ ,trail:·
" Configure spell checking
nmap <silent> <leader>p :set spell!<CR>
set spelllang=en_us
" Set leader to comma
let mapleader = ","
" Default to magic mode when using substitution
cnoremap %s/ %s/\v
cnoremap \>s/ \>s/\v
" Capture current file path into clipboard
function! CaptureFile()
let @+ = expand('%')
endfunction
map <leader>f :call CaptureFile()<cr>
" Rename current file
function! RenameFile()
let old_name = expand('%')
let new_name = input('New file name: ', expand('%'))
if new_name != '' && new_name != old_name
exec ':saveas ' . new_name
exec ':silent !rm ' . old_name
redraw!
endif
endfunction
map <leader>n :call RenameFile()<cr>
" Strip whitespace on save
fun! <SID>StripTrailingWhitespaces()
" Preparation: save last search, and cursor position.
let _s=@/
let l = line(".")
let c = col(".")
" Do the business:
%s/\s\+$//e
" Clean up: restore previous search history, and cursor position
let @/=_s
call cursor(l, c)
endfun
command -nargs=0 Stripwhitespace :call <SID>StripTrailingWhitespaces()
" Fix indentation in file
map <leader>i mmgg=G`m<CR>
" Toggle highlighting of search results
nnoremap <leader><space> :nohlsearch<cr>
" Unsmart Quotes
nnoremap guq :%s/\v[“”]/"/g<cr>
if has("autocmd")
" StripTrailingWhitespaces
autocmd BufWritePre * Stripwhitespace
" To spell check all git commit messages
au BufNewFile,BufRead COMMIT_EDITMSG set spell nonumber nolist wrap linebreak
" Set filetype tab settings
autocmd FileType python,doctest set ai ts=4 sw=4 sts=4 et
autocmd BufReadPost *
\ if line("'\"") > 1 && line("'\"") <= line("$") |
\ exe "normal! g`\"" |
\ endif
endif
" ale
" Put these lines at the very end of your vimrc file.
" Load all plugins now.
" Plugins need to be added to runtimepath before helptags can be generated.
packloadall
" Load all of the helptags now, after plugins have been loaded.
" All messages and errors will be ignored.
silent! helptags ALL
execute pathogen#infect()
let g:ale_sign_error = '✘'
let g:ale_sign_warning = '⚠'
highlight ALEErrorSign ctermbg=NONE ctermfg=red
highlight ALEWarningSign ctermbg=NONE ctermfg=yellow