Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- "{ Plugins
- set nocompatible " be iMproved, required
- filetype off " required (for Vundle)
- " Set the runtime path to include Vundle and inititalize
- set rtp+=$HOME/.vim/bundle/Vundle.vim
- call vundle#begin('$HOME/.vim/bundle')
- " let Vundle manage Vundle, required
- Plugin 'gmarik/Vundle.vim'
- " Git integration
- Plugin 'tpope/vim-fugitive'
- " Lean & mean status/tabline for vim that's light as air
- Plugin 'bling/vim-airline'
- " Toggle line numbering mode on focus and insert mode
- Plugin 'jeffkreeftmeijer/vim-numbertoggle'
- " File explorer
- Plugin 'scrooloose/nerdtree'
- " Git status in nerdtree
- Plugin 'Xuyuanp/nerdtree-git-plugin'
- " Be able to change/add/delete surround characters/tags
- Plugin 'tpope/vim-surround'
- " Quickly navigate
- Plugin 'easymotion/vim-easymotion'
- " Full path fuzzy file, buffer, mru, tag, ... finder for Vim
- Plugin 'kien/ctrlp.vim'
- " Syntax checker
- Plugin 'scrooloose/syntastic'
- " JSHint, javascript linter
- Plugin 'Shutnik/jshint2.vim'
- " Syntax highlighting for jade.
- Plugin 'digitaltoad/vim-jade'
- Plugin 'flazz/vim-colorschemes'
- Plugin 'Valloric/YouCompleteMe'
- " All plugins must be added before the following line
- call vundle#end()
- "}
- " { Working with files
- " Allow filetype plugins
- " Enable loading the plugin files for specific file types.
- " If filetype detection was not switched on yet, it will be as well.
- filetype plugin on
- " Enable loading the indent file for specific file types.
- filetype indent on
- " Map CtrlP
- let g:ctrlp_map = '<c-p>'
- " When invoked, unless a starting directory is specified, CtrlP will set its local working directory according to this variable
- " 'c' - the directory of the current file.
- " 'r' - the nearest ancestor that contains one of these directories or files: .git .hg .svn .bzr _darcs
- " 'a' - like c, but only if the current working directory outside of CtrlP is not a direct ancestor of the directory of the current file.
- " 0 or '' (empty string) - disable this feature.
- let g:ctrlp_working_path_mode = 'ra'
- let g:ctrlp_custom_ignore = '\v[\/](node_modules|target|dist)|(\.(swp|ico|git|svn))$'
- " Exclude files and directories using Vim's wildignore and CtrlP's own g:ctrlp_custom_ignore
- set wildignore+=*\\tmp\\*,*.swp,*.zip,*.exe
- " When a file has been detected to have been changed outside of Vim and
- " it has not been changed inside of Vim, automatically read it again.
- " When the file has been deleted this is not done.
- set autoread
- " When this option is set, the syntax with this name is loaded.
- syntax enable
- " Sets the character encoding used inside Vim. It applies to text in
- " the buffers, registers, Strings in expressions, text stored in the
- " viminfo file, etc. It sets the kind of characters which Vim can work
- " with. See |encoding-names| for the possible values.
- set encoding=utf8
- " Set button to toggle line numbering. The plugin doesn't set the hotkey
- " correctly when the user sets NumberToggleTrigger, but will take over
- " <C-n> if it isn't set. So I set it to the key I want, then do the same
- " mapping it would have done myself. This makes it not eat <C-n> due to
- " no user mapping, and gets the mapping correctly.
- let g:NumberToggleTrigger = '<C-Right>'
- nnoremap <silent> <C-Right> :call NumberToggle()<cr>
- " Toggle NERDTree
- map <c-n> :NERDTreeToggle<CR>
- "Close vim if the only window left open is NERDTree
- autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTreeType") && b:NERDTreeType == "primary") | q | endif
- " Use this option to tell the script when (if at all) to change the current
- " working directory (CWD) for vim.
- " If it is set to 0 then the CWD is never changed by the NERD tree.
- " If set to 1 then the CWD is changed when the NERD tree is first loaded to the
- " directory it is initialized in. For example, if you start the NERD tree with >
- " :NERDTree /home/marty/foobar
- " <
- " then the CWD will be changed to /home/marty/foobar and will not be changed
- " again unless you init another NERD tree with a similar command.
- " If the option is set to 2 then it behaves the same as if set to 1 except that
- " the CWD is changed whenever the tree root is changed. For example, if the CWD
- " is /home/marty/foobar and you make the node for /home/marty/foobar/baz the new
- " root then the CWD will become /home/marty/foobar/baz.
- let g:NERDTreeChDirMode = 2
- " Make Ctrl-\ switch to the last open file.
- map <c-\> :b#<CR>
- " Faster way to save.
- map <leader>w :w<CR>
- "}
- " { Visual
- if has("gui_running")
- set guioptions-=m " remove menu bar
- set guioptions-=T "remove toolbar
- set guioptions-=r "remove right-hand scroll bar
- set guioptions-=L "remove left-hand scroll bar
- endif
- " When set to "dark", Vim will try to use colors that look good on a
- " dark background. When set to "light", Vim will try to use colors that
- " look good on a light background. Any other value is illegal.
- set background=dark
- " Load color scheme {name}. This searches 'runtimepath'
- " for the file "colors/{name}.vim". The first one that
- " is found is loaded.
- try
- colorscheme desert
- catch
- endtry
- " When this option is set, the screen will not be redrawn while
- " executing macros, registers and other commands that have not been
- " typed. Also, updating the window title is postponed. To force an
- " update use |:redraw|.
- set lazyredraw
- " When a bracket is inserted, briefly jump to the matching one. The
- " jump is only done if the match can be seen on the screen. The time to
- " show the match can be set with 'matchtime'.
- " A Beep is given if there is no match (no matter if the match can be
- " seen or not). This option is reset when the 'paste' option is set.
- " When the 'm' flag is not included in 'cpoptions', typing a character
- " will immediately move the cursor back to where it belongs.
- set showmatch
- " Tenths of a second to show the matching paren, when 'showmatch' is
- " set. Note that this is not in milliseconds, like other options that
- " set a time. This is to be compatible with Nvi.
- set matchtime=2
- " Automatically displays all buffers when there's only one tab open.
- let g:airline#extensions#tabline#enabled = 1
- "}
- " { Line numbers and status line
- " Show the line number relative to the line with the cursor in front of
- " each line. Relative line numbers help you use the |count| you can
- " precede some vertical motion commands (e.g. j k + -) with, without
- " having to calculate it yourself. Especially useful in combination with
- " other commands (e.g. y d c < > gq gw =).
- set relativenumber
- " Print the line number in front of each line.
- " If relativenumber enabled, show absolute line number on current line
- set number
- " Always show the status line
- " The value of this option influences when the last window will have a
- " status line:
- " 0: never
- " 1: only if there are at least two windows
- " 2: always
- set laststatus=2
- " Show the line and column number of the cursor position, separated by a
- " comma. When there is room, the relative position of the displayed
- " text in the file is shown on the far right:
- " Top first line is visible
- " Bot last line is visible
- " All first and last line are visible
- " 45% relative position in the file
- set ruler
- " Format the status line
- " set statusline=\%F%m%r%h\ %w\ \ CWD:\ %r%{getcwd()}%h\ \ \ Line:\ %l
- set statusline=%t "tail of the filename
- set statusline+=%m "modified flag
- set statusline+=\ [%{strlen(&fenc)?&fenc:'none'}, "file encoding
- set statusline+=%{&ff}] "file format
- set statusline+=%h "help file flag
- set statusline+=%r "read only flag
- set statusline+=%y "filetype
- set statusline+=\ \ \ CWD:\ %r%{getcwd()}
- set statusline+=%= "left/right separator
- set statusline+=%c, "cursor column
- set statusline+=%l/%L "cursor line/total lines
- set statusline+=\ %P "percent through fileh%m%r%y%=%c,%l/%L\ %P
- "}
- " { Searching
- " Override the 'ignorecase' option if the search pattern contains upper
- " case characters. Only used when the search pattern is typed and
- " 'ignorecase' option is on. Used for the commands "/", "?", "n", "N",
- " ":g" and ":s". Not used for "*", "#", "gd", tag search, etc. After
- " "*" and "#" you can make 'smartcase' used by doing a "/" command,
- " recalling the search pattern from history and hitting <Enter>.
- set smartcase
- " Ignore case in search patterns. Also used when searching in the tags
- " file.
- set ignorecase
- " Disable higlighting until the next search.
- nnoremap <silent> <space> :noh<CR>
- " When there is a previous search pattern, highlight all its matches.
- " The type of highlighting used can be set with the 'l' occasion in the
- " 'highlight' option. This uses the "Search" highlight group by
- " default. Note that only the matching text is highlighted, any offsets
- " are not applied.
- set hlsearch
- " While typing a search command, show where the pattern, as it was typed
- " so far, matches. The matched string is highlighted. If the pattern
- " is invalid or not found, nothing is shown. The screen will be updated
- " often, this is only useful on fast terminals.
- set incsearch
- " Changes the special characters that can be used in search patterns.
- " See |pattern|.
- " NOTE: To avoid portability problems with using patterns, always keep
- " this option at the default "on". Only switch it off when working with
- " old Vi scripts. In any other situation write patterns that work when
- " 'magic' is on. Include "\M" when you want to |/\M|.
- set magic
- "}
- " { Misc
- " Put Vim in Paste mode. This is useful if you want to cut or copy
- " some text from one window and paste it in Vim. This will avoid
- " unexpected effects.
- " Setting this option is useful when using Vim in a terminal, where Vim
- " cannot distinguish between typed text and pasted text. In the GUI, Vim
- " knows about pasting and will mostly do the right thing without 'paste'
- " being set. The same is true for a terminal where Vim handles the
- " mouse clicks itself.
- set paste
- " Make vim use the system clipboard by default
- set clipboard=unnamed
- " Move a line of text using ALT+[jk]
- nmap <M-j> mz:m+<cr>`z
- nmap <M-k> mz:m-2<cr>`z
- vmap <M-j> :m'>+<cr>`<my`>mzgv`yo`z
- vmap <M-k> :m'<-2<cr>`>my`<mzgv`yo`z
- " Number of screen lines to use for the command-line. Helps avoiding
- " |hit-enter| prompts.
- set cmdheight=2
- " When off a buffer is unloaded when it is |abandon|ed. When on a
- " buffer becomes hidden when it is |abandon|ed. If the buffer is still
- " displayed in another window, it does not become hidden, of course.
- set hidden
- " A history of ":" commands, and a history of previous search patterns
- " are remembered. This option decides how many entries may be stored in
- " each of these histories (see |cmdline-editing|).
- set history=500
- " Close the current buffer
- map <leader>bd :Bclose<cr>
- " Close the current buffer
- map <leader>cd :cd %:p:h<cr>:pwd<cr>
- " Toggle spell checking.
- map <leader>ss :setlocal spell!<cr>
- " Remove the Windows ^M - when the encodings gets messed up
- noremap <Leader>m mmHmt:%s/<C-V><cr>//ge<cr>'tzt'm
- " Set startup directory.
- cd C:\Dev
- "}
- " { Movement including when deleting
- " Minimal number of screen lines to keep above and below the cursor.
- " This will make some context visible around where you are working.
- set scrolloff=3
- " Influences the working of <BS>, <Del>, CTRL-W and CTRL-U in Insert
- " mode. This is a list of items, separated by commas. Each item allows
- " a way to backspace over something:
- " value effect ~
- " indent allow backspacing over autoindent
- " eol allow backspacing over line breaks (join lines)
- " start allow backspacing over the start of insert; CTRL-W and CTRL-U
- " stop once at the start of insert.
- " When the value is empty, Vi compatible backspacing is used.
- set backspace=indent,eol,start
- " Allow specified keys that move the cursor left/right to move to the
- " previous/next line when the cursor is on the first/last character in
- " the line. Concatenate characters to allow this for these keys:
- " char key mode ~
- " b <BS> Normal and Visual
- " s <Space> Normal and Visual
- " h "h" Normal and Visual (not recommended)
- " l "l" Normal and Visual (not recommended)
- " < <Left> Normal and Visual
- " > <Right> Normal and Visual
- " ~ "~" Normal
- " [ <Left> Insert and Replace
- " ] <Right> Insert and Replace
- set whichwrap=b,s,<,>,h,l
- " Useful for navigating windows.
- map <C-j> <C-W>j
- map <C-k> <C-W>k
- map <C-h> <C-W>h
- map <C-l> <C-W>l
- "}
- " { Tab completion in menus
- " Completion mode that is used for the character specified with
- " 'wildchar'. It is a comma separated list of up to four parts. Each
- " part specifies what to do for each consecutive use of 'wildchar'. The
- " first part specifies the behavior for the first use of 'wildchar',
- " The second part for the second use, etc.
- " These are the possible values for each part:
- " "" Complete only the first match.
- " "full" Complete the next full match. After the last match,
- " the original string is used and then the first match
- " again.
- " "longest" Complete till longest common string. If this doesn't
- " result in a longer string, use the next part.
- " "longest:full" Like "longest", but also start 'wildmenu' if it is
- " enabled.
- " "list" When more than one match, list all matches.
- " "list:full" When more than one match, list all matches and
- " complete first match.
- " "list:longest" When more than one match, list all matches and
- " complete till longest common string.
- " When there is only a single match, it is fully completed in all cases.
- set wildmode=longest,full
- " When 'wildmenu' is on, command-line completion operates in an enhanced
- " mode. On pressing 'wildchar' (usually <Tab>) to invoke completion,
- " the possible matches are shown just above the command line, with the
- " first match highlighted (overwriting the status line, if there is
- " one). Keys that show the previous/next match, such as <Tab> or
- " CTRL-P/CTRL-N, cause the highlight to move to the appropriate match.
- " When 'wildmode' is used, "wildmenu" mode is used where "full" is
- " specified. "longest" and "list" do not start "wildmenu" mode.
- set wildmenu
- "}
- " { Language
- let $LANG='en'
- " Language to use for menu translation.
- set langmenu=en
- "}
- " { Handle cursor in cygwin [REMOVE ON LINUX]
- let &t_ti.="\e[1 q"
- let &t_SI.="\e[5 q"
- let &t_EI.="\e[1 q"
- let &t_te.="\e[0 q"
- "}
- " { Tab settings
- " Set tabstop to tell vim how many columns a tab counts for. Linux kernel
- " code expects each tab to be eight columns wide. Visual Studio expects
- " each tab to be four columns wide. This is the only command here that
- " will affect how existing text displays.
- set tabstop=4
- " Set softtabstop to control how many columns vim uses when you hit Tab in
- " insert mode. If softtabstop is less than tabstop and expandtab is not
- " set, vim will use a combination of tabs and spaces to make up the desired
- " spacing. If softtabstop equals tabstop and expandtab is not set, vim
- " will always use tabs. When expandtab is set, vim will always use the
- " appropriate number of spaces.
- set softtabstop=4
- " Set shiftwidth to control how many columns text is indented with the
- " reindent operations (<< and >>) and automatic C-style indentation.
- set shiftwidth=4
- " When expandtab is set, hitting Tab in insert mode will produce the
- " appropriate number of spaces.
- set expandtab
- " When on, a <Tab> in front of a line inserts blanks according to
- " 'shiftwidth'. 'tabstop' or 'softtabstop' is used in other places. A
- " <BS> will delete a 'shiftwidth' worth of space at the start of the
- " line.
- set smarttab
- " When on, Vim will change the current working directory whenever you
- " open a file, switch buffers, delete a buffer or open/close a window.
- " It will change to the directory containing the file which was opened
- " or selected.
- set autochdir
- "}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement