From b20dd790c25479a31809c5a1b9355f792bb0262b Mon Sep 17 00:00:00 2001 From: Mohit Agarwal Date: Tue, 29 Oct 2024 22:27:51 +0000 Subject: Initial commit. --- init.vim | 151 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 151 insertions(+) create mode 100755 init.vim diff --git a/init.vim b/init.vim new file mode 100755 index 0000000..bd5ad71 --- /dev/null +++ b/init.vim @@ -0,0 +1,151 @@ +" Return to last edit position when opening files (You want this!) +autocmd BufReadPost * + \ if line("'\"") > 0 && line("'\"") <= line("$") | + \ exe "normal! g`\"" | + \ endif + +if expand('%:t') =~ '*ms' + set filetype=nroff +endif + +" Enable filetype plugins +filetype plugin on +filetype indent on + +" Set to auto read when a file is changed from the outside +set autoread +au FocusGained,BufEnter * checktime + + +"Always show current position +set ruler + +" Height of the command bar +set cmdheight=1 + +" Enable mouse + +set mouse=nv + +" Configure backspace so it acts as it should act +set backspace=eol,start,indent +set whichwrap+=<,>,h,l + +" Ignore case when searching +set ignorecase + +" When searching try to be smart about cases +set smartcase + +" Highlight search results +set hlsearch + +" Makes search act like search in modern browsers +set incsearch + +" Don't redraw while executing macros (good performance config) +set lazyredraw + +" For regular expressions turn magic on +set magic + +" Show matching brackets when text indicator is over them +set showmatch +" How many tenths of a second to blink when matching brackets +set mat=2 + + +" Enable syntax highlighting +syntax enable + + +" Set utf8 as standard encoding and en_US as the standard language +set encoding=utf8 + +" Use Unix as the standard file type +set ffs=unix,dos,mac + + +" Turn backup off, since most stuff is in SVN, git etc. anyway... +set nobackup +set nowb +set noswapfile + + +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" => Text, tab and indent related +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" Use spaces instead of tabs +set expandtab + +" Be smart when using tabs ;) +set smarttab + +" 1 tab == 4 spaces +set shiftwidth=4 +set tabstop=4 + +" Linebreak on 75 characters +set lbr +set tw=75 + +" linebreak at 70 characters in a tex file of ms file +" +autocmd FileType plaintex set filetype=tex + +autocmd FileType tex set textwidth=70 +autocmd FileType nroff set textwidth=70 +autocmd FileType markdown set textwidth=70 + +au BufRead /tmp/mutt-* set textwidth=70 +au BufRead /tmp/mutt-* set formatoptions+=a + + +"if expand('%:t') == 'paper.tex' +" set formatoptions+=a +" set textwidth=70 +" set filetype=tex +" autocmd BufWritePost * silent! execute "!./compile.sh&" +"endif + +if expand('%:t') == 'paper.md' || expand('%:t') == 'paper.ms' + "set fo+=a + "autocmd BufWritePost * silent! execute "!./compile.sh&" +endif + + +map q :wqa +map m :w\|!make +map n :w\|!make > /dev/null& +map r :w\|!make read + +set ai "Auto indent +set si "Smart indent +set wrap "Wrap lines +set spelllang=en_gb + +" Disable highlight when is pressed +map :noh + +" Remap VIM 0 to first non-blank character +" map 0 ^ + +map ss :setlocal spell! +map nn :set relativenumber! number! + +autocmd FileType bib map ar A@article{,title = "",author = "",year = "",journal = "",url = ""}kkkkkkkwwa +autocmd FileType bib map mi A@misc{,title = {{}},author = "",year = "",note = "\url{}"}kkkkkkwwa + +autocmd FileType tex map it a\textit{}i +autocmd FileType tex map bf a\textbf{}i + +" marker at 70th character +set colorcolumn=71 + +set relativenumber +set number + +set cursorline +set modeline + +colorscheme vim -- cgit v1.2.3