Welcome, guest! Login / Register - Why register?
Psst.. new poll here.
Psst.. new forums here.

Paste

Pasted as Vim Script by Eulenspiegel ( 6 months ago )
" vimplug (need install)
call plug#begin()
Plug 'rodjek/vim-puppet'
Plug 'rust-lang/rust.vim'
call plug#end()

" Change cursor shape based on mode
if exists('$TMUX')
  " For tmux
  let &t_SI = "\<Esc>Ptmux;\<Esc>\<Esc>]50;CursorShape=1\x7\<Esc>\\"
  let &t_SR = "\<Esc>Ptmux;\<Esc>\<Esc>]50;CursorShape=2\x7\<Esc>\\"
  let &t_EI = "\<Esc>Ptmux;\<Esc>\<Esc>]50;CursorShape=0\x7\<Esc>\\"
else
  let &t_SI = "\e[6 q"  " Insert mode - steady beam
  let &t_SR = "\e[4 q"  " Replace mode - steady underline
  let &t_EI = "\e[2 q"  " Normal mode - steady block
endif

" Make Esc work faster
set ttimeout
set ttimeoutlen=10
set timeoutlen=1000

"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => General Settings
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set nocompatible              " Use Vim settings, rather than Vi settings
filetype plugin indent on     " Enable file type detection and plugins
syntax enable                 " Enable syntax highlighting
set history=500               " Set how many lines of history Vim has to remember
set autoread                  " Auto read when a file is changed from the outside
set hidden                    " Allow buffers to exist in the background
set sj=-50                    " scroll like Emacs
set showmatch
set noshowmode
set ruler                     " Show cursor position

" Enable Truecolor support if terminal supports it
if exists('+termguicolors')
  let &t_8f = "\<Esc>[38;2;%lu;%lu;%lum"
  let &t_8b = "\<Esc>[48;2;%lu;%lu;%lum"
  set termguicolors
endif

" Use default colorscheme
set background=dark
colorscheme default

" Minimal theme - most things same as foreground like your Emacs
" Manual transparency
highlight Normal ctermbg=NONE guibg=NONE ctermfg=145 guifg=#93a1a1

" Make most syntax elements the same as foreground (minimal like righteous)
highlight Identifier ctermfg=145 guifg=#93a1a1
highlight Function ctermfg=145 guifg=#93a1a1
highlight Statement ctermfg=145 guifg=#93a1a1
highlight Conditional ctermfg=145 guifg=#93a1a1
highlight Repeat ctermfg=145 guifg=#93a1a1
highlight Label ctermfg=145 guifg=#93a1a1
highlight Operator ctermfg=145 guifg=#93a1a1
highlight Keyword ctermfg=145 guifg=#93a1a1
highlight Exception ctermfg=145 guifg=#93a1a1
highlight PreProc ctermfg=145 guifg=#93a1a1
highlight Include ctermfg=145 guifg=#93a1a1
highlight Define ctermfg=145 guifg=#93a1a1
highlight Macro ctermfg=145 guifg=#93a1a1
highlight Type ctermfg=145 guifg=#93a1a1
highlight StorageClass ctermfg=145 guifg=#93a1a1
highlight Structure ctermfg=145 guifg=#93a1a1
highlight Typedef ctermfg=145 guifg=#93a1a1
highlight Special ctermfg=145 guifg=#93a1a1
highlight SpecialChar ctermfg=145 guifg=#93a1a1
highlight Tag ctermfg=145 guifg=#93a1a1
highlight Delimiter ctermfg=145 guifg=#93a1a1
highlight SpecialComment ctermfg=145 guifg=#93a1a1
highlight Debug ctermfg=145 guifg=#93a1a1
highlight Constant ctermfg=145 guifg=#93a1a1
highlight Character ctermfg=145 guifg=#93a1a1
highlight Number ctermfg=145 guifg=#93a1a1
highlight Boolean ctermfg=145 guifg=#93a1a1
highlight Float ctermfg=145 guifg=#93a1a1

" Keep only a few elements with different colors (like your righteous theme)
highlight Comment ctermfg=239 guifg=#4e4e4e cterm=italic gui=italic
highlight String ctermfg=108 guifg=#5faf87
highlight Error ctermfg=196 guifg=#E50000 cterm=bold gui=bold
highlight MatchParen ctermfg=201 guifg=#fe1eff cterm=bold gui=bold ctermbg=NONE guibg=NONE

" No annoying sound on errors
set noerrorbells
set novisualbell
set t_vb=

"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Files, backups and undo
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set nobackup                  " No backup files
set nowb                      " No write backup
set noswapfile                " No swap file

"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Search
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set ignorecase                " Ignore case when searching
set smartcase                 " When searching be smart about cases
set hlsearch                  " Highlight search results
set incsearch                 " Search as characters are entered

"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Text, tab and indent related
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set expandtab                 " Use spaces instead of tabs
set smarttab                  " Be smart when using tabs
set shiftwidth=4              " One tab = 4 spaces
set tabstop=4                 " One tab = 4 spaces
set softtabstop=4             " Edit as if tabs are 4 spaces
set ai                        " Auto indent
set si                        " Smart indent
set wrap                      " Wrap lines
set linebreak                 " Break lines at word boundaries
set textwidth=0               " Don't automatically break lines

"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Leader key and mappings
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Set leader key to comma
let mapleader = ","

"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Filetype-specific settings
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Rust-specific settings and keybindings
autocmd FileType rust nnoremap <buffer> <leader>cc :Ccheck<CR>
autocmd FileType rust nnoremap <buffer> <leader>cb :Cbuild<CR>
autocmd FileType rust nnoremap <buffer> <leader>ct :Ctest<CR>
autocmd FileType rust nnoremap <buffer> <leader>cr :Crun<CR>
autocmd FileType rust nnoremap <buffer> <leader>cl :Cargo clippy<CR>
autocmd FileType rust nnoremap <buffer> <leader>cf :RustFmt<CR>

" Puppet-specific settings (2 spaces is standard)
autocmd FileType puppet setlocal shiftwidth=2 tabstop=2 softtabstop=2

" Install vim-plug if not found
if empty(glob('~/.vim/autoload/plug.vim'))
  silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
    \ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
endif

" Auto-install plugins on first run
autocmd VimEnter * if len(filter(values(g:plugs), '!isdirectory(v:val.dir)'))
  \| PlugInstall --sync | source $MYVIMRC
\| endif

 

Revise this Paste

Children: 129177
Your Name: Code Language: