From 4ead9be4468d8d58c027bf6e6616e3b4d6e727eb Mon Sep 17 00:00:00 2001 From: Miquel Sabaté Solà Date: Thu, 22 Aug 2019 18:30:24 +0200 Subject: Complete re-structuring so it's easier to install MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Miquel Sabaté Solà --- .vimrc | 171 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 171 insertions(+) create mode 100644 .vimrc (limited to '.vimrc') diff --git a/.vimrc b/.vimrc new file mode 100644 index 0000000..18c6b4e --- /dev/null +++ b/.vimrc @@ -0,0 +1,171 @@ +"" +" Basics + +filetype on +syntax on +set encoding=utf-8 + +"" +" Global stuff + +" Show matched result. +set showmatch + +" Don't show the current command in the lower right corner. +set showcmd + +" Show numbers. +set number +set relativenumber + +" Don't show the mode, since this will be shown by the status line. +set noshowmode + +" Make sure that unsaved buffers that are to be put in the background are +" allowed to go in there (ie. the "must save first" error doesn't come up) +set hidden + +" Allow backspacing over everything in insert mode +set backspace=indent,eol,start + +" Don't wrap lines +set nowrap + +" I don't like the backup and the swapfile thingies. +set nobackup +set noswapfile + +" Use always the clipboard. +" NOTE: this only works if you have vim with clipboard support. You can check +" this by calling vim --version and see if you have +clipboard. +set clipboard=unnamed + +" Paste toggle +set pastetoggle= + +"" +" Colorscheme + +set background=dark +colorscheme xoria256 + +"" +" Setup the cursor for Konsole. +" NOTE: change this if you're not using Konsole or a program that makes use +" of the Konsole part. See +" http://vim.wikia.com/wiki/Change_cursor_shape_in_different_modes + +let &t_SI = "\]50;CursorShape=1\x7" +let &t_EI = "\]50;CursorShape=0\x7" + +"" +" Status line + +" Returns the mode we are currently. +function! Mode() + redraw + let l:mode = mode() + + if mode ==# "n" | return "NORMAL" + elseif mode ==# "i" | return "INSERT" + elseif mode ==# "R" | return "REPLACE" + elseif mode ==# "v" | return "VISUAL" + elseif mode ==# "V" | return "VISUAL-LINE" + elseif mode ==# "s" | return "SELECT" + elseif mode ==# "" | return "VISUAL-BLOCK" + else | return l:mode + endif +endfunc + +" My own status line. +set stl=\ %{Mode()}\ \|\ %f\ %m\ %r\ %=\ Line:\ %l\ Column:\ %v\ Buf:#%n + +" Always show the status line. +set laststatus=2 + +"" +" Searching stuff. + +" Ignore the case on search by default. +set ignorecase + +" Case sensitive if we start the search by an uppercase letter. +set smartcase + +" Find as you type search. +set incsearch + +"" +" Tabs, Indentation + +set textwidth=79 +set tabstop=2 +set shiftwidth=2 +set cindent +set autoindent +set smarttab +set expandtab +set backspace=indent,eol,start + +"" +" Plugins. + +filetype off +filetype indent plugin off + +" All the plugins are listed in my bundles file, that will be installed +" inside the ~/.vim directory. +source ~/.vim/bundles.vim + +" Enable plugins again. +filetype indent plugin on + +"" +" Everything regarding filetypes: indentation rules, gofmt & friends. + +source ~/.vim/autocmd.vim + +"" +" Re-mappings + +let g:mapleader = "," + +" Make window navigation easier. +nnoremap j +nnoremap k +nnoremap h +nnoremap l +nnoremap c :close +nnoremap v :vs +nnoremap V :vs + +" in normal/insert mode: switch to normal mode and write to disk. +inoremap :w +nnoremap :w + +" is the same as @q (I use q to store macros). +nnoremap @q + +" Pressing ^ in order to move to the first non-blank character is inconvenient. +nnoremap , ^ + +" The default behavior for is simply useless: why would I want to stop +" the current `vim` process ? (especially shitty if you miss useful commands +" like ...). +" +" Before I was remapping this to , but since switching to Emacs, I've +" started to use as escape there in order to not overlap with an +" extremely used prefix. For consistency's sake, I'm also applying this to Vim. +nnoremap +inoremap + +" Do nothing for the command. I never use it and it appears when I +" misstype . +nnoremap K + +" Do nothing for . I don't use this feature and it confuses me whenever I +" misstype (CtrlP plugin). +nnoremap + +" Set paste temporarily to just paste what we have on the registry. +nnoremap p :set pastep:set nopaste -- cgit v1.2.3