Skip to content

Instantly share code, notes, and snippets.

@laszukdawid
Last active October 30, 2022 17:50
Show Gist options
  • Save laszukdawid/059ae4c41f516e206832637e5215fe6f to your computer and use it in GitHub Desktop.
Save laszukdawid/059ae4c41f516e206832637e5215fe6f to your computer and use it in GitHub Desktop.
Vim settings
" Executing pathogen, which helps organise plugins
execute pathogen#infect()
"""""""""" PACKAGES """"""""""
set runtimepath^=~/.vim/bundle/ctrlp.vim
""""" SPELLCHECKER """""
:map <F7> :setlocal spell! spelllang=en_gb<CR>
""""""""""""""""""""
" Making sure some files are assigned properly
au BufRead,BufNewFile *.json set filetype=json
autocmd BufNewFile,BufRead *.stan set syntax=stan
autocmd Filetype javascript setlocal expandtab tabstop=2 shiftwidth=2 softtabstop=2
autocmd Filetype css setlocal expandtab tabstop=2 shiftwidth=2 softtabstop=2
autocmd Filetype html setlocal expandtab tabstop=2 shiftwidth=2 softtabstop=2
" enable syntax highlighting
syntax enable
" enable all Python syntax highlighting features
let python_highlight_all = 1
set wildmenu " visual autocompete for command menu
set lazyredraw " redraw only when we need to.
set number " show line numbers
set showcmd " shows cmd in bottom bar
set cursorline " underline current line
set showmatch " shows match for parathesis [] () {}
" highlights last inserted text
nnoremap gV `[v`]
"""""" TABS RELATED """"""
filetype plugin indent on " show existing tab with 4 spaces width
" set tabs to have 4 spaces
set tabstop=4 " number of visual spaces per TAB
set softtabstop=4 " number of spaces in tab when editing
set shiftwidth=4 " when 'indenting with '>', use 4 spaces
" indent when moving to the next line while writing code
set expandtab " tabs are spaces
set autoindent " copy indent from current line to newline
""""""""""""""""""""""""""
"""""" SEARCH """"""
set incsearch " search as characeters are entered
set hlsearch " highlight matches
" macro \<space> to :nohlsearch, which turns off highlight
nnoremap <leader><space> :nohlsearch<CR>
""""""""""""""""""""
""""" MOVEMENT """""
" follows visual lines when moving up(j)/down(k)
nnoremap j gj
nnoremap k gk
""""""""""""""""""""
nnoremap <leader>s :mksession<CR>
@laszukdawid
Copy link
Author

vim-fu

@laszukdawid
Copy link
Author

Installation requires pathogen which, as the package's readme suggest, can be installed with the command

mkdir -p ~/.vim/autoload ~/.vim/bundle && \
curl -LSso ~/.vim/autoload/pathogen.vim https://tpo.pe/pathogen.vim

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment