Instruction stringlengths 14 778 | input_code stringlengths 0 4.24k | output_code stringlengths 1 5.44k |
|---|---|---|
Add "all current" runtime test which install everything via package manager | FROM debian:latest
# Update registry
RUN apt-get update -qq
# Install tesseract and dependencies
RUN apt-get install -y \
libtesseract-dev \
libleptonica-dev \
tesseract-ocr-eng
# Install Go
RUN apt-get install -y git golang
ENV GOPATH=/go
# Get go packages
RUN go get github.com/otiai10/mint
ADD . ${GOPATH}/src/github.com/otiai10/gosseract
WORKDIR ${GOPATH}/src/github.com/otiai10/gosseract
# Test it!
CMD go test
| |
Add compton to autostart (turned off by default). | [Desktop Entry]
Type=Application
Name=Compton (X Compositor)
GenericName=X compositor
Comment=A X compositor
TryExec=compton
Exec=compton --dbus
# turned off by default
Hidden=true
OnlyShowIn=LXQt;
X-LXQt-Module=true
| |
Add Docker image for Wily | # moveit/moveit:kinetic-ci-wily
# Sets up a base image to use for running Continuous Integration on Travis for Ubuntu Wily
FROM osrf/ubuntu_32bit:wily
MAINTAINER Dave Coleman dave@dav.ee
# ----------------------------------------------------------------------------------
# From https://github.com/osrf/docker_images/
# setup environment
RUN locale-gen en_US.UTF-8
ENV LANG en_US.UTF-8
# setup keys
RUN apt-key adv --keyserver ha.pool.sks-keyservers.net --recv-keys 421C365BD9FF1F717815A3895523BAEEB01FA116
# setup sources.list
RUN echo "deb http://packages.ros.org/ros/ubuntu wily main" > /etc/apt/sources.list.d/ros-latest.list
# install bootstrap tools
RUN apt-get update && \
apt-get install --no-install-recommends -y \
python-rosdep \
python-rosinstall \
python-vcstools && \
rm -rf /var/lib/apt/lists/*
# bootstrap rosdep
RUN rosdep init && \
rosdep update
ENV ROS_DISTRO kinetic
# ----------------------------------------------------------------------------------
# Standard MoveIt! Docker
ENV TERM xterm
# Setup catkin workspace
ENV CATKIN_WS=/root/ws_moveit
RUN mkdir -p $CATKIN_WS/src
WORKDIR $CATKIN_WS/src
# Commands are combined in single RUN statement with "apt/lists" folder removal to reduce image size
RUN wstool init . && \
# Download moveit source so that we can get necessary dependencies
wstool merge https://raw.githubusercontent.com/ros-planning/moveit/${ROS_DISTRO}-devel/moveit.rosinstall && \
wstool update && \
# Update apt-get because previous images clear this cache
apt-get -qq update && \
# Install some base dependencies
apt-get -qq install -y \
# Some source builds require a package.xml be downloaded via wget from an external location
wget \
# Required for rosdep command
sudo \
# Preferred build tool
python-catkin-tools && \
# Download all dependencies of MoveIt!
rosdep install -y --from-paths . --ignore-src --rosdistro ${ROS_DISTRO} --as-root=apt:false && \
# Remove the source code from this container. TODO: in the future we may want to keep this here for further optimization of later containers
cd .. && \
rm -rf src/ && \
# Clear apt-cache to reduce image size
rm -rf /var/lib/apt/lists/*
# Continous Integration Setting
ENV IN_DOCKER 1
CMD ["bash"]
| |
Add Minecraft Feed The Beast Unleashed dockerfile. | FROM elliotcm/java7:1.7.0u45
MAINTAINER Elliot Crosby-McCullough "elliot@smart-casual.com"
RUN apt-get install unzip
ADD http://www.creeperrepo.net/direct/FTB2/18606e7928709218bd2a4386fb84ada9/modpacks%5EUnleashed%5E1_1_3%5EUnleashed-server.zip minecraft-ftb-unleashed.zip
RUN unzip minecraft-ftb-unleashed.zip -d /var/minecraft
RUN rm minecraft-ftb-unleashed.zip
RUN useradd -r -s /bin/false minecraft
RUN chown -R minecraft:minecraft /var/minecraft
WORKDIR /var/minecraft
ENTRYPOINT ["java", "-jar", "ftbserver.jar"]
USER minecraft
CMD ["-XX:PermSize=128m"]
EXPOSE 25565
| |
Add magnific popup script to head. | <% content_for :head dp %>
<script type='text/javascript'>
$(document).ready(function () {
$('#main-image').magnificPopup({
delegate: 'a',
type: 'image'
});
});
</script>
<% end %>
| |
Fix container status is_active static method call | namespace Dockery.DockerSdk.Model {
public enum ContainerStatus {
CREATED,
RESTARTING,
RUNNING,
PAUSED,
EXITED;
public static ContainerStatus[] all() {
return {RUNNING, PAUSED, EXITED, CREATED, RESTARTING};
}
public static ContainerStatus[] actives() {
return {RUNNING, PAUSED};
}
public static bool is_active(ContainerStatus status) {
return status in ContainerStatus.actives();
}
}
} | namespace Dockery.DockerSdk.Model {
public enum ContainerStatus {
CREATED,
RESTARTING,
RUNNING,
PAUSED,
EXITED;
public static ContainerStatus[] all() {
return {RUNNING, PAUSED, EXITED, CREATED, RESTARTING};
}
public static ContainerStatus[] actives() {
return {RUNNING, PAUSED};
}
public bool is_active(ContainerStatus status) {
return status in ContainerStatus.actives();
}
}
} |
Allow overriding content property in Comment class | /* valacomment.vala
*
* Copyright (C) 2008-2009 Florian Brosch
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Author:
* Florian Brosch <flo.brosch@gmail.com>
*/
using GLib;
/**
* A documentation comment used by valadoc
*/
public class Vala.Comment {
public Comment (string comment, SourceReference _source_reference) {
source_reference = _source_reference;
content = comment;
}
/**
* The text describing the referenced source code.
*/
public string content { set; get; }
/**
* References the location in the source file where this code node has
* been written.
*/
public SourceReference source_reference { get; set; }
}
| /* valacomment.vala
*
* Copyright (C) 2008-2009 Florian Brosch
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Author:
* Florian Brosch <flo.brosch@gmail.com>
*/
using GLib;
/**
* A documentation comment used by valadoc
*/
public class Vala.Comment {
public Comment (string comment, SourceReference _source_reference) {
source_reference = _source_reference;
content = comment;
}
/**
* The text describing the referenced source code.
*/
public virtual string content { set; get; }
/**
* References the location in the source file where this code node has
* been written.
*/
public SourceReference source_reference { get; set; }
}
|
Make UUID generation an internal helper | public string generate_uuid() {
char[] uuid = new char[16];
var output = new StringBuilder();
weak char[] hexstring = (char[]) "0123456789ABCDEF";
char left;
char right;
uuid_generate(uuid);
for (int i = 0;i <16; i++) {
left = (uuid[i] >> 4) & 0x0f ;
right = uuid[i] & 0x0f;
output.append_c(hexstring[left]);
output.append_c(hexstring[right]);
}
return output.str;
}
| internal string generate_uuid() {
char[] uuid = new char[16];
var output = new StringBuilder();
weak char[] hexstring = (char[]) "0123456789ABCDEF";
char left;
char right;
uuid_generate(uuid);
for (int i = 0;i <16; i++) {
left = (uuid[i] >> 4) & 0x0f ;
right = uuid[i] & 0x0f;
output.append_c(hexstring[left]);
output.append_c(hexstring[right]);
}
return output.str;
}
|
Add a test for enum methods and constants | using GLib;
enum Maman.Foo {
VAL2 = 2,
VAL3,
VAL5 = 5
}
class Maman.Bar : Object {
public void run () {
stdout.printf (" %d", Foo.VAL2);
stdout.printf (" %d", Foo.VAL3);
stdout.printf (" 4");
stdout.printf (" %d", Foo.VAL5);
}
static void test_enums_0_conversion () {
Foo foo = 0;
}
public static int main () {
stdout.printf ("Enum Test: 1");
var bar = new Bar ();
bar.run ();
stdout.printf (" 6\n");
test_enums_0_conversion ();
return 0;
}
}
void main () {
Maman.Bar.main ();
}
| using GLib;
enum Maman.Foo {
VAL2 = 2,
VAL3,
VAL5 = 5
}
enum Maman.Fooish {
VAL1,
VAL2;
public int something () {
return (int) this;
}
public const int FOO = 2;
}
class Maman.Bar : Object {
public void run () {
stdout.printf (" %d", Foo.VAL2);
stdout.printf (" %d", Foo.VAL3);
stdout.printf (" 4");
stdout.printf (" %d", Foo.VAL5);
}
static void test_enums_0_conversion () {
Foo foo = 0;
}
static void test_enum_methods_constants () {
Fooish x = Fooish.VAL1;
stdout.printf ("%d", x.something ());
stdout.printf ("%d", Fooish.FOO);
}
public static int main () {
stdout.printf ("Enum Test: 1");
var bar = new Bar ();
bar.run ();
stdout.printf (" 6\n");
test_enums_0_conversion ();
test_enum_methods_constants ();
return 0;
}
}
void main () {
Maman.Bar.main ();
}
|
Add forgotten custom item class | /*
* Copyright (C) 2008 Zeeshan Ali <zeenix@gmail.com>.
* Copyright (C) 2008 Nokia Corporation, all rights reserved.
*
* Author: Zeeshan Ali <zeenix@gmail.com>
*
* This file is part of Rygel.
*
* Rygel is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* Rygel is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
using GUPnP;
/**
* Represents MediaExport item.
*/
public class Rygel.MediaExportItem : MediaItem {
public MediaExportItem (MediaContainer parent,
File file,
FileInfo info) {
string content_type = info.get_content_type ();
string item_class = null;
string id = Checksum.compute_for_string (ChecksumType.MD5,
info.get_name ());
// use heuristics based on content type; will use MediaHarvester
// when it's ready
if (content_type.has_prefix ("video/")) {
item_class = MediaItem.VIDEO_CLASS;
} else if (content_type.has_prefix ("audio/")) {
item_class = MediaItem.AUDIO_CLASS;
} else if (content_type.has_prefix ("image/")) {
item_class = MediaItem.IMAGE_CLASS;
}
if (item_class == null) {
item_class = MediaItem.AUDIO_CLASS;
warning ("Failed to detect UPnP class for '%s', assuming it's '%s'",
file.get_uri (), item_class);
}
base (id, parent, info.get_name (), item_class);
this.mime_type = content_type;
this.uris.add (file.get_uri ());
}
}
| |
Make sure we also allow /pub/static | # Check Basic auth against a table. /admin URLs are no basic auth protected to avoid the possibility of people
# locking themselves out
if ( table.lookup(magentomodule_basic_auth, regsub(req.http.Authorization, "^Basic ", ""), "NOTFOUND") == "NOTFOUND" &&
req.url !~ "^/(index\.php/)?admin(_.*)?/" ) {
error 971;
}
| # Check Basic auth against a table. /admin URLs are not basic auth protected to avoid the possibility of people
# locking themselves out
if ( table.lookup(magentomodule_basic_auth, regsub(req.http.Authorization, "^Basic ", ""), "NOTFOUND") == "NOTFOUND" &&
!req.url ~ "^/(index\.php/)?admin(_.*)?/" &&
!req.url ~ "^/pub/static/" ) {
error 971;
}
|
Disable http auth for GraphQL endpoint | # Check Basic auth against a table. /admin URLs are not basic auth protected to avoid the possibility of people
# locking themselves out. /oauth and /rest have their own auth so we can skip Basic Auth on them as well
if ( table.lookup(magentomodule_basic_auth, regsub(req.http.Authorization, "^Basic ", ""), "NOTFOUND") == "NOTFOUND" &&
!req.url ~ "^/(index\.php/)?####ADMIN_PATH####/" &&
!req.url ~ "^/(index\.php/)?(rest|oauth)/" &&
!req.url ~ "^/pub/static/" ) {
error 771;
}
| # Check Basic auth against a table. /admin URLs are not basic auth protected to avoid the possibility of people
# locking themselves out. /oauth and /rest have their own auth so we can skip Basic Auth on them as well
if ( table.lookup(magentomodule_basic_auth, regsub(req.http.Authorization, "^Basic ", ""), "NOTFOUND") == "NOTFOUND" &&
!req.url ~ "^/(index\.php/)?####ADMIN_PATH####/" &&
!req.url ~ "^/(index\.php/)?(rest|oauth|graphql)/" &&
!req.url ~ "^/pub/static/" ) {
error 771;
}
|
Use CtrlP instead of CtrlPMixed | " plugin/plugin.ctrlp.vim
" Customize the path of the cache files
let g:ctrlp_cache_dir = g:vim_home . '/tmp/ctrlp'
" Allow to prefix <C-p> with a count to start in a specific mode
let g:ctrlp_cmd = 'exe get(["CtrlPMixed", "CtrlPBuffer", "CtrlPModified", "CtrlPMRU"], v:count)'
" Avoid adding a prefix to each entry in the list
let g:ctrlp_line_prefix = ''
" Open all selected files as hidden buffers
let g:ctrlp_open_multiple_files = 'ijr'
" Use `The Silver Searcher` if available
if executable('ag')
let g:ctrlp_user_command = 'ag %s
\ --literal
\ --nocolor
\ --nogroup
\ --depth 40
\ --files-with-matches
\ --skip-vcs-ignores
\ -g ""'
endif
" Search symbols in current file
nnoremap <Leader>r :CtrlPBufTag<CR>
| " plugin/plugin.ctrlp.vim
" Customize the path of the cache files
let g:ctrlp_cache_dir = g:vim_home . '/tmp/ctrlp'
" Allow to prefix <C-p> with a count to start in a specific mode
let g:ctrlp_cmd = 'exe get(["CtrlP", "CtrlPBuffer", "CtrlPMRU"], v:count)'
" Avoid adding a prefix to each entry in the list
let g:ctrlp_line_prefix = ''
" Open all selected files as hidden buffers
let g:ctrlp_open_multiple_files = 'ijr'
" Use `The Silver Searcher` if available
if executable('ag')
let g:ctrlp_user_command = 'ag %s
\ --literal
\ --nocolor
\ --nogroup
\ --depth 40
\ --files-with-matches
\ --skip-vcs-ignores
\ -g ""'
endif
" Search symbols in current file
nnoremap <Leader>r :CtrlPBufTag<CR>
|
Use vim-airline/vim-airline instead of bling | call plug#begin('~/.vim/plugged')
Plug 'bling/vim-airline' " Display more information in statusline. [vim-airline]
Plug 'tpope/vim-fugitive' " This is a Git helper plugin. [vim-fugitive]
Plug 'airblade/vim-gitgutter' " Show the diff of changes in the gutter. [vim-gitgutter]
Plug 'godlygeek/tabular' " I mostly use this for Markdown tables. [tabular]
Plug 'tpope/vim-markdown' " Highlight with markdown syntax. [vim-markdown]
Plug 'tpope/vim-sensible'
call plug#end()
" [vim-plug]: https://github.com/junegunn/vim-plug
" [vim-airline]: https://github.com/bling/vim-airline
" [vim-fugitive]: https://github.com/tpope/vim-fugitive
" [vim-gitgutter]: https://github.com/airblade/vim-gitgutter
" [tabular]: https://github.com/godlygeek/tabular
" [vim-markdown]: https://github.com/tpope/vim-markdown
| call plug#begin('~/.vim/plugged')
Plug 'vim-airline/vim-airline' " Display more information in statusline. [vim-airline]
Plug 'vim-airline/vim-airline-themes' " Themes for vim-airline.
Plug 'tpope/vim-fugitive' " This is a Git helper plugin. [vim-fugitive]
Plug 'airblade/vim-gitgutter' " Show the diff of changes in the gutter. [vim-gitgutter]
Plug 'godlygeek/tabular' " I mostly use this for Markdown tables. [tabular]
Plug 'tpope/vim-markdown' " Highlight with markdown syntax. [vim-markdown]
Plug 'tpope/vim-sensible'
call plug#end()
" [vim-plug]: https://github.com/junegunn/vim-plug
" [vim-airline]: https://github.com/vim-airline/vim-airline
" [vim-fugitive]: https://github.com/tpope/vim-fugitive
" [vim-gitgutter]: https://github.com/airblade/vim-gitgutter
" [tabular]: https://github.com/godlygeek/tabular
" [vim-markdown]: https://github.com/tpope/vim-markdown
|
Make fswitch recognise .cc files | " deoplete
call deoplete#custom#var('omni', 'input_patterns', { 'cpp': ['[^. *\t]\.\w*','[^. *\t]\::\w*','[^. *\t]\->\w*','#include\s*[<"][^>"]*'] })
" Linters
let g:ale_linters.c = ['gcc']
let g:ale_linters.cpp = ['gcc']
" Autoformat
let g:ale_fixers.c = ['clang-format']
let g:ale_fixers.cpp = ['clang-format']
| " deoplete
call deoplete#custom#var('omni', 'input_patterns', { 'cpp': ['[^. *\t]\.\w*','[^. *\t]\::\w*','[^. *\t]\->\w*','#include\s*[<"][^>"]*'] })
" Linters
let g:ale_linters.c = ['gcc']
let g:ale_linters.cpp = ['gcc']
" Autoformat
let g:ale_fixers.c = ['clang-format']
let g:ale_fixers.cpp = ['clang-format']
" fswitch
au BufEnter *.h let b:fswitchdst = 'cpp,cc,c'
au BufEnter *.cc let b:fswitchdst = 'h'
|
Add some abbreviations & stop markdown auto-opening | abbrev tableflip (╯°□°)╯︵ ┻━┻)
| abbrev tableflip (╯°□°)╯︵ ┻━┻)
abbrev nre nREPL
abbrev taht that
abbrev superceded superseded
abbrev Superceded Superseded
let g:markdown_composer_open_browser = 0
|
Revert "VIm: use 4-spaces indentation" | set autoindent " automatically indent new lines
set formatoptions+=o " continue comment marker in new lines
set textwidth=78 " hard-wrap long lines as you type them
set tabstop=4 " render TABs using this many spaces
set expandtab " insert spaces when TAB is pressed
set softtabstop=4 " ... this many spaces
set shiftwidth=4 " indentation amount for < and > commands
" repeat last character to the maximum width of current line
nnoremap <Leader>_ :execute 's/.$/'. repeat('&', &textwidth+1) .'/'<Enter>
\:execute 's/\%>'. &textwidth .'v.//g'<Enter>
" insert or update section separator at end of current line
nmap <Leader>- A-<Esc><Leader>_
" format current line as a top-level heading in markdown (uses `z marker)
nmap <Leader>= mzyypVr=:.+1g/^=\+/d<Enter>`z
" format current line as a second-level heading in markdown (uses `z marker)
nmap <Leader>+ mzyypVr-:.+1g/^-\+/d<Enter>`z
| set autoindent " automatically indent new lines
set formatoptions+=o " continue comment marker in new lines
set textwidth=78 " hard-wrap long lines as you type them
set tabstop=2 " render TABs using this many spaces
set expandtab " insert spaces when TAB is pressed
set softtabstop=2 " ... this many spaces
set shiftwidth=2 " indentation amount for < and > commands
" repeat last character to the maximum width of current line
nnoremap <Leader>_ :execute 's/.$/'. repeat('&', &textwidth+1) .'/'<Enter>
\:execute 's/\%>'. &textwidth .'v.//g'<Enter>
" insert or update section separator at end of current line
nmap <Leader>- A-<Esc><Leader>_
" format current line as a top-level heading in markdown (uses `z marker)
nmap <Leader>= mzyypVr=:.+1g/^=\+/d<Enter>`z
" format current line as a second-level heading in markdown (uses `z marker)
nmap <Leader>+ mzyypVr-:.+1g/^-\+/d<Enter>`z
|
Make Ctrl-P show hidden files | let g:ctrlp_working_path_mode ='a'
" let g:ctrlp_map = '<c-f>'
map <c-b> :CtrlPBuffer<cr>
let g:ctrlp_max_height = 20
let g:ctrlp_custom_ignore = 'node_modules\|^\.DS_Store\|^\.git\|^\.coffee'
let g:ctrlp_follow_symlinks = 1
| let g:ctrlp_working_path_mode ='a'
" let g:ctrlp_map = '<c-f>'
map <c-b> :CtrlPBuffer<cr>
let g:ctrlp_max_height = 20
let g:ctrlp_custom_ignore = 'node_modules\|^\.DS_Store\|^\.git\|^\.coffee'
let g:ctrlp_follow_symlinks = 1
let g:ctrlp_show_hidden = 1
|
Add :DiffOrig function to show diff btw last save and current edits | " from http://vimcasts.org/episodes/tidying-whitespace/
function! Preserve(command)
" Preparation: save last search, and cursor position.
let save_cursor = getpos('.')
let last_search = getreg('/')
" Do the business:
execute a:command
" Clean up: restore previous search history, and cursor position
call setpos('.', save_cursor)
call setreg('/', last_search)
endfunction
| " from http://vimcasts.org/episodes/tidying-whitespace/
function! Preserve(command)
" Preparation: save last search, and cursor position.
let save_cursor = getpos('.')
let last_search = getreg('/')
" Do the business:
execute a:command
" Clean up: restore previous search history, and cursor position
call setpos('.', save_cursor)
call setreg('/', last_search)
endfunction
" Convenient command to see the difference between the current buffer and the
" file it was loaded from, thus the changes you made.
" Only define it when not defined already.
if !exists(":DiffOrig")
command DiffOrig vert new | set bt=nofile | r ++edit # | 0d_ | diffthis
\ | wincmd p | diffthis
endif
|
Add tab setting for HTML. | " tab
set expandtab
set tabstop=4
set shiftwidth=4
set softtabstop=4
set smarttab
" appearance
set showmatch
set list
set listchars=tab:>.,trail:_,eol:↲,extends:>,precedes:<,nbsp:%
" control
set backspace=start,eol,indent
set whichwrap=b,s,[,],,~
| " tab
set expandtab
set tabstop=4
set shiftwidth=4
set softtabstop=4
set smarttab
augroup fileTypeIndent
autocmd!
autocmd BufNewFile,BufRead *.html setlocal tabstop=2 shiftwidth=2 softtabstop=2
augroup END
" appearance
set showmatch
set list
set listchars=tab:>.,trail:_,eol:↲,extends:>,precedes:<,nbsp:%
" control
set backspace=start,eol,indent
set whichwrap=b,s,[,],,~
|
Add tmux syntax to vim | filetype off
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" Plugins {{{
Plugin 'gmarik/Vundle.vim'
Plugin 'tpope/vim-fugitive'
Plugin 'kien/ctrlp.vim'
Plugin 'mattn/emmet-vim'
Plugin 'tpope/vim-surround'
" Make gvim-only colorschemes work transparently in terminal vim
Plugin 'godlygeek/csapprox'
" }}}
" Syntax {{{
Plugin 'cakebaker/scss-syntax.vim'
Plugin 'jelera/vim-javascript-syntax'
" }}}
" Colorschemes {{{
Plugin 'tomasr/molokai'
Plugin 'vim-scripts/Wombat'
Plugin 'wombat256.vim'
Plugin 'summerfruit256.vim'
" }}}
call vundle#end()
| filetype off
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" Plugins {{{
Plugin 'gmarik/Vundle.vim'
Plugin 'tpope/vim-fugitive'
Plugin 'kien/ctrlp.vim'
Plugin 'mattn/emmet-vim'
Plugin 'tpope/vim-surround'
" Make gvim-only colorschemes work transparently in terminal vim
Plugin 'godlygeek/csapprox'
" }}}
" Syntax {{{
Plugin 'cakebaker/scss-syntax.vim'
Plugin 'jelera/vim-javascript-syntax'
Plugin 'zaiste/tmux.vim'
" }}}
" Colorschemes {{{
Plugin 'tomasr/molokai'
Plugin 'vim-scripts/Wombat'
Plugin 'wombat256.vim'
Plugin 'summerfruit256.vim'
" }}}
call vundle#end()
|
Add filetype detection for sbt and template files | au BufRead,BufNewFile *.scala set filetype=scala
| au BufRead,BufNewFile *.scala set filetype=scala
au BufNewFile,BufRead *.sbt set filetype=scala
" Use haml syntax for scaml
au BufRead,BufNewFile *.scaml set filetype=haml
|
Use 1-based indexing for buffer ranges | " vim: et sw=2 sts=2
scriptencoding utf-8
" Function: #list_active_buffers {{{1
function! sy#debug#list_active_buffers() abort
for b in range(0, bufnr('$'))
if !buflisted(b) || empty(getbufvar(b, 'sy'))
continue
endif
let sy = copy(getbufvar(b, 'sy'))
let path = remove(sy, 'path')
echo "\n". path ."\n". repeat('=', strlen(path))
for stat in sort(keys(sy))
echo printf("%20s = %s\n", stat, string(sy[stat]))
endfor
endfor
endfunction
| " vim: et sw=2 sts=2
scriptencoding utf-8
" Function: #list_active_buffers {{{1
function! sy#debug#list_active_buffers() abort
for b in range(1, bufnr('$'))
if !buflisted(b) || empty(getbufvar(b, 'sy'))
continue
endif
let sy = copy(getbufvar(b, 'sy'))
let path = remove(sy, 'path')
echo "\n". path ."\n". repeat('=', strlen(path))
for stat in sort(keys(sy))
echo printf("%20s = %s\n", stat, string(sy[stat]))
endfor
endfor
endfunction
|
Add vim-sexp (and tpopes bindings) | Plug 'Shougo/deoplete.nvim'
Plug 'airblade/vim-gitgutter'
Plug 'ctrlpvim/ctrlp.vim'
Plug 'easymotion/vim-easymotion'
Plug 'jiangmiao/auto-pairs'
Plug 'liuchengxu/vim-better-default'
Plug 'rafi/awesome-vim-colorschemes'
Plug 'tpope/vim-commentary'
Plug 'tpope/vim-dadbod'
Plug 'tpope/vim-dispatch'
Plug 'tpope/vim-eunuch'
Plug 'tpope/vim-fireplace'
Plug 'tpope/vim-fugitive'
Plug 'tpope/vim-repeat'
Plug 'tpope/vim-sleuth'
Plug 'tpope/vim-surround'
Plug 'tpope/vim-unimpaired'
Plug 'tpope/vim-vinegar'
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'w0rp/ale'
| Plug 'Shougo/deoplete.nvim'
Plug 'airblade/vim-gitgutter'
Plug 'ctrlpvim/ctrlp.vim'
Plug 'easymotion/vim-easymotion'
Plug 'guns/vim-sexp'
Plug 'jiangmiao/auto-pairs'
Plug 'liuchengxu/vim-better-default'
Plug 'rafi/awesome-vim-colorschemes'
Plug 'tpope/vim-commentary'
Plug 'tpope/vim-dadbod'
Plug 'tpope/vim-dispatch'
Plug 'tpope/vim-eunuch'
Plug 'tpope/vim-fireplace'
Plug 'tpope/vim-fugitive'
Plug 'tpope/vim-repeat'
Plug 'tpope/vim-sexp-mappings-for-regular-people'
Plug 'tpope/vim-sleuth'
Plug 'tpope/vim-surround'
Plug 'tpope/vim-unimpaired'
Plug 'tpope/vim-vinegar'
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'w0rp/ale'
|
Fix Vim highlighting of action blocks | " Vim Syntax configuration for ruby-ll grammar files.
"
" Language: ruby-ll
" Maintainer: Yorick Peterse <yorickpeterse@gmail.com>
"
syntax clear
syn include @rubyTop syntax/ruby.vim
syn match rllKeyword "%[a-zA-Z]\+"
syn match rllComment "#.*$"
syn match rllOperator "?|+|\*"
syn region rllRuby start="{" end="}" contains=@rubyTop
hi link rllKeyword Keyword
hi link rllComment Comment
hi link rllOperator Operator
let b:current_syntax = "rll"
| " Vim Syntax configuration for ruby-ll grammar files.
"
" Language: ruby-ll
" Maintainer: Yorick Peterse <yorickpeterse@gmail.com>
"
syntax clear
syn include @rubyTop syntax/ruby.vim
syn match rllKeyword "%[a-zA-Z]\+"
syn match rllComment "#.*$"
syn match rllOperator "?|+|\*"
syn match rllDelimiter '[=|]'
syn region rllRuby transparent matchgroup=rllDelimiter
\ start="{" end="}"
\ contains=@rubyTop
hi link rllKeyword Keyword
hi link rllComment Comment
hi link rllOperator Operator
let b:current_syntax = "rll"
|
Add note for skipped test of o_v, o_V, and o_Ctrl-v | let s:suite = themis#suite('operator_pending_behavior')
let s:assert = themis#helper('assert')
" NOTE: Also see repetition.vim spec
" :h o_v
" :h o_V
" :h o_CTRL-V
" Helper:
function! s:add_line(str)
put! =a:str
endfunction
function! s:add_lines(lines)
for line in reverse(a:lines)
put! =line
endfor
endfunction
function! s:get_pos_char()
return getline('.')[col('.')-1]
endfunction
function! s:suite.force_exclusive()
call s:assert.skip("because it seems vim has no variables to restore o_v, o_V, and o_Ctrl-V information")
" dv/pattern
call s:add_line('1pattern 2pattern 3pattern 4pattern 5pattern')
normal! gg0
call s:assert.equals(getline('.'), '1pattern 2pattern 3pattern 4pattern 5pattern')
exec "normal" "dv/\\dpattern\<CR>"
call s:assert.equals(getline('.'), 'pattern 3pattern 4pattern 5pattern')
endfunction
" TODO:
| let s:suite = themis#suite('operator_pending_behavior')
let s:assert = themis#helper('assert')
" NOTE: Also see repetition.vim spec
" :h o_v
" :h o_V
" :h o_CTRL-V
" Helper:
function! s:add_line(str)
put! =a:str
endfunction
function! s:add_lines(lines)
for line in reverse(a:lines)
put! =line
endfor
endfunction
function! s:get_pos_char()
return getline('.')[col('.')-1]
endfunction
function! s:suite.force_exclusive()
call s:assert.skip("because it seems vim has no variables to restore o_v, o_V, and o_Ctrl-V information")
" NOTE:
" - http://lingr.com/room/vim/archives/2014/09/22#message-20239719
" - https://groups.google.com/forum/#!topic/vim_dev/MNtX3jHkNWw
" - https://groups.google.com/forum/#!msg/vim_dev/lR5rONDwgs8/iLsVCrxo_WsJ
call s:add_line('1pattern 2pattern 3pattern 4pattern 5pattern')
normal! gg0
call s:assert.equals(getline('.'), '1pattern 2pattern 3pattern 4pattern 5pattern')
exec "normal" "dv/\\dpattern\<CR>"
call s:assert.equals(getline('.'), 'pattern 3pattern 4pattern 5pattern')
endfunction
" TODO:
|
Allow full screen on Windows only because the key |
" off99555's '.vimrc' configurations
" Extended to the Ultimate .vimrc
"let g:airline_theme='base16_solarized'
"let g:airline#extensions#tabline#enabled = 1
"colorscheme solarized
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" file settings
set number
" Maximize the Vim window under Windows OS
if has('gui_running')
au GUIEnter * simalt ~x
endif
" Stay in visual mode after indentation
vnoremap < <gv
vnoremap > >gv
" Make big Y behaves like other command
map Y y$
" Improve up/down movement on wrapped lines
nnoremap j gj
nnoremap k gk
" Force saving files that require root permission
cmap w!! %!sudo tee > /dev/null %
" The smash escape
inoremap jk <Esc>
"inoremap kj <Esc>
" Open new split windows to the right/bottom instead of left/top
"set splitright splitbelow
" Allow working with Unicode characters
scriptencoding utf-8
"set listchars=trail:·,precedes:«,extends:»,eol:¬,tab:▸\
|
" off99555's '.vimrc' configurations
" Extended to the Ultimate .vimrc
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" file settings
set number
" Maximize the Vim window under Windows OS
if has('gui_running') && (has("win16") || has("win32"))
au GUIEnter * simalt ~x
endif
" Stay in visual mode after indentation
vnoremap < <gv
vnoremap > >gv
" Make big Y behaves like other command
map Y y$
" Improve up/down movement on wrapped lines
nnoremap j gj
nnoremap k gk
" Force saving files that require root permission
cmap w!! %!sudo tee > /dev/null %
" The smash escape
inoremap jk <Esc>
"inoremap kj <Esc>
" Open new split windows to the right/bottom instead of left/top
"set splitright splitbelow
" Allow working with Unicode characters
scriptencoding utf-8
"set listchars=trail:·,precedes:«,extends:»,eol:¬,tab:▸\
|
Add arrow mappings for Markdown. | setlocal spell spelllang=en_us
set complete+=kspell
highlight htmlItalic cterm=italic
highlight htmlBold cterm=bold
" Highlight words to avoid in tech writing
" http://css-tricks.com/words-avoid-educational-writing/
" https://github.com/pengwynn/dotfiles
highlight TechWordsToAvoid ctermbg=red ctermfg=white
function! MatchTechWordsToAvoid()
match TechWordsToAvoid /\c\(obviously\|basically\|simply\|of\scourse\|clearly\|just\|everyone\sknows\|however\|so,\|easy\)/
endfunction
call MatchTechWordsToAvoid()
autocmd BufWinEnter *.md call MatchTechWordsToAvoid()
autocmd InsertEnter *.md call MatchTechWordsToAvoid()
autocmd InsertLeave *.md call MatchTechWordsToAvoid()
autocmd BufWinLeave *.md call clearmatches()
command! -nargs=* Wrap set wrap linebreak nolist
" en and em dashes
inoremap <buffer> --<space> –
inoremap <buffer> ---<space> —
| setlocal spell spelllang=en_us
set complete+=kspell
highlight htmlItalic cterm=italic
highlight htmlBold cterm=bold
" Highlight words to avoid in tech writing
" http://css-tricks.com/words-avoid-educational-writing/
" https://github.com/pengwynn/dotfiles
highlight TechWordsToAvoid ctermbg=red ctermfg=white
function! MatchTechWordsToAvoid()
match TechWordsToAvoid /\c\(obviously\|basically\|simply\|of\scourse\|clearly\|just\|everyone\sknows\|however\|so,\|easy\)/
endfunction
call MatchTechWordsToAvoid()
autocmd BufWinEnter *.md call MatchTechWordsToAvoid()
autocmd InsertEnter *.md call MatchTechWordsToAvoid()
autocmd InsertLeave *.md call MatchTechWordsToAvoid()
autocmd BufWinLeave *.md call clearmatches()
command! -nargs=* Wrap set wrap linebreak nolist
" en and em dashes (https://www.w3schools.com/charsets/ref_utf_punctuation.asp)
inoremap <buffer> --<space> –
inoremap <buffer> ---<space> —
" arrows (https://www.w3schools.com/charsets/ref_utf_arrows.asp)
inoremap <buffer> --><space> →
inoremap <buffer> <--<space> ←
|
Remove unnecessary solarized setting for vim | " set term=screen-256color-bce
let s:uname = system("uname -s")
let g:solorized_termcolors=256
set t_Co=256
set background=dark
colorscheme solarized
" Added to support visual gitgutter display
highlight clear SignColumn
" Switch syntax highlighting on, when the terminal has colors
" Also switch on highlighting the last used search pattern.
if (&t_Co > 2 || has("gui_running")) && !exists("syntax_on")
syntax on
set hlsearch
endif
| " set term=screen-256color-bce
let s:uname = system("uname -s")
set t_Co=256
set background=dark
colorscheme solarized
" Added to support visual gitgutter display
highlight clear SignColumn
" Switch syntax highlighting on, when the terminal has colors
" Also switch on highlighting the last used search pattern.
if (&t_Co > 2 || has("gui_running")) && !exists("syntax_on")
syntax on
set hlsearch
endif
|
Add leader to c/d to copy to null register | " set a map leader for more key combos
let mapleader = ','
let g:mapleader = ','
" scroll the viewport faster
nnoremap <C-e> 3<C-e>
nnoremap <C-y> 3<C-y>
" scroll by visual lines
nnoremap <silent> j gj
nnoremap <silent> k gk
" disable search highlights
nnoremap <silent> <CR> :nohlsearch<CR><CR>
" fold with spacebar
nnoremap <space> za
" use tab for indenting
nnoremap <Tab> >>_
nnoremap <S-Tab> <<_
inoremap <S-Tab> <C-D>
vnoremap <Tab> >gV
vnoremap <S-Tab> <gV
" split horizontally with h
nnoremap <C-w>h <C-w>s
" fly between buffers:
" http://of-vim-and-vigor.blogspot.ro/p/vim-vigor-comic.html
nnoremap <leader>l :ls<CR>:b<space>
| " set a map leader for more key combos
let mapleader = ','
let g:mapleader = ','
" scroll the viewport faster
nnoremap <C-e> 3<C-e>
nnoremap <C-y> 3<C-y>
" scroll by visual lines
nnoremap <silent> j gj
nnoremap <silent> k gk
" disable search highlights
nnoremap <silent> <CR> :nohlsearch<CR><CR>
" fold with spacebar
nnoremap <space> za
" use tab for indenting
nnoremap <Tab> >>_
nnoremap <S-Tab> <<_
inoremap <S-Tab> <C-D>
vnoremap <Tab> >gV
vnoremap <S-Tab> <gV
" split horizontally with h
nnoremap <C-w>h <C-w>s
" fly between buffers:
" http://of-vim-and-vigor.blogspot.ro/p/vim-vigor-comic.html
nnoremap <leader>l :ls<CR>:b<space>
" prepend leader to copy to null register
" http://unix.stackexchange.com/a/88755
nnoremap <leader>c "_c
nnoremap <leader>d "_d
|
Use 2 spaces as a tab in python file | " tab
set expandtab
set tabstop=4
set shiftwidth=4
set softtabstop=4
set smarttab
au BufRead,BufNewFile,BufReadPre *.coffee set filetype=coffee
augroup fileTypeIndent
autocmd!
autocmd BufNewFile,BufRead *.html setlocal tabstop=2 shiftwidth=2 softtabstop=2
autocmd BufNewFile,BufRead *.coffee setlocal tabstop=2 shiftwidth=2 softtabstop=2
autocmd BufNewFile,BufRead *.rkt setlocal tabstop=2 shiftwidth=2 softtabstop=2
augroup END
" appearance
set showmatch
set list
set listchars=tab:>.,trail:_,eol:↲,extends:>,precedes:<,nbsp:%
" control
set backspace=start,eol,indent
set whichwrap=b,s,[,],,~
source $VIMRUNTIME/macros/matchit.vim
" for tex
let g:tex_conceal = ''
| " tab
set expandtab
set tabstop=4
set shiftwidth=4
set softtabstop=4
set smarttab
au BufRead,BufNewFile,BufReadPre *.coffee set filetype=coffee
augroup fileTypeIndent
autocmd!
autocmd BufNewFile,BufRead *.html setlocal tabstop=2 shiftwidth=2 softtabstop=2
autocmd BufNewFile,BufRead *.coffee setlocal tabstop=2 shiftwidth=2 softtabstop=2
autocmd BufNewFile,BufRead *.rkt setlocal tabstop=2 shiftwidth=2 softtabstop=2
autocmd BufNewFile,BufRead *.py setlocal tabstop=2 shiftwidth=2 softtabstop=2
augroup END
" appearance
set showmatch
set list
set listchars=tab:>.,trail:_,eol:↲,extends:>,precedes:<,nbsp:%
" control
set backspace=start,eol,indent
set whichwrap=b,s,[,],,~
source $VIMRUNTIME/macros/matchit.vim
" for tex
let g:tex_conceal = ''
|
Set Powerline font variant in gui | " Set maximum terminal color space.
set t_Co=256
" Set promptline.vim theme.
let g:promptline_theme = 'airline'
" Set colorscheme.
if has('gui_running')
let g:airline#extensions#tmuxline#enabled = 0
let g:airline_theme = 'zenburn'
let g:zenburn_high_Contrast = 1
colorscheme zenburn
set background=dark
else
if empty($VIM_COLOR)
let g:airline_theme = 'solarized'
colorscheme solarized
elseif $VIM_COLOR =~# "^base16-"
let g:airline_theme = substitute($VIM_COLOR, '-', '_', '')
endif
if empty($VIM_BACKGROUND)
set background=dark
else
if $VIM_BACKGROUND == 'light'
set background=light
else
set background=dark
endif
endif
endif
" Set font.
if has('gui_running')
set guifont=Inconsolata\-g\ 11
endif
| " Set maximum terminal color space.
set t_Co=256
" Set promptline.vim theme.
let g:promptline_theme = 'airline'
" Set colorscheme.
if has('gui_running')
let g:airline#extensions#tmuxline#enabled = 0
let g:airline_theme = 'zenburn'
let g:zenburn_high_Contrast = 1
colorscheme zenburn
set background=dark
else
if empty($VIM_COLOR)
let g:airline_theme = 'solarized'
colorscheme solarized
elseif $VIM_COLOR =~# "^base16-"
let g:airline_theme = substitute($VIM_COLOR, '-', '_', '')
endif
if empty($VIM_BACKGROUND)
set background=dark
else
if $VIM_BACKGROUND == 'light'
set background=light
else
set background=dark
endif
endif
endif
" Set font.
if has('gui_running')
set guifont=Inconsolata\-g\ for\ Powerline\ 11
endif
|
Add abbreviations to a bunch of useful stuff | iab DATE <C-R>=strftime("%d. %b %y")<CR>
iab TIME <C-R>=strftime("%H:%M")<CR>
| " Inserting Dates and Times
iab Ydate <C-R>=strftime("%d-%b-%Y")<CR>
" Example: 16-Apr-2016
iab Ytime <C-R>=strftime("%H:%M")<CR>
" Example: 22:21
iab YDATE <C-R>=strftime("%a %b %d %T %Z %Y")<CR>
" Example: Sat Apr 16 22:20:24 WEST 2016
" The lower letter alphabet.
iab Yalpha abcdefghijklmnopqrstuvwxyz
" The upper letter alphabet.
iab YALPHA ABCDEFGHIJKLMNOPQRSTUVWXYZ
" The ten digits.
iab Ydigit 1234567890
" The sixteen digits of a hexadecimal system.
iab Yhex 1234567890ABCDEF
|
Add ticket mapping to git commit filetype | " Turn on spell checking.
setlocal spell
" Mapping to insert current git ticket into file.
inoremap <C-g><C-t> <C-r>=execute('!git ticket')<cr>
" Mapping to retrieve commit message after failed commit.
function! GetPrevCommit()
let l:git_toplevel = glob("`git rev-parse --show-toplevel`/.git/COMMIT_EDITMSG")
:0read `git rev-parse --show-toplevel`/.git/COMMIT_EDITMSG
endfunction
nnoremap <buffer> <silent> <LocalLeader>b :call GetPrevCommit()<CR>
" vim:fdm=marker ft=vim et sts=2 sw=2 ts=2
| " Turn on spell checking.
setlocal spell
" Mapping to insert current git ticket into file.
nnoremap <buffer> <silent> <LocalLeader>t :r !git ticket<cr>
" Mapping to retrieve commit message after failed commit.
function! GetPrevCommit()
let l:git_toplevel = glob("`git rev-parse --show-toplevel`/.git/COMMIT_EDITMSG")
:0read `git rev-parse --show-toplevel`/.git/COMMIT_EDITMSG
endfunction
nnoremap <buffer> <silent> <LocalLeader>b :call GetPrevCommit()<CR>
" vim:fdm=marker ft=vim et sts=2 sw=2 ts=2
|
Add iabbrev's for thign -> thing | inoremap <buffer> --- —
inoremap <buffer> -- –
setlocal textwidth=80
setlocal colorcolumn=80
setlocal formatoptions+=n " Recognize numbered lists
setlocal nojoinspaces
setlocal spell
" Some keyboards are inclined to this
iabbrev ANd And
iabbrev CHrist Christ
iabbrev FOr For
iabbrev GOd God
iabbrev HIm Him
iabbrev HOly Holy
iabbrev JEsus Jesus
iabbrev JOb Job
iabbrev JOhn John
iabbrev LOrd Lord
iabbrev NEw New
iabbrev NOw Now
iabbrev OUr Our
iabbrev SOn Son
iabbrev SPirit Spirit
iabbrev THe The
iabbrev THere There
iabbrev THese These
iabbrev THey They
iabbrev THis This
iabbrev WHat What
iabbrev WHen When
iabbrev WHile While
iabbrev YOu You
iabbrev YOur Your
iabbrev teh the
iabbrev ahve have
iabbrev fo of
iabbrev LROD LORD
iabbrev utno unto
| inoremap <buffer> --- —
inoremap <buffer> -- –
setlocal textwidth=80
setlocal colorcolumn=80
setlocal formatoptions+=n " Recognize numbered lists
setlocal nojoinspaces
setlocal spell
" Some keyboards are inclined to this
iabbrev ANd And
iabbrev CHrist Christ
iabbrev FOr For
iabbrev GOd God
iabbrev HIm Him
iabbrev HOly Holy
iabbrev JEsus Jesus
iabbrev JOb Job
iabbrev JOhn John
iabbrev LOrd Lord
iabbrev NEw New
iabbrev NOw Now
iabbrev OUr Our
iabbrev SOn Son
iabbrev SPirit Spirit
iabbrev THe The
iabbrev THere There
iabbrev THese These
iabbrev THey They
iabbrev THis This
iabbrev WHat What
iabbrev WHen When
iabbrev WHile While
iabbrev YOu You
iabbrev YOur Your
iabbrev teh the
iabbrev ahve have
iabbrev fo of
iabbrev LROD LORD
iabbrev utno unto
iabbrev thigns things
iabbrev Thigns Things
iabbrev thign thing
iabbrev Thign Thing
|
Set json filetype for .tfstate.backup files | au BufRead,BufNewFile *.tf setlocal filetype=terraform
au BufRead,BufNewFile *.tfvars setlocal filetype=terraform
au BufRead,BufNewFile *.tfstate setlocal filetype=json
| au BufRead,BufNewFile *.tf setlocal filetype=terraform
au BufRead,BufNewFile *.tfvars setlocal filetype=terraform
au BufRead,BufNewFile *.tfstate setlocal filetype=json
au BufRead,BufNewFile *.tfstate.backup setlocal filetype=json
|
Handle case where match was cleared elsewhere | "if exists("g:loaded_lsc")
" finish
"endif
"let g:loaded_lsc = 1
" Diagnostics {{{1
" Highlight groups {{{2
if !hlexists('lscDiagnosticError')
highlight link lscDiagnosticError Error
endif
if !hlexists('lscDiagnosticWarning')
highlight link lscDiagnosticWarning SpellBad
endif
if !hlexists('lscDiagnosticInfo')
highlight link lscDiagnosticInfo SpellBad
endif
if !hlexists('lscDiagnosticHint')
highlight link lscDiagnosticHint SpellBad
endif
" HighlightDiagnostics {{{2
"
" Adds a match to the a highlight group for each diagnostics severity level.
"
" diagnostics: A list of dictionaries. Only the 'severity' and 'range' keys are
" used. See https://git.io/vXiUB
function! HighlightDiagnostics(diagnostics) abort
if !exists('w:lsc_diagnostic_matches')
let w:lsc_diagnostic_matches = []
endif
for current_match in w:lsc_diagnostic_matches
call matchdelete(current_match)
endfor
let w:lsc_diagnostic_matches = []
for diagnostic in a:diagnostics
if diagnostic.severity == 1
let group = 'lscDiagnosticError'
elseif diagnostic.severity == 2
let group = 'lscDiagnosticWarning'
elseif diagnostic.severity == 3
let group = 'lscDiagnosticInfo'
elseif diagnostic.severity == 4
let group = 'lscDiagnosticHint'
endif
call add(w:lsc_diagnostic_matches, matchaddpos(group, [diagnostic.range]))
endfor
endfunction
| "if exists("g:loaded_lsc")
" finish
"endif
"let g:loaded_lsc = 1
" Diagnostics {{{1
" Highlight groups {{{2
if !hlexists('lscDiagnosticError')
highlight link lscDiagnosticError Error
endif
if !hlexists('lscDiagnosticWarning')
highlight link lscDiagnosticWarning SpellBad
endif
if !hlexists('lscDiagnosticInfo')
highlight link lscDiagnosticInfo SpellBad
endif
if !hlexists('lscDiagnosticHint')
highlight link lscDiagnosticHint SpellBad
endif
" HighlightDiagnostics {{{2
"
" Adds a match to the a highlight group for each diagnostics severity level.
"
" diagnostics: A list of dictionaries. Only the 'severity' and 'range' keys are
" used. See https://git.io/vXiUB
function! HighlightDiagnostics(diagnostics) abort
if !exists('w:lsc_diagnostic_matches')
let w:lsc_diagnostic_matches = []
endif
for current_match in w:lsc_diagnostic_matches
silent! call matchdelete(current_match)
endfor
let w:lsc_diagnostic_matches = []
for diagnostic in a:diagnostics
if diagnostic.severity == 1
let group = 'lscDiagnosticError'
elseif diagnostic.severity == 2
let group = 'lscDiagnosticWarning'
elseif diagnostic.severity == 3
let group = 'lscDiagnosticInfo'
elseif diagnostic.severity == 4
let group = 'lscDiagnosticHint'
endif
call add(w:lsc_diagnostic_matches, matchaddpos(group, [diagnostic.range]))
endfor
endfunction
|
Enable hybrid reduced colors for iterm2 beta | let g:yadr_disable_solarized_enhancements = 1
let g:hybrid_custom_term_colors = 0
let g:hybrid_reduced_contrast = 1
set background=dark
colorscheme hybrid
| let g:yadr_disable_solarized_enhancements = 1
let g:hybrid_custom_term_colors = 1
let g:hybrid_reduced_contrast = 1
set background=dark
colorscheme hybrid
|
Set Go tabstop to 4 | " increase max line length
setlocal textwidth=100
| " increase max line length
setlocal textwidth=100
setlocal shiftwidth=4 " set 'shift' size
setlocal softtabstop=4 " set 'tab' size during indent mode
setlocal tabstop=4 " set tab character size
|
Fix issue with theme update functions | let g:Pl#Mod#theme = []
function! Pl#Mod#UpdateTheme(theme) " {{{
let theme = a:theme
for mod in g:Pl#Mod#theme
" We have to loop through instead of using index() because some
" segments are lists!
let target_seg_idx = -1
for i in range(0, len(theme) - 1)
unlet! segment
let segment = theme[i]
if type(segment) == type(mod.target_segment) && segment == mod.target_segment
let target_seg_idx = i
break
endif
endfor
if mod.action == 'insert'
" Insert segment
if target_seg_idx != -1
call insert(theme, mod.new_segment, (mod.where == 'before' ? target_seg_idx : target_seg_idx + 1))
endif
elseif mod.action == 'remove'
" Remove segment
if target_seg_idx != -1
call remove(theme, target_seg_idx)
endif
endif
endfor
return theme
endfunction " }}}
| let g:Pl#Mod#theme = []
function! Pl#Mod#UpdateTheme(theme) " {{{
let theme = deepcopy(a:theme)
for mod in g:Pl#Mod#theme
" We have to loop through instead of using index() because some
" segments are lists!
let target_seg_idx = -1
for i in range(0, len(theme) - 1)
unlet! segment
let segment = theme[i]
if type(segment) == type(mod.target_segment) && segment == mod.target_segment
let target_seg_idx = i
break
endif
endfor
if mod.action == 'insert'
" Insert segment
if target_seg_idx != -1
call insert(theme, mod.new_segment, (mod.where == 'before' ? target_seg_idx : target_seg_idx + 1))
endif
elseif mod.action == 'remove'
" Remove segment
if target_seg_idx != -1
call remove(theme, target_seg_idx)
endif
endif
endfor
return theme
endfunction " }}}
|
Add key binding to save vim file as sudo | " Bindings
imap jj <Esc>
" Toggle spell check
nmap <silent> <leader>z :set spell!<CR>
" Start a search and replace for current word
map <Leader>rw :%s/\<<C-r><C-w>\>/
" Insert new line without going into insert mode
map <F9> O<Esc>
map <F8> o<Esc>
" map NERDtree shortcut
map <C-n> :NERDTreeToggle<CR>
" Run all specs
map <Leader>rsa :call Send_to_Tmux("bundle exec rspec spec\n")<CR>
" Run all specs/features
map <Leader>rsf :call Send_to_Tmux("bundle exec rspec spec/features\n")<CR>
map <F5> :setlocal spell! spelllang=en_us<cr>
imap <F5> <ESC> :setlocal spell! spelllang=en_us<cr>
| " Bindings
imap jj <Esc>
" Toggle spell check
nmap <silent> <leader>z :set spell!<CR>
" Start a search and replace for current word
map <Leader>rw :%s/\<<C-r><C-w>\>/
" Insert new line without going into insert mode
map <F9> O<Esc>
map <F8> o<Esc>
" map NERDtree shortcut
map <C-n> :NERDTreeToggle<CR>
" Run all specs
map <Leader>rsa :call Send_to_Tmux("bundle exec rspec spec\n")<CR>
" Run all specs/features
map <Leader>rsf :call Send_to_Tmux("bundle exec rspec spec/features\n")<CR>
map <F5> :setlocal spell! spelllang=en_us<cr>
imap <F5> <ESC> :setlocal spell! spelllang=en_us<cr>
map <Leader>sas :w !sudo tee %<CR>
|
Use PGP for GPG files | call plug#begin('~/.vim/plugged')
Plug 'chriskempson/base16-vim' " base16 themes
Plug 'tpope/vim-fugitive', {'for': []} " git <3
Plug 'scrooloose/syntastic' " syntax checking
Plug 'editorconfig/editorconfig-vim'
Plug 'ctrlpvim/ctrlp.vim' " fuzzy searching
Plug 'airblade/vim-gitgutter' " show what lines have changed when inside a git repo
Plug 'valloric/youcompleteme', {'do': './install.py --clang-completer'} " completion
Plug 'haya14busa/incsearch.vim' " a better insearch
Plug 'junegunn/vim-easy-align' " easy align text
Plug 'jamessan/vim-gnupg', {'for': []} " transparent editing of gpg files
Plug 'plasticboy/vim-markdown', {'for': 'markdown'} " Markdown vim mode
Plug 'mhinz/vim-startify' " the fancy start screen for vim
Plug 'tpope/vim-eunuch' " helpers for UNIX
Plug 'easymotion/vim-easymotion' " Vim motions on speed
" Add plugins to &runtimepath
call plug#end()
| call plug#begin('~/.vim/plugged')
Plug 'chriskempson/base16-vim' " base16 themes
Plug 'tpope/vim-fugitive', {'for': []} " git <3
Plug 'scrooloose/syntastic' " syntax checking
Plug 'editorconfig/editorconfig-vim'
Plug 'ctrlpvim/ctrlp.vim' " fuzzy searching
Plug 'airblade/vim-gitgutter' " show what lines have changed when inside a git repo
Plug 'valloric/youcompleteme', {'do': './install.py --clang-completer'} " completion
Plug 'haya14busa/incsearch.vim' " a better insearch
Plug 'junegunn/vim-easy-align' " easy align text
Plug 'jamessan/vim-gnupg' " transparent editing of gpg files
Plug 'plasticboy/vim-markdown', {'for': 'markdown'} " Markdown vim mode
Plug 'mhinz/vim-startify' " the fancy start screen for vim
Plug 'tpope/vim-eunuch' " helpers for UNIX
Plug 'easymotion/vim-easymotion' " Vim motions on speed
" Add plugins to &runtimepath
call plug#end()
|
Update Copy maps to work in more modes. | " Bind Ctrl-S to update.
nnoremap <silent> <C-S> :<C-U>update<CR>
" Close the buffer but not the window.
nnoremap <silent> <C-W> :<C-U>BD<CR>
" Clear highlighting until next search.
nnoremap <silent> <C-I> :<C-U>nohlsearch<CR>
" Toggle highlighting.
nnoremap <silent> <leader>h :<C-U>set hlsearch!<CR>
" Copy to system clipboard.
nnoremap <leader>c "+y
nnoremap <leader>cc "+yy
nnoremap <silent> <leader>ca :<C-U>%y+<CR>
" Paste from system clipboard.
nnoremap <leader>p "+p
nnoremap <leader>P "+P
| " Bind Ctrl-S to update.
nnoremap <silent> <C-S> :<C-U>update<CR>
" Close the buffer but not the window.
nnoremap <silent> <C-W> :<C-U>BD<CR>
" Clear highlighting until next search.
nnoremap <silent> <C-I> :<C-U>nohlsearch<CR>
" Toggle highlighting.
nnoremap <silent> <leader>h :<C-U>set hlsearch!<CR>
" Copy to system clipboard.
map <leader>c "+y
map <leader>cc "+yy
map <silent> <leader>ca :<C-U>%y+<CR>
" Paste from system clipboard.
nnoremap <leader>p "+p
nnoremap <leader>P "+P
|
Format Ruby files with prettier | let b:ale_fixers = ['remove_trailing_lines', 'rubocop', 'trim_whitespace']
| let b:ale_fixers = ['remove_trailing_lines', 'rubocop', 'trim_whitespace']
augroup Prettier
autocmd!
if get(g:, 'prettier#autoformat')
autocmd BufWritePre *.ruby call prettier#Autoformat()
endif
augroup end
|
Use four spaces for indentation in TSX files | " JavaScript
autocmd FileType javascript.jsx set shiftwidth=4
" TypeScript
autocmd FileType typescript set shiftwidth=4
" JSON
autocmd FileType json set shiftwidth=4
| " JavaScript
autocmd FileType javascript.jsx set shiftwidth=4
" TypeScript
autocmd FileType typescript set shiftwidth=4
autocmd FileType typescript.tsx set shiftwidth=4
" JSON
autocmd FileType json set shiftwidth=4
|
Set position to 0,0 for git commits | " My filetypes
if exists("did_load_filetypes")
finish
endif
augroup filetypedetect
autocmd BufNewFile,BufRead *.shlib set filetype=sh
autocmd BufNewFile,BufRead *.json set filetype=json
autocmd BufNewFile,BufRead Jamfile,Jamroot,*.jam set filetype=jam
autocmd BufNewFile,BufRead *.bb,*.inc,*.conf set filetype=bitbake
autocmd BufNewFile,BufRead *.ino set filetype=c
autocmd BufNewFile,BufRead *.tpp set filetype=cpp
autocmd BufNewFile,BufRead CMakeLists.txt set filetype=cmake
augroup END
| " My filetypes
if exists("did_load_filetypes")
finish
endif
augroup filetypedetect
autocmd BufNewFile,BufRead *.shlib set filetype=sh
autocmd BufNewFile,BufRead *.json set filetype=json
autocmd BufNewFile,BufRead Jamfile,Jamroot,*.jam set filetype=jam
autocmd BufNewFile,BufRead *.bb,*.inc,*.conf set filetype=bitbake
autocmd BufNewFile,BufRead *.ino set filetype=c
autocmd BufNewFile,BufRead *.tpp set filetype=cpp
autocmd BufNewFile,BufRead CMakeLists.txt set filetype=cmake
autocmd BufEnter COMMIT_EDITMSG set filetype=gitcommit
autocmd BufEnter git-rebase-todo call setpos('.', [0, 1, 1, 0])
augroup END
|
Upgrade to new vim-fugitive syntax | " This callback will be executed when the entire command is completed
function! OnPushed(channel)
unlet g:asyncPushOutput
" clear status line
echo ""
endfunction
function! AsyncPush()
" Make sure we're running VIM version 8 or higher.
if v:version < 800
echoerr 'asyncPush requires VIM version 8 or higher'
return
endif
if exists('g:asyncPushOutput')
echo 'Already running task in background'
else
echo 'pushing changes…'
" Launch the job.
" Notice that we're only capturing out, and not err here. This is because, for some reason, the callback
" will not actually get hit if we write err out to the same file. Not sure if I'm doing this wrong or?
let g:asyncPushOutput = tempname()
call job_start('git push', {'close_cb': 'OnPushed', 'out_io': 'file', 'out_name': g:asyncPushOutput})
endif
endfunction
:command! -buffer W execute "silent Gwrite | silent Gcommit -a -m 'update'" | call AsyncPush()
:command! -buffer WQ execute "Gwrite | Gcommit -a -m 'update'" | Gpush | q
| " This callback will be executed when the entire command is completed
function! OnPushed(channel)
unlet g:asyncPushOutput
" clear status line
echo ""
endfunction
function! AsyncPush()
" Make sure we're running VIM version 8 or higher.
if v:version < 800
echoerr 'asyncPush requires VIM version 8 or higher'
return
endif
if exists('g:asyncPushOutput')
echo 'Already running task in background'
else
echo 'pushing changes…'
" Launch the job.
" Notice that we're only capturing out, and not err here. This is because, for some reason, the callback
" will not actually get hit if we write err out to the same file. Not sure if I'm doing this wrong or?
let g:asyncPushOutput = tempname()
call job_start('git push', {'close_cb': 'OnPushed', 'out_io': 'file', 'out_name': g:asyncPushOutput})
endif
endfunction
:command! -buffer W execute "silent Gwrite | silent Git commit -a -m 'update'" | call AsyncPush()
:command! -buffer WQ execute "Gwrite | Git commit -a -m 'update'" | Gpush | q
|
Add a missing scriptencoding line | " Author: Peter Renström <renstrom.peter@gmail.com>
" Description: Fixing C/C++ files with clang-format.
call ale#Set('c_clangformat_executable', 'clang-format')
call ale#Set('c_clangformat_use_global', 0)
call ale#Set('c_clangformat_options', '')
function! ale#fixers#clangformat#GetExecutable(buffer) abort
return ale#node#FindExecutable(a:buffer, 'c_clangformat', [
\ 'clang-format',
\])
endfunction
function! ale#fixers#clangformat#Fix(buffer) abort
let l:options = ale#Var(a:buffer, 'c_clangformat_options')
return {
\ 'command': ale#Escape(ale#fixers#clangformat#GetExecutable(a:buffer))
\ . ' ' . l:options,
\}
endfunction
| scriptencoding utf-8
" Author: Peter Renström <renstrom.peter@gmail.com>
" Description: Fixing C/C++ files with clang-format.
call ale#Set('c_clangformat_executable', 'clang-format')
call ale#Set('c_clangformat_use_global', 0)
call ale#Set('c_clangformat_options', '')
function! ale#fixers#clangformat#GetExecutable(buffer) abort
return ale#node#FindExecutable(a:buffer, 'c_clangformat', [
\ 'clang-format',
\])
endfunction
function! ale#fixers#clangformat#Fix(buffer) abort
let l:options = ale#Var(a:buffer, 'c_clangformat_options')
return {
\ 'command': ale#Escape(ale#fixers#clangformat#GetExecutable(a:buffer))
\ . ' ' . l:options,
\}
endfunction
|
Build to HTML from Vim with :make | " Set up Vim to edit Katasemeion biblical text files
" Author: Kazark
if exists("b:did_ftplugin")
finish
endif
let b:did_ftplugin = 1
let s:save_cpo = &cpo
set cpo&vim
setlocal textwidth=80
setlocal spell
" Disable automatic comment continuations to the next line... doesn't apply
" here and could make Vim insert unnecessary characters
setlocal formatoptions-=c
setlocal formatoptions-=o
setlocal formatoptions-=q
setlocal formatoptions-=r
setlocal comments-=:%
let &cpo = s:save_cpo
| " Set up Vim to edit Katasemeion biblical text files
" Author: Kazark
if exists("b:did_ftplugin")
finish
endif
let b:did_ftplugin = 1
let s:save_cpo = &cpo
set cpo&vim
setlocal textwidth=80
setlocal spell
" Disable automatic comment continuations to the next line... doesn't apply
" here and could make Vim insert unnecessary characters
setlocal formatoptions-=c
setlocal formatoptions-=o
setlocal formatoptions-=q
setlocal formatoptions-=r
setlocal comments-=:%
" Build to HTML with :make
let &l:makeprg="katasemeion " . expand('%') . " > output/" . expand('%:t:r') . ".html"
let &cpo = s:save_cpo
|
Use Intero for go to definition | " Autocompletion via neco-ghc
let g:haskellmode_completion_ghc = 0
setlocal omnifunc=necoghc#omnifunc
nnoremap <buffer> <silent> <F8> :wa<CR>:NeomakeProject stackbuild<CR>
" ghc-mod mappings
nnoremap <silent> <leader>ht :GhcModType!<CR>
nnoremap <silent> <leader>hI :GhcModTypeInsert!<CR>
nnoremap <silent> <leader>hl :GhcModTypeClear<CR>
nnoremap <silent> <leader>hi :GhcModInfo!<CR>
" Auto-sort imports
autocmd BufWritePre <buffer> HaskellSortImport
| " Autocompletion via neco-ghc
let g:haskellmode_completion_ghc = 0
setlocal omnifunc=necoghc#omnifunc
nnoremap <buffer> <silent> <F8> :wa<CR>:NeomakeProject stackbuild<CR>
" ghc-mod mappings
nnoremap <silent> <leader>ht :GhcModType!<CR>
nnoremap <silent> <leader>hI :GhcModTypeInsert!<CR>
nnoremap <silent> <leader>hl :GhcModTypeClear<CR>
nnoremap <silent> <leader>hi :GhcModInfo!<CR>
" Replace tags with Intero
nnoremap <silent> <C-]> :InteroGoToDef<CR>
" Auto-sort imports
autocmd BufWritePre <buffer> HaskellSortImport
|
Add abbreviation for JOb -> Job | inoremap <buffer> --- —
inoremap <buffer> -- –
setlocal textwidth=80
setlocal colorcolumn=80
setlocal formatoptions+=n " Recognize numbered lists
setlocal nojoinspaces
setlocal spell
" Some keyboards are inclined to this
iabbrev SOn Son
iabbrev GOd God
iabbrev ANd And
iabbrev FOr For
iabbrev HIm Him
| inoremap <buffer> --- —
inoremap <buffer> -- –
setlocal textwidth=80
setlocal colorcolumn=80
setlocal formatoptions+=n " Recognize numbered lists
setlocal nojoinspaces
setlocal spell
" Some keyboards are inclined to this
iabbrev SOn Son
iabbrev GOd God
iabbrev ANd And
iabbrev FOr For
iabbrev HIm Him
iabbrev JOb Job
iabbrev OUr Our
|
Add FZF command to search git files | " FUNCTIONS {{{
" fuzzy serach buffers
command! FZFBuffers call fzf#run({
\ 'source': BuffersList(),
\ 'sink': 'e ',
\ 'tmux_height': '30%'
\})
" fuzzy search most recently opened files
command! FZFMru call fzf#run({
\'source': v:oldfiles,
\'sink' : 'e ',
\ 'tmux_height': '30%'
\})
" }}}
" SETTINGS {{{
" }}}
" MAPPINGS {{{
nnoremap <leader>f :FZF<cr>
nnoremap <leader>fb :FZFBuffers<cr>
nnoremap <leader>fm :FZFMru<cr>
" }}}
| " FUNCTIONS {{{
" fuzzy serach buffers
command! FZFBuffers call fzf#run({
\ 'source': BuffersList(),
\ 'sink': 'e ',
\ 'tmux_height': '30%'
\})
" fuzzy search most recently opened files
command! FZFMru call fzf#run({
\'source': v:oldfiles,
\'sink' : 'e ',
\ 'tmux_height': '30%'
\})
function! FZFGit()
" Remove trailing new line to make it work with tmux splits
let directory = substitute(system('git rev-parse --show-toplevel'), '\n$', '', '')
if !v:shell_error
call fzf#run({'sink': 'e', 'dir': directory, 'source': 'git ls-files', 'tmux_height': '40%'})
else
FZF
endif
endfunction
command! FZFGit call FZFGit()
" }}}
" SETTINGS {{{
" }}}
" MAPPINGS {{{
nnoremap <leader>f :FZF<cr>
nnoremap <leader>fg :FZFGit<cr>
nnoremap <leader>fb :FZFBuffers<cr>
nnoremap <leader>fm :FZFMru<cr>
" }}}
|
Add completion regex for Clojure | let g:rainbow_active = 1
let g:clojure_special_indent_words = 'deftype,defrecord,reify,proxy,extend-type,extend-protocol,letfn,defcomponent'
setlocal lispwords+=go-loop
| let g:rainbow_active = 1
let g:clojure_special_indent_words = 'deftype,defrecord,reify,proxy,extend-type,extend-protocol,letfn,defcomponent'
setlocal lispwords+=go-loop
let g:deoplete#keyword_patterns = {}
let g:deoplete#keyword_patterns.clojure = '[\w!$%&*+/:<=>?@\^_~\-\.#]*'
|
Add Redir command for saving command output in scratch window | function! ChompedSystem( ... )
return substitute(call('system', a:000), '\n\+$', '', '')
endfunction
| function! ChompedSystem( ... )
return substitute(call('system', a:000), '\n\+$', '', '')
endfunction
" Redirect the output of a Vim or external command into a scratch buffer
function! Redir(cmd) abort
let output = execute(a:cmd)
vnew
let w:scratch = 1
setlocal buftype=nofile bufhidden=wipe nobuflisted noswapfile
call setline(1, split(output, "\n"))
endfunction
command! -nargs=1 Redir silent call Redir(<q-args>)
|
Revert "vim: Maintain VISUAL selection while indenting/dedenting" | " Visual mode mappings.
" Move between windows.
xnoremap <C-h> <C-w>h
xnoremap <C-j> <C-w>j
xnoremap <C-k> <C-w>k
xnoremap <C-l> <C-w>l
" Move VISUAL LINE selection within buffer.
xnoremap <silent> K :call wincent#mappings#visual#move_up()<CR>
xnoremap <silent> J :call wincent#mappings#visual#move_down()<CR>
xnoremap < <gv
xnoremap > >gv
| " Visual mode mappings.
" Move between windows.
xnoremap <C-h> <C-w>h
xnoremap <C-j> <C-w>j
xnoremap <C-k> <C-w>k
xnoremap <C-l> <C-w>l
" Move VISUAL LINE selection within buffer.
xnoremap <silent> K :call wincent#mappings#visual#move_up()<CR>
xnoremap <silent> J :call wincent#mappings#visual#move_down()<CR>
|
Replace grepprg with ag if it exists | " Ignore case if search pattern is all lowercase, case-sensitive otherwise
set smartcase
" Ignore case when searching
set ignorecase
" Highlight search terms
set hlsearch
" Show search matches as you type
set incsearch
" Use Ack instead of grep
set grepprg=ack
" ==========================================
" Search in project/directory
" Search current word in project/directory
" With or without word boundaries
function! SearchInProject()
let word = expand("<cword>")
let @/=word
set hls
exec "Ag " . word
endfunction
function! SearchWordInProject()
let word = expand("<cword>")
let @/='\<' . word . '\>'
set hls
exec "Ag '\\b" . word . "\\b'"
endfunction
| " Ignore case if search pattern is all lowercase, case-sensitive otherwise
set smartcase
" Ignore case when searching
set ignorecase
" Highlight search terms
set hlsearch
" Show search matches as you type
set incsearch
" ==========================================
" Search in project/directory
" Search current word in project/directory
" With or without word boundaries
function! SearchInProject()
let word = expand("<cword>")
let @/=word
set hls
exec "Ag " . word
endfunction
function! SearchWordInProject()
let word = expand("<cword>")
let @/='\<' . word . '\>'
set hls
exec "Ag '\\b" . word . "\\b'"
endfunction
if executable('ag')
" Note we extract the column as well as the file and line number
set grepprg=ag\ --nogroup\ --nocolor\ --column
set grepformat=%f:%l:%c%m
endif
|
Set foldin method to syntax | """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Folding Settings
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set foldenable " Enable folding
set foldlevelstart=10 " Open most folds by default
set foldnestmax=10 " TOO MANY FOLDS D=<
| """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Folding Settings
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set foldenable " Enable folding
set foldlevelstart=10 " Open most folds by default
set foldnestmax=10 " TOO MANY FOLDS D=<
set foldmethod=syntax
|
Add bb shortcut in vim | " How to: Type the letters then hit space
" General
iabbrev fsl # frozen_string_literal: true
" debugging
iabbrev bpry binding.pry
iabbrev bpid binding.pry if Rails.env.development?
iabbrev bpit binding.pry if Rails.env.test?
iabbrev brp binding.remote_pry
iabbrev brpid binding.remote_pry if Rails.env.development?
iabbrev brpit binding.remote.pry if Rails.env.test?
" RSpec
iabbrev af :aggregate_failures
| " How to: Type the letters then hit space
" General
iabbrev fsl # frozen_string_literal: true
" pry
iabbrev bpry binding.pry
iabbrev bpid binding.pry if Rails.env.development?
iabbrev bpit binding.pry if Rails.env.test?
iabbrev brp binding.remote_pry
iabbrev brpid binding.remote_pry if Rails.env.development?
iabbrev brpit binding.remote.pry if Rails.env.test?
" byebug
iabbrev bb byebug
" RSpec
iabbrev af :aggregate_failures
|
Add heading operator mappings for Markdown | " Vim filetype plugin
" Language Markdown
" Maintainer Ben Knoble <ben.knoble@gmail.com>
" Wrap at 80 characters
setlocal textwidth=80
" Spell check on
setlocal spell spelllang=en_us
function! UnderlineHeading(level)
if a:level == 1
normal! yypVr=
elseif a:level == 2
normal! yypVr-
else
execute "normal! I### "
endif
endfunction
nnoremap <LocalLeader>u1 :call UnderlineHeading(1)<CR>
nnoremap <LocalLeader>u2 :call UnderlineHeading(2)<CR>
nnoremap <LocalLeader>u3 :call UnderlineHeading(3)<CR>
| " Vim filetype plugin
" Language Markdown
" Maintainer Ben Knoble <ben.knoble@gmail.com>
" Wrap at 80 characters
setlocal textwidth=80
" Spell check on
setlocal spell spelllang=en_us
function! UnderlineHeading(level)
if a:level == 1
normal! yypVr=
elseif a:level == 2
normal! yypVr-
else
execute "normal! I### "
endif
endfunction
nnoremap <LocalLeader>u1 :call UnderlineHeading(1)<CR>
nnoremap <LocalLeader>u2 :call UnderlineHeading(2)<CR>
nnoremap <LocalLeader>u3 :call UnderlineHeading(3)<CR>
onoremap <buffer> ih= :<C-u>execute "normal! ?^==\\+$\r:nohlsearch\rkvg_"<CR>
onoremap <buffer> ih- :<C-u>execute "normal! ?^--\\+$\r:nohlsearch\rkvg_"<CR>
onoremap <buffer> i#1 :<C-u>execute "normal! ?^#\\s.?e\r:nohlsearch\rvg_"<CR>
onoremap <buffer> i#2 :<C-u>execute "normal! ?^##\\s.?e\r:nohlsearch\rvg_"<CR>
onoremap <buffer> i#3 :<C-u>execute "normal! ?^###\\s.?e\r:nohlsearch\rvg_"<CR>
|
Add rehash command for vim | function! KillTrailingWhitespace(lines) " Kill trailing whitespace/lines.
let l:search = @/
let l:view = winsaveview()
%s/\s\+$//e
if a:lines
%s/\($\n\s*\)\+\%$//e
endif
let @/ = l:search
call winrestview(l:view)
endfunction
" kill trailing whitespace (bang for lines)
command! -bang -nargs=* KillTrailingWhitespace call KillTrailingWhitespace(<bang>0)
" ripgrep
command! -bang -nargs=* Rg call fzf#vim#grep('rg --column --line-number --no-heading --color=always '.shellescape(<q-args>).'| tr -d "\017"', 1, <bang>0)
| function! KillTrailingWhitespace(lines) " Kill trailing whitespace/lines.
let l:search = @/
let l:view = winsaveview()
execute '%s/\s\+$//e'
if a:lines
execute '%s/\($\n\s*\)\+\%$//e'
endif
let @/ = l:search
call winrestview(l:view)
endfunction
" kill trailing whitespace (bang for lines)
command! -bang -nargs=* KillTrailingWhitespace call KillTrailingWhitespace(<bang>0)
" rehash configuration
command! -bang -nargs=* Rehash terminal fresh; nvr -c 'source \$MYVIMRC' -c Sayonara
" ripgrep
command! -bang -nargs=* Rg call fzf#vim#grep('rg --column --line-number --no-heading --color=always '.shellescape(<q-args>).'| tr -d "\017"', 1, <bang>0)
|
Indent on newline in interpolation function argument | if exists("b:did_indent")
finish
endif
let b:did_indent = 1
setlocal nolisp
setlocal autoindent
setlocal indentexpr=TerraformIndent(v:lnum)
setlocal indentkeys+=<:>,0=},0=)
if exists("*TerraformIndent")
finish
endif
function! TerraformIndent(lnum)
" previous non-blank line
let prevlnum = prevnonblank(a:lnum-1)
" beginning of file?
if prevlnum == 0
return 0
endif
" previous line without comments
let prevline = substitute(getline(prevlnum), '//.*$', '', '')
let previndent = indent(prevlnum)
let thisindent = previndent
" block open?
if prevline =~ '[\[{]\s*$'
let thisindent += &sw
endif
" current line without comments
let thisline = substitute(getline(a:lnum), '//.*$', '', '')
" block close?
if thisline =~ '^\s*[\]}]'
let thisindent -= &sw
endif
return thisindent
endfunction
| if exists("b:did_indent")
finish
endif
let b:did_indent = 1
setlocal nolisp
setlocal autoindent
setlocal indentexpr=TerraformIndent(v:lnum)
setlocal indentkeys+=<:>,0=},0=)
if exists("*TerraformIndent")
finish
endif
function! TerraformIndent(lnum)
" previous non-blank line
let prevlnum = prevnonblank(a:lnum-1)
" beginning of file?
if prevlnum == 0
return 0
endif
" previous line without comments
let prevline = substitute(getline(prevlnum), '//.*$', '', '')
let previndent = indent(prevlnum)
let thisindent = previndent
" block open?
if prevline =~ '[\[{\(]\s*$'
let thisindent += &sw
endif
" current line without comments
let thisline = substitute(getline(a:lnum), '//.*$', '', '')
" block close?
if thisline =~ '^\s*[\)\]}]'
let thisindent -= &sw
endif
return thisindent
endfunction
|
Add config for .twig files | set number
set list
set colorcolumn=81
au BufRead,BufNewFile *.tsx setfiletype typescript
au BufRead,BufNewFile *.ts setfiletype typescript
autocmd Filetype typescript setlocal expandtab
autocmd Filetype typescript setlocal tabstop=2
autocmd Filetype typescript setlocal shiftwidth=2
au BufRead,BufNewFile *.yml setfiletype yaml
au BufRead,BufNewFile *.yml setfiletype yaml
autocmd Filetype yaml setlocal expandtab
autocmd Filetype yaml setlocal tabstop=2
autocmd Filetype yaml setlocal shiftwidth=2
| set number
set list
set colorcolumn=81
au BufRead,BufNewFile *.tsx setfiletype typescript
au BufRead,BufNewFile *.ts setfiletype typescript
autocmd Filetype typescript setlocal expandtab
autocmd Filetype typescript setlocal tabstop=2
autocmd Filetype typescript setlocal shiftwidth=2
au BufRead,BufNewFile *.yml setfiletype yaml
au BufRead,BufNewFile *.yml setfiletype yaml
autocmd Filetype yaml setlocal expandtab
autocmd Filetype yaml setlocal tabstop=2
autocmd Filetype yaml setlocal shiftwidth=2
au BufRead,BufNewFile *.twig setfiletype twig
autocmd Filetype twig setlocal expandtab
autocmd Filetype twig setlocal tabstop=2
autocmd Filetype twig setlocal shiftwidth=2
|
Update the wildignore variables to be more generic |
" Ignore retarded directories
set wildignore+=build/*
set wildignore+=public/build/*
set wildignore+=exam/*
set wildignore+=*.pyc
let g:CommandTCancelMap=['<ESC>','<C-c>']
let g:CommandTMaxFiles=999999
let g:CommandTMaxDepth=999999
let g:CommandTMaxCachedDirectories=10
let g:CommandTTraverseSCM="pwd"
|
" Ignore retarded directories
set wildignore+=**/bower_components/**
set wildignore+=**/node_modules/**
set wildignore+=**/build/**
set wildignore+=*.pyc
let g:CommandTCancelMap=['<ESC>','<C-c>']
let g:CommandTMaxFiles=999999
let g:CommandTMaxDepth=999999
let g:CommandTMaxCachedDirectories=10
let g:CommandTTraverseSCM="pwd"
|
Remove base16-vim. A color scheme that's not used. Remove vim-markdown. Performance issues with large files. Added vim-fugitive. Git integration. | " Vundle
set nocompatible
filetype off
set rtp+=~/.config/nvim/bundle/Vundle.vim
call vundle#begin()
Plugin 'VundleVim/Vundle.vim'
Plugin 'chriskempson/base16-vim'
Plugin 'ervandew/supertab'
Plugin 'kien/ctrlp.vim'
Plugin 'scrooloose/syntastic'
Plugin 'tpope/vim-commentary'
Plugin 'tpope/vim-markdown'
Plugin 'lilydjwg/colorizer'
Plugin 'vim-ruby/vim-ruby'
Plugin 'tpope/vim-rails'
Plugin 'sjl/badwolf'
call vundle#end()
let g:syntastic_always_populate_loc_list = 1
let g:syntastic_auto_loc_list = 1
let g:syntastic_check_on_open = 1
let g:syntastic_check_on_wq = 0
let g:ctrlp_show_hidden = 1
let g:ctrlp_custom_ignore = {
\ 'dir': '\v[\/]\.(git|hg|svn)$',
\ 'file': '\v\.(exe|so|dll|DS_Store|Trash)$',
\ 'link': 'SOME_BAD_SYMBOLIC_LINKS'
\ }
| " Vundle
set nocompatible
filetype off
set rtp+=~/.config/nvim/bundle/Vundle.vim
call vundle#begin()
Plugin 'VundleVim/Vundle.vim'
Plugin 'ervandew/supertab'
Plugin 'kien/ctrlp.vim'
Plugin 'scrooloose/syntastic'
Plugin 'tpope/vim-commentary'
Plugin 'lilydjwg/colorizer'
Plugin 'vim-ruby/vim-ruby'
Plugin 'tpope/vim-rails'
Plugin 'tpope/vim-fugitive'
Plugin 'sjl/badwolf'
call vundle#end()
let g:syntastic_always_populate_loc_list = 1
let g:syntastic_auto_loc_list = 1
let g:syntastic_check_on_open = 1
let g:syntastic_check_on_wq = 0
let g:ctrlp_show_hidden = 1
let g:ctrlp_custom_ignore = {
\ 'dir': '\v[\/]\.(git|hg|svn)$',
\ 'file': '\v\.(exe|so|dll|DS_Store|Trash)$',
\ 'link': 'SOME_BAD_SYMBOLIC_LINKS'
\ }
|
Add line numbers to Vim. | " Personal vim configuration.
" Maintainer: Lorenzo Cabrini <lorenzo.cabrini@gmail.com>
" General options
set nocompatible
set backspace=indent,eol,start
set showcmd
set showmatch
set incsearch
set autowrite
set hidden
set history=50
set ruler
" Tabs and spaces
set tabstop=8
set expandtab
set shiftwidth=4
set softtabstop=4
" Settings for color terminals and in the GUI.
if &t_Co > 2 || has("gui_running")
syntax on
set background=dark
colorscheme elflord
set hlsearch
endif
" Enable filetype plugins
if has("autocmd")
filetype plugin indent on
endif
" If lightline is installed
if isdirectory($HOME . "/.vim/pack/default/start/lightline.vim")
set laststatus=2
set noshowmode
endif
| " Personal vim configuration.
" Maintainer: Lorenzo Cabrini <lorenzo.cabrini@gmail.com>
" General options
set nocompatible
set backspace=indent,eol,start
set showcmd
set showmatch
set incsearch
set autowrite
set hidden
set history=50
set ruler
set number
" Tabs and spaces
set tabstop=8
set expandtab
set shiftwidth=4
set softtabstop=4
" Settings for color terminals and in the GUI.
if &t_Co > 2 || has("gui_running")
syntax on
set background=dark
colorscheme elflord
set hlsearch
endif
" Enable filetype plugins
if has("autocmd")
filetype plugin indent on
endif
" If lightline is installed
if isdirectory($HOME . "/.vim/pack/default/start/lightline.vim")
set laststatus=2
set noshowmode
endif
|
Add supertab to vim config | " ===============================
" Setup:
" Include following line in ~/.vimrc:
" source $PATH_TO_HERE/vim_config.vim
" Then run:
" git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
" vim +PluginInstall +qall
" ================================
" Vundle config
"
set nocompatible
filetype off
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" let Vundle manage Vundle, required
Plugin 'gmarik/Vundle.vim'
" Plugins
Plugin 'jelera/vim-javascript-syntax'
Plugin 'pangloss/vim-javascript'
Plugin 'nathanaelkane/vim-indent-guides'
Plugin 'Raimondi/delimitMate'
" Color Schemes
Plugin 'Lokaltog/vim-distinguished'
" All of your Plugins must be added before the following line
call vundle#end() " required
filetype plugin indent on " required
" ================================
set t_Co=256
syntax on
set background=dark
colorscheme distinguished
set hlsearch
set expandtab
set shiftwidth=2
set softtabstop=2
set textwidth=80
set colorcolumn=+1
set nobackup
" Strip trailing whitespace from all files on save
autocmd BufWritePre * :%s/\s\+$//e
| " ===============================
" Setup:
" Include following line in ~/.vimrc:
" source $PATH_TO_HERE/vim_config.vim
" Then run:
" git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
" vim +PluginInstall +qall
" ================================
" Vundle config
"
set nocompatible
filetype off
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" let Vundle manage Vundle, required
Plugin 'gmarik/Vundle.vim'
" Plugins
Plugin 'jelera/vim-javascript-syntax'
Plugin 'pangloss/vim-javascript'
Plugin 'nathanaelkane/vim-indent-guides'
Plugin 'Raimondi/delimitMate'
Plugin 'ervandew/supertab'
" Color Schemes
Plugin 'Lokaltog/vim-distinguished'
" All of your Plugins must be added before the following line
call vundle#end() " required
filetype plugin indent on " required
" ================================
set t_Co=256
syntax on
set background=dark
colorscheme distinguished
set hlsearch
set incsearch
set expandtab
set shiftwidth=2
set softtabstop=2
set textwidth=80
set colorcolumn=+1
set nobackup
" Strip trailing whitespace from all files on save
autocmd BufWritePre * :%s/\s\+$//e
|
Switch to regular Tomorrow Night theme | set background=dark
silent! colorscheme base16-tomorrow
" Feel free to override the colorscheme by adding a line to ~/.vimrc.local
" such as the following:
"
" colorscheme solarized
| set background=dark
silent! colorscheme Tomorrow-Night
" Feel free to override the colorscheme by adding a line to ~/.vimrc.local
" such as the following:
"
" colorscheme solarized
|
Change comma to just <leader> | " Turn off default key mappings
let g:multi_cursor_use_default_mapping=0
" Switch to multicursor mode with ,mc
let g:multi_cursor_start_key=',mc'
" Ctrl-n, Ctrl-p, Ctrl-x, and <Esc> are mapped in the special multicursor
" mode once you've added at least one virtual cursor to the buffer
let g:multi_cursor_next_key='<C-n>'
let g:multi_cursor_prev_key='<C-p>'
let g:multi_cursor_skip_key='<C-x>'
let g:multi_cursor_quit_key='<Esc>'
| " Turn off default key mappings
let g:multi_cursor_use_default_mapping=0
" Switch to multicursor mode with ,mc
let g:multi_cursor_start_key='<leader>mc'
" Ctrl-n, Ctrl-p, Ctrl-x, and <Esc> are mapped in the special multicursor
" mode once you've added at least one virtual cursor to the buffer
let g:multi_cursor_next_key='<C-n>'
let g:multi_cursor_prev_key='<C-p>'
let g:multi_cursor_skip_key='<C-x>'
let g:multi_cursor_quit_key='<Esc>'
|
Remove some c family configurations | autocmd BufNewFile,BufRead *.cu set cindent
autocmd BufNewFile,BufRead *.cc,*.cpp,*.cu,*.h,*.hpp,*.c set ft=cpp.doxygen
set cinoptions=>s,e0,n0,f0,{0,}0,^0,L-1,:0,=s,l0,b0,g0,hs,N-s,ps,ts,is,+s,c3,C0,/0,(2s,us,U0,w0,W0,k0,m0,j0,J0,)20,*70,#0
nmap <Leader>k :tabe %<CR>g]
| set cinoptions=>s,e0,n0,f0,{0,}0,^0,L-1,:0,=s,l0,b0,g0,hs,N-s,ps,ts,is,+s,c3,C0,/0,(2s,us,U0,w0,W0,k0,m0,j0,J0,)20,*70,#0
|
Make Command-T wildignore a multiline string for easier addition of patterns in the future | " ------------------------------------------------------------------------------
" Command-T and related configuration
" ------------------------------------------------------------------------------
if &term =~ "xterm" || &term =~ "screen"
" Ensure Escape key can close the match listing in Command-T
let g:CommandTCancelMap = ['<ESC>', '<C-c>']
" Ensure <C-j> and <C-k> can move up and down a list of file matches
let g:CommandTSelectNextMap = ['<C-j>', '<ESC>OB']
let g:CommandTSelectPrevMap = ['<C-k>', '<ESC>OA']
endif
" It seems that using Command T with mvim isn't quite working with regards
" to ignoring all files under a specific folder that I would expect,
" so provide some extra specific config to do that ignoring.
let g:CommandTWildIgnore=&wildignore . ",*/deps,*/_build"
| " ------------------------------------------------------------------------------
" Command-T and related configuration
" ------------------------------------------------------------------------------
if &term =~ "xterm" || &term =~ "screen"
" Ensure Escape key can close the match listing in Command-T
let g:CommandTCancelMap = ['<ESC>', '<C-c>']
" Ensure <C-j> and <C-k> can move up and down a list of file matches
let g:CommandTSelectNextMap = ['<C-j>', '<ESC>OB']
let g:CommandTSelectPrevMap = ['<C-k>', '<ESC>OA']
endif
" It seems that using Command T with mvim isn't quite working with regards
" to ignoring all files under a specific folder that I would expect,
" so provide some extra specific config to do that ignoring.
let g:CommandTWildIgnore=&wildignore . "
\*/deps,
\*/_build,
\*/assets/node_modules
\"
|
Change terminal vim color scheme | set background=dark
colorscheme Tomorrow-Night-Blue
if !has("gui_running")
colorscheme desert
end
| set background=dark
colorscheme Tomorrow-Night-Blue
if !has("gui_running")
colorscheme Tomorrow-Night
end
|
Add '()' to call function. | let s:Vital = vital#of('autocomplete_swift')
let s:Http = s:Vital.import('Web.HTTP')
let s:Json = s:Vital.import('Web.JSON')
let s:command_name = 'sourcekittendaemon'
let s:host = 'localhost'
let s:port = -1
function! sourcekitten_daemon#complete(path, offset)
if sourcekitten_daemon#is_enabled() != 1
return []
endif
let l:response = s:Http.get(
\ s:address . '/complete',
\ {},
\ {
\ 'X-Offset': a:offset,
\ 'X-Path': a:path,
\ }
\)
if l:response.success != 1
return []
endif
return s:Json.decode(l:response.content)
endfunction
function! sourcekitten_daemon#enable(port)
let s:port = a:port
let s:address = 'http://' . s:host . ':' . s:port
endfunction
function! sourcekitten_daemon#disable()
let s:port = -1
endfunction
function! sourcekitten_daemon#is_executable()
return executable(s:command_name)
endfunction
function! sourcekitten_daemon#is_enabled()
return sourcekitten_daemon#port != -1
endfunction
function! sourcekitten_daemon#port()
return s:port
endfunction
| let s:Vital = vital#of('autocomplete_swift')
let s:Http = s:Vital.import('Web.HTTP')
let s:Json = s:Vital.import('Web.JSON')
let s:command_name = 'sourcekittendaemon'
let s:host = 'localhost'
let s:port = -1
function! sourcekitten_daemon#complete(path, offset)
if sourcekitten_daemon#is_enabled() != 1
return []
endif
let l:response = s:Http.get(
\ s:address . '/complete',
\ {},
\ {
\ 'X-Offset': a:offset,
\ 'X-Path': a:path,
\ }
\)
if l:response.success != 1
return []
endif
return s:Json.decode(l:response.content)
endfunction
function! sourcekitten_daemon#enable(port)
let s:port = a:port
let s:address = 'http://' . s:host . ':' . s:port
endfunction
function! sourcekitten_daemon#disable()
let s:port = -1
endfunction
function! sourcekitten_daemon#is_executable()
return executable(s:command_name)
endfunction
function! sourcekitten_daemon#is_enabled()
return sourcekitten_daemon#port() != -1
endfunction
function! sourcekitten_daemon#port()
return s:port
endfunction
|
Check if gui version of vim is running | " Rspec mappings
map <Leader>t :call RunCurrentSpecFile()<CR>
map <Leader>s :call RunNearestSpec()<CR>
map <Leader>l :call RunLastSpec()<CR>
let s:plugin_path = expand("<sfile>:p:h:h")
if has("gui_macvim")
let g:rspec_command = "silent !" . s:plugin_path . "/bin/run_in_os_x_terminal 'rspec {spec}'"
else
let g:rspec_command = "!echo rspec {spec} && rspec {spec}"
endif
function! RunCurrentSpecFile()
if InSpecFile()
let l:spec = @%
call SetLastSpecCommand(l:spec)
call RunSpecs(l:spec)
endif
endfunction
function! RunNearestSpec()
if InSpecFile()
let l:spec = @% . ":" . line(".")
call SetLastSpecCommand(l:spec)
call RunSpecs(l:spec)
endif
endfunction
function! RunLastSpec()
if exists("s:last_spec_command")
call RunSpecs(s:last_spec_command)
endif
endfunction
function! InSpecFile()
return match(expand("%"), "_spec.rb$") != -1
endfunction
function! SetLastSpecCommand(spec)
let s:last_spec_command = a:spec
endfunction
function! RunSpecs(spec)
write
execute substitute(g:rspec_command, "{spec}", a:spec, "g")
endfunction
| " Rspec mappings
map <Leader>t :call RunCurrentSpecFile()<CR>
map <Leader>s :call RunNearestSpec()<CR>
map <Leader>l :call RunLastSpec()<CR>
let s:plugin_path = expand("<sfile>:p:h:h")
if has("gui_running") && has("gui_macvim")
let g:rspec_command = "silent !" . s:plugin_path . "/bin/run_in_os_x_terminal 'rspec {spec}'"
else
let g:rspec_command = "!echo rspec {spec} && rspec {spec}"
endif
function! RunCurrentSpecFile()
if InSpecFile()
let l:spec = @%
call SetLastSpecCommand(l:spec)
call RunSpecs(l:spec)
endif
endfunction
function! RunNearestSpec()
if InSpecFile()
let l:spec = @% . ":" . line(".")
call SetLastSpecCommand(l:spec)
call RunSpecs(l:spec)
endif
endfunction
function! RunLastSpec()
if exists("s:last_spec_command")
call RunSpecs(s:last_spec_command)
endif
endfunction
function! InSpecFile()
return match(expand("%"), "_spec.rb$") != -1
endfunction
function! SetLastSpecCommand(spec)
let s:last_spec_command = a:spec
endfunction
function! RunSpecs(spec)
write
execute substitute(g:rspec_command, "{spec}", a:spec, "g")
endfunction
|
Update nvim config to use vim-sensible plugin | call plug#begin()
" Plugins
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
" Themes
Plug 'sickill/vim-monokai'
" Git
Plug 'airblade/vim-gitgutter'
call plug#end()
" Use UTF-8 encoding
set encoding=utf-8
" View line numbers
set number
" Configure vim-airline
let g:airline_theme='simple'
set laststatus=2
" Configure vim-monokai with syntax highlighting
syntax enable
colorscheme monokai
" Enable clipboard yanking
set clipboard+=unnamedplus
| call plug#begin()
" Plugins
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
" Themes
Plug 'sickill/vim-monokai'
" Git
Plug 'airblade/vim-gitgutter'
" Config
Plug 'tpope/vim-sensible'
call plug#end()
" View line numbers
set number
" Configure vim-airline
let g:airline_theme='simple'
" Configure vim-monokai with syntax highlighting
colorscheme monokai
" Enable clipboard yanking
set clipboard+=unnamedplus
|
Add delay to auto completion. | " don't give |ins-completion-menu| messages. For example,
" '-- XXX completion (YYY)', 'match 1 of 2', 'The only match',
set shortmess+=c
" Set up CSS/Sass completion.
au User CmSetup call cm#register_source({'name' : 'cm-css',
\ 'priority': 9,
\ 'scoping': 1,
\ 'scopes': ['css','scss'],
\ 'abbreviation': 'css',
\ 'cm_refresh_patterns':[':\s+\w*$'],
\ 'cm_refresh': {'omnifunc': 'csscomplete#CompleteCSS'},
\ })
| " don't give |ins-completion-menu| messages. For example,
" '-- XXX completion (YYY)', 'match 1 of 2', 'The only match',
set shortmess+=c
let g:cm_complete_delay = 400
" Set up CSS/Sass completion.
au User CmSetup call cm#register_source({'name' : 'cm-css',
\ 'priority': 9,
\ 'scoping': 1,
\ 'scopes': ['css','scss'],
\ 'abbreviation': 'css',
\ 'cm_refresh_patterns':[':\s+\w*$'],
\ 'cm_refresh': {'omnifunc': 'csscomplete#CompleteCSS'},
\ })
|
Allow images path to be modified as global variable | " vim-images.vim - Image pasting for vim
" Maintainer: Blake Taylor <http://blakefrost.com/>
" Version: 0.1
if exists("g:loaded_vimages") || &cp
finish
endif
let g:loaded_vimages = 1
let g:images_root = '/Users/blake/images/' "TODO: Inject this
function! s:warn(msg)
echohl WarningMsg
echomsg a:msg
echohl NONE
endfunction
function! vimages#PasteImage()
" Paste image from clipboard accroding to date/time
let date_path = strftime("%Y/%m/%d/")
let images_path = 'captures/' . date_path
let images_dir = g:images_root . images_path
let file = strftime("%T") . '.png'
" Make sure the directory exists
execute 'silent !mkdir -p ' . images_dir
execute "silent !pngpaste " . images_dir . file
" Test that the file exists
if filereadable(images_dir . file)
execute "normal a \<BS>".''
normal! 02l
startinsert!
else
echo "Couldn't paste image. perhaps no image data in clipboard?:"
endif
redraw!
endfunction
| " vim-images.vim - Image pasting for vim
" Maintainer: Blake Taylor <http://blakefrost.com/>
" Version: 0.1
if exists("g:loaded_vimages") || &cp
finish
endif
let g:loaded_vimages = 1
if !exists("g:images_root")
let g:images_root = expand('~/images/')
endif
function! s:warn(msg)
echohl WarningMsg
echomsg a:msg
echohl NONE
endfunction
function! vimages#PasteImage()
" Paste image from clipboard accroding to date/time
let date_path = strftime("%Y/%m/%d/")
let images_path = 'captures/' . date_path
let images_dir = g:images_root . images_path
let file = strftime("%T") . '.png'
" Make sure the directory exists
execute 'silent !mkdir -p ' . images_dir
execute "silent !pngpaste " . images_dir . file
" Test that the file exists
if filereadable(images_dir . file)
execute "normal a \<BS>".''
normal! 02l
startinsert!
else
echo "Couldn't paste image. perhaps no image data in clipboard?:"
endif
redraw!
endfunction
|
Set vim indent guide vars to defaults | let g:indent_guides_auto_colors = 1
let g:indent_guides_start_level = 2
let g:indent_guides_guide_size = 1
| let g:indent_guides_auto_colors = 1
let g:indent_guides_start_level = 1
let g:indent_guides_guide_size = 0
|
Add proper `yort` toggle for the buffer autocmds | set number " Show the line number of the line under the cursor
let g:relative_linenumbers = get(g:, 'relative_linenumbers', "1")
function! TurnOn()
if (g:relative_linenumbers == "1")
setlocal relativenumber
endif
endfunction
function! TurnOff()
if (g:relative_linenumbers == "1")
setlocal norelativenumber
endif
endfunction
" Auto toggle `relativenumber` when switching buffers
augroup vimrc_set_relativenumber_only_active_window
autocmd!
autocmd VimEnter,BufWinEnter,WinEnter * call TurnOn()
autocmd WinLeave * call TurnOff()
augroup END
| set number " Show the line number of the line under the cursor
let g:relative_linenumbers = get(g:, 'relative_linenumbers', "1")
nmap yort :call ToggleRelativeLineNumbers()<CR>
function! ToggleRelativeLineNumbers()
if (g:relative_linenumbers == "1")
let g:relative_linenumbers = 0
setlocal norelativenumber
else
let g:relative_linenumbers = 1
setlocal relativenumber
endif
endfunction
function! s:Enter()
if (g:relative_linenumbers == "1")
setlocal relativenumber
endif
endfunction
function! s:Leave()
if (g:relative_linenumbers == "1")
setlocal norelativenumber
endif
endfunction
" Auto toggle `relativenumber` when switching buffers
augroup vimrc_set_relativenumber_only_active_window
autocmd!
autocmd VimEnter,BufWinEnter,WinEnter * call s:Enter()
autocmd WinLeave * call s:Leave()
augroup END
|
Change default python version to 3 | if exists('g:loaded_pycheck')
finish
endif
let g:loaded_pycheck = 1
sign define pycheck_E text=E! texthl=Error
sign define pycheck_W text=W! texthl=Search
func s:CheckBuffer()
" create custom detection by writing to b:pycheck_version in ftplugin
let python_ver = exists('b:pycheck_version') ? b:pycheck_version : (exists('g:pycheck_default_version') ? g:pycheck_default_version : 2)
let shebang = getline(1)
if python_ver == 2
if shebang =~# '^#!.*\(python\|pypy\)3'
let python_ver = 3
endif
elseif python_ver == 3
if shebang =~# '^#!.*\(python\|pypy\)\(2\|\>\)'
let python_ver = 2
endif
endif
" for checking the used python version
let b:pycheck_detected_version = python_ver
if python_ver == 3
py3 import pycheck; pycheck.check_buffer()
else
py import pycheck; pycheck.check_buffer()
endif
endf
au BufWritePost *.py call s:CheckBuffer()
| if exists('g:loaded_pycheck')
finish
endif
let g:loaded_pycheck = 1
sign define pycheck_E text=E! texthl=Error
sign define pycheck_W text=W! texthl=WarningMsg
func s:CheckBuffer()
" create custom detection by writing to b:pycheck_version in ftplugin
let python_ver = exists('b:pycheck_version') ? b:pycheck_version : (exists('g:pycheck_default_version') ? g:pycheck_default_version : 3)
let shebang = getline(1)
if python_ver == 2
if shebang =~# '^#!.*\(python\|pypy\)3'
let python_ver = 3
endif
elseif python_ver == 3
if shebang =~# '^#!.*\(python\|pypy\)\(2\|\>\)'
let python_ver = 2
endif
endif
" for checking the used python version
let b:pycheck_detected_version = python_ver
if python_ver == 3
py3 import pycheck; pycheck.check_buffer()
else
py import pycheck; pycheck.check_buffer()
endif
endf
au BufWritePost *.py call s:CheckBuffer()
|
Add <leader>i shortcut for :ImportJSImportAll | if exists("g:import_js_loaded") || &cp
finish
endif
let g:import_js_loaded = 1
command ImportJSImport call importjs#ImportJSImport()
command ImportJSImportAll call importjs#ImportJSImportAll()
if !hasmapto(':ImportJSImport<CR>') && maparg('<Leader>j', 'n') == ''
silent! nnoremap <unique> <silent> <Leader>j :ImportJSImport<CR>
endif
| if exists("g:import_js_loaded") || &cp
finish
endif
let g:import_js_loaded = 1
command ImportJSImport call importjs#ImportJSImport()
command ImportJSImportAll call importjs#ImportJSImportAll()
if !hasmapto(':ImportJSImport<CR>') && maparg('<Leader>j', 'n') == ''
silent! nnoremap <unique> <silent> <Leader>j :ImportJSImport<CR>
endif
if !hasmapto(':ImportJSImportAll<CR>') && maparg('<Leader>i', 'n') == ''
silent! nnoremap <unique> <silent> <Leader>i :ImportJSImportAll<CR>
endif
|
Add commented out theme to use in sunlight | " Indentation with four spaces
set tabstop=4
set shiftwidth=4
set softtabstop=4
set expandtab
" Display errors nicely (and silently)
set noerrorbells
set novisualbell
hi clear SpellBad
hi SpellBad cterm=underline ctermfg=red
" Display search results nicely
hi Search ctermbg=red ctermfg=white
" Add line numbers
set relativenumber
set number
" Complain about trailing whitespace
set list
set list listchars=tab:→\ ,trail:·
" Glorious technicolour!
set termguicolors
colorscheme base16-materia-meshy
syntax on
let g:SignatureMarkTextHLDynamic = 1
let g:rainbow_active = 1
let g:rainbow_conf = {'separately': {'htmldjango': 0}}
" Add rulers to highlight overly long lines
set colorcolumn=80,88,100
" Visual feedback on autocompleted commands
set wmnu
" Set up vim-airline
set laststatus=2
let g:airline_powerline_fonts = 1
let g:airline_theme="base16"
| " Indentation with four spaces
set tabstop=4
set shiftwidth=4
set softtabstop=4
set expandtab
" Display errors nicely (and silently)
set noerrorbells
set novisualbell
hi clear SpellBad
hi SpellBad cterm=underline ctermfg=red
" Display search results nicely
hi Search ctermbg=red ctermfg=white
" Add line numbers
set relativenumber
set number
" Complain about trailing whitespace
set list
set list listchars=tab:→\ ,trail:·
" Glorious technicolour!
set termguicolors
colorscheme base16-materia-meshy
" colorscheme base16-mexico-light
syntax on
let g:SignatureMarkTextHLDynamic = 1
let g:rainbow_active = 1
let g:rainbow_conf = {'separately': {'htmldjango': 0}}
" Add rulers to highlight overly long lines
set colorcolumn=80,88,100
" Visual feedback on autocompleted commands
set wmnu
" Set up vim-airline
set laststatus=2
let g:airline_powerline_fonts = 1
let g:airline_theme="base16"
|
Remove grep current partial, doesn't work well | function! GetVisual()
let reg_save = getreg('"')
let regtype_save = getregtype('"')
let cb_save = &clipboard
set clipboard&
normal! ""gvy
let selection = getreg('"')
call setreg('"', reg_save, regtype_save)
let &clipboard = cb_save
return selection
endfunction
"grep the current word using K (mnemonic Kurrent)
nnoremap <silent> K :Ag <cword><CR>
"grep visual selection
vnoremap K :<C-U>execute "Ag " . GetVisual()<CR>
"grep current word up to the next exclamation point using ,K
nnoremap ,K viwf!:<C-U>execute "Ag " . GetVisual()<CR>
"grep for 'def foo'
nnoremap <silent> ,gd :Ag 'def <cword>'<CR>
",gg = Grep! - using Ag the silver searcher
" open up a grep line, with a quote started for the search
nnoremap ,gg :Ag ""<left>
"Grep Current Partial
function! AgCurrentPartial()
let l:fileNameWithoutExtension = expand('%:t:r')
let l:fileNameWithoutUnderscore = substitute(l:fileNameWithoutExtension, '^_','','g')
let l:grepPattern = "render.*[\\\'\\\"].*" . l:fileNameWithoutUnderscore . "[\\\'\\\"]$"
exec 'Ag "' . l:grepPattern . '"'
endfunction
command! AgCurrentPartial call AgCurrentPartial()
"
nnoremap ,gcp :AgCurrentPartial<CR>
"Grep for usages of the current file
nnoremap ,gcf :exec "Ag " . expand("%:t:r")<CR>
| function! GetVisual()
let reg_save = getreg('"')
let regtype_save = getregtype('"')
let cb_save = &clipboard
set clipboard&
normal! ""gvy
let selection = getreg('"')
call setreg('"', reg_save, regtype_save)
let &clipboard = cb_save
return selection
endfunction
"grep the current word using K (mnemonic Kurrent)
nnoremap <silent> K :Ag <cword><CR>
"grep visual selection
vnoremap K :<C-U>execute "Ag " . GetVisual()<CR>
"grep current word up to the next exclamation point using ,K
nnoremap ,K viwf!:<C-U>execute "Ag " . GetVisual()<CR>
"grep for 'def foo'
nnoremap <silent> ,gd :Ag 'def <cword>'<CR>
",gg = Grep! - using Ag the silver searcher
" open up a grep line, with a quote started for the search
nnoremap ,gg :Ag ""<left>
"Grep for usages of the current file
nnoremap ,gcf :exec "Ag " . expand("%:t:r")<CR>
|
Set comment string for yaml | " =========================================
" Commentary Settings
autocmd FileType tmux set commentstring=#\ %s
autocmd FileType moon set commentstring=--\ %s
autocmd FileType puppet set commentstring=#\ %s
autocmd FileType dockerfile set commentstring=#\ %s
autocmd FileType nginx set commentstring=#\ %s
autocmd FileType gitcommit set commentstring=#\ %s
| " =========================================
" Commentary Settings
autocmd FileType tmux set commentstring=#\ %s
autocmd FileType eruby.yaml set commentstring=#\ %s
autocmd FileType moon set commentstring=--\ %s
autocmd FileType puppet set commentstring=#\ %s
autocmd FileType dockerfile set commentstring=#\ %s
autocmd FileType nginx set commentstring=#\ %s
autocmd FileType gitcommit set commentstring=#\ %s
|
Set .tmpl files' syntax to gohtmltmpl. | " We take care to preserve the user's fileencodings and fileformats,
" because those settings are global (not buffer local), yet we want
" to override them for loading Go files, which are defined to be UTF-8.
let s:current_fileformats = ''
let s:current_fileencodings = ''
" define fileencodings to open as utf-8 encoding even if it's ascii.
function! s:gofiletype_pre()
let s:current_fileformats = &g:fileformats
let s:current_fileencodings = &g:fileencodings
set fileencodings=utf-8 fileformats=unix
setlocal filetype=go
endfunction
" restore fileencodings as others
function! s:gofiletype_post()
let &g:fileformats = s:current_fileformats
let &g:fileencodings = s:current_fileencodings
endfunction
au BufNewFile *.go setlocal filetype=go fileencoding=utf-8 fileformat=unix
au BufRead *.go call s:gofiletype_pre()
au BufReadPost *.go call s:gofiletype_post()
| " We take care to preserve the user's fileencodings and fileformats,
" because those settings are global (not buffer local), yet we want
" to override them for loading Go files, which are defined to be UTF-8.
let s:current_fileformats = ''
let s:current_fileencodings = ''
" define fileencodings to open as utf-8 encoding even if it's ascii.
function! s:gofiletype_pre()
let s:current_fileformats = &g:fileformats
let s:current_fileencodings = &g:fileencodings
set fileencodings=utf-8 fileformats=unix
setlocal filetype=go
endfunction
" restore fileencodings as others
function! s:gofiletype_post()
let &g:fileformats = s:current_fileformats
let &g:fileencodings = s:current_fileencodings
endfunction
au BufNewFile *.go setlocal filetype=go fileencoding=utf-8 fileformat=unix
au BufRead *.go call s:gofiletype_pre()
au BufReadPost *.go call s:gofiletype_post()
au BufRead,BufNewFile *.tmpl set filetype=gohtmltmpl
|
Add syntax highlighting for framework versions | if exists("b:current_syntax")
finish
endif
syntax case match
syntax match paketDepsKeyword /^\s*redirects/
syntax match paketDepsKeyword /^\s*source/
syntax match paketDepsKeyword /^\s*nuget/
syntax match paketDepsKeyword /^\s*http/
syntax match paketDepsKeyword /^\s*github/
syntax match paketDepsKeyword /^\s*group/
syntax match paketDepsSymbol />=/
syntax match paketDepsSymbol /:\_s/
syntax match paketDepsVersion /\d\(\.\d\)\+/
syntax match paketDepsOption /\<on\>/
" Source: https://gist.github.com/tobym/584909
syntax match paketDepsUrl /https\?:\/\/\(\w\+\(:\w\+\)\?@\)\?\([A-Za-z][-_0-9A-Za-z]*\.\?\)\{1,}\(\w\{2,}\.\?\)\{1,}\(:[0-9]\{1,5}\)\?\S*/
highlight link paketDepsKeyword Keyword
highlight link paketDepsSymbol Operator
highlight link paketDepsVersion Float
highlight link paketDepsOption Boolean
highlight link paketDepsUrl String
let b:current_syntax = "paketdeps"
| if exists("b:current_syntax")
finish
endif
syntax case match
syntax match paketDepsKeyword /^\s*framework/
syntax match paketDepsKeyword /^\s*redirects/
syntax match paketDepsKeyword /^\s*source/
syntax match paketDepsKeyword /^\s*nuget/
syntax match paketDepsKeyword /^\s*http/
syntax match paketDepsKeyword /^\s*github/
syntax match paketDepsKeyword /^\s*group/
syntax match paketDepsSymbol />=/
syntax match paketDepsSymbol /:\_s/
syntax match paketDepsVersion /\d\(\.\d\)\+/
syntax match paketDepsOption /\<on\>/
syntax match paketDepsOption /\<net20\>/
syntax match paketDepsOption /\<net35\>/
syntax match paketDepsOption /\<net40\>/
syntax match paketDepsOption /\<net45\>/
syntax match paketDepsOption /\<net451\>/
" Source: https://gist.github.com/tobym/584909
syntax match paketDepsUrl /https\?:\/\/\(\w\+\(:\w\+\)\?@\)\?\([A-Za-z][-_0-9A-Za-z]*\.\?\)\{1,}\(\w\{2,}\.\?\)\{1,}\(:[0-9]\{1,5}\)\?\S*/
highlight link paketDepsKeyword Keyword
highlight link paketDepsSymbol Operator
highlight link paketDepsVersion Float
highlight link paketDepsOption Boolean
highlight link paketDepsUrl String
let b:current_syntax = "paketdeps"
|
Add ultisnips and dictionary to deopletion | let g:deoplete#enable_at_startup = 1
let g:deoplete#sources = {}
let g:deoplete#sources._=['buffer', 'ultisnips', 'file', 'dictionary']
let g:deoplete#sources.clojure=['async_clj', 'file']
command! AsyncCljDebug call deoplete#custom#set('async_clj', 'debug_enabled', 1) | call deoplete#enable_logging("DEBUG", "/tmp/deopletelog")
| let g:deoplete#enable_at_startup = 1
let g:deoplete#sources = {}
let g:deoplete#sources._=['buffer', 'ultisnips', 'file', 'dictionary']
let g:deoplete#sources.clojure=['async_clj', 'file', 'ultisnips', 'dictionary']
command! AsyncCljDebug call deoplete#custom#set('async_clj', 'debug_enabled', 1) | call deoplete#enable_logging("DEBUG", "/tmp/deopletelog")
|
Copy text selected with mouse | let mapleader=" "
inoremap jj <Esc>
" window management
nnoremap <C-j> <C-w>j
nnoremap <C-k> <C-w>k
nnoremap <C-l> <C-w>l
nnoremap <C-h> <C-w>h
" buffers
nnoremap <silent> <TAB> :bnext<CR>
nnoremap <silent> <S-TAB> :bprevious<CR>
" tabbing
vnoremap < <gv
vnoremap > >gv
" move selection
vnoremap J :m '>+1<cr>gv=gv
vnoremap K :m '<-2<cr>gv=gv
" open file in external program
nnoremap gO :!open <cfile><CR>
| let mapleader=" "
inoremap jj <Esc>
" window management
nnoremap <C-j> <C-w>j
nnoremap <C-k> <C-w>k
nnoremap <C-l> <C-w>l
nnoremap <C-h> <C-w>h
" buffers
nnoremap <silent> <TAB> :bnext<CR>
nnoremap <silent> <S-TAB> :bprevious<CR>
" tabbing
vnoremap < <gv
vnoremap > >gv
" move selection
vnoremap J :m '>+1<cr>gv=gv
vnoremap K :m '<-2<cr>gv=gv
" open file in external program
nnoremap gO :!open <cfile><CR>
" copy text selected with mouse
vmap <LeftRelease> "*ygv
|
Add omnicomplete support in Go files | setlocal tabstop=4
setlocal shiftwidth=4
setlocal softtabstop=4
setlocal noexpandtab
let g:go_fmt_command = "goimports"
let g:go_highlight_types = 1
let g:go_highlight_fields = 1
let g:go_highlight_functions = 1
let g:go_highlight_methods = 1
let g:go_highlight_operators = 1
let g:go_highlight_extra_types = 1
let g:go_highlight_build_constraints = 1
let g:go_template_autocreate = 0
compiler go
| setlocal tabstop=4
setlocal shiftwidth=4
setlocal softtabstop=4
setlocal noexpandtab
let g:go_fmt_command = "goimports"
let g:go_highlight_types = 1
let g:go_highlight_fields = 1
let g:go_highlight_functions = 1
let g:go_highlight_methods = 1
let g:go_highlight_operators = 1
let g:go_highlight_extra_types = 1
let g:go_highlight_build_constraints = 1
let g:go_template_autocreate = 0
setlocal omnifunc=go#complete#Complete
inoremap <C-space> <C-x><C-o>
compiler go
|
Remove default language as python | function! GSO(question)
let firstarg=a:question
python << EOF
import vim
import os
import pickle as pkl
from io import BytesIO
from lxml import etree
from gso import load_up_answers, load_up_questions
question = vim.eval("firstarg")
vim.current.buffer.append(question)
results = []
i = 0
for result in load_up_questions(str(question), "python"):
results.append(result)
i += 1
if i > 1:
break
question_url = results[0][0]
answers = load_up_answers(question_url)
def wrap_with_root_tag(xml_string):
xml_string = u"<root>"+xml_string+u"</root>"
return xml_string
root = etree.iterparse(BytesIO(wrap_with_root_tag(answers[0][1]).encode('utf-8')))
for action, elem in root:
if elem.tag == u'p' or elem.tag == u'code':
for line in str(elem.text).split('\n'):
vim.current.buffer.append(line)
EOF
endfunction
" command! -nargs=1 GSO call GSO(question)
| function! GSO(question)
let firstarg=a:question
python << EOF
import vim
import os
import pickle as pkl
from io import BytesIO
from lxml import etree
from gso import load_up_answers, load_up_questions
question = vim.eval("firstarg")
vim.current.buffer.append(question)
results = []
i = 0
for result in load_up_questions(str(question)):
results.append(result)
i += 1
if i > 1:
break
question_url = results[0][0]
answers = load_up_answers(question_url)
def wrap_with_root_tag(xml_string):
xml_string = u"<root>"+xml_string+u"</root>"
return xml_string
root = etree.iterparse(BytesIO(wrap_with_root_tag(answers[0][1]).encode('utf-8')))
for action, elem in root:
if elem.tag == u'p' or elem.tag == u'code':
for line in str(elem.text).split('\n'):
vim.current.buffer.append(line)
EOF
endfunction
" command! -nargs=1 GSO call GSO(question)
|
Enable HTML5 syntax highlighting in htmldjango | " HTML5 ominicomplete & syntax
NeoBundleLazy 'othree/html5.vim', {
\ 'autoload': {'filetypes': ['html']}
\ }
" CSS3 syntax
NeoBundleLazy 'hail2u/vim-css3-syntax', {
\ 'autoload': {'filetypes': ['css']}
\ }
" Coq syntax
NeoBundleLazy 'jvoorhis/coq.vim', {
\ 'autoload': {'filetypes': ['coq']}
\ }
" CoffeeScript
if v:version >= 704
au BufRead,BufNewFile,BufReadPre *.coffee set filetype=coffee
NeoBundleLazy 'kchmck/vim-coffee-script', {
\ 'autoload': {'filetypes': ['coffee']}
\ }
endif
" Scala
au BufRead,BufNewFile,BufReadPre *.scala set filetype=scala
NeoBundleLazy 'derekwyatt/vim-scala', {
\ 'autoload': {'filetypes': ['scala']}
\ }
| " HTML5 ominicomplete & syntax
NeoBundleLazy 'othree/html5.vim', {
\ 'autoload': {'filetypes': ['html', 'htmldjango']}
\ }
" CSS3 syntax
NeoBundleLazy 'hail2u/vim-css3-syntax', {
\ 'autoload': {'filetypes': ['css']}
\ }
" Coq syntax
NeoBundleLazy 'jvoorhis/coq.vim', {
\ 'autoload': {'filetypes': ['coq']}
\ }
" CoffeeScript
if v:version >= 704
au BufRead,BufNewFile,BufReadPre *.coffee set filetype=coffee
NeoBundleLazy 'kchmck/vim-coffee-script', {
\ 'autoload': {'filetypes': ['coffee']}
\ }
endif
" Scala
au BufRead,BufNewFile,BufReadPre *.scala set filetype=scala
NeoBundleLazy 'derekwyatt/vim-scala', {
\ 'autoload': {'filetypes': ['scala']}
\ }
|
Add rbenv shims for rubocop | " ==========================================
" Syntastic settings
let g:syntastic_javascript_syntax_checker = "jshint"
let g:syntastic_coffee_coffeelint_args="--csv --file $HOME/.coffeelint.json"
let g:syntastic_ruby_checkers = ['mri', 'rubocop']
let g:syntastic_check_on_open = 0
| " ==========================================
" Syntastic settings
let g:syntastic_javascript_syntax_checker = "jshint"
let g:syntastic_coffee_coffeelint_args="--csv --file $HOME/.coffeelint.json"
let g:syntastic_ruby_checkers = ['mri', 'rubocop']
let g:syntastic_ruby_rubocop_exec = "$RBENV_ROOT/shims/ruby $RBENV_ROOT/shims/rubocop"
let g:syntastic_check_on_open = 0
|
Store vim notes in Dropbox or /Users/mange | set nocompatible
let g:CommandTMaxHeight = 20
" let g:easytags_suppress_ctags_warning = 1
let g:easytags_resolve_links = 1
let g:easytags_cmd = '/usr/local/bin/ctags'
let g:easytags_dynamic_files = 1
let g:UltiSnipsEditSplit = "horizontal"
let g:UltiSnipsExpandTrigger = "<c-tab>"
let g:UltiSnipsListSnippets = "<c-s-tab>"
source ~/.vim/bundles.vim
syntax on
filetype plugin indent on
" For all text files set 'textwidth' to 78 characters.
autocmd FileType text setlocal textwidth=78
" When editing a file, always jump to the last known cursor position.
" Don't do it when the position is invalid or when inside an event handler
" (happens when dropping a file on gvim).
autocmd BufReadPost *
\ if line("'\"") > 0 && line("'\"") <= line("$") |
\ exe "normal! g`\"" |
\ endif
function! GitStatusLine()
if exists('g:loaded_fugitive')
return fugitive#statusline()
endif
return "(fugitive not loaded)"
endfunction
set statusline=%{GitStatusLine()}\ %<%f\ %h%m%r%=%-14.(%l,%c%V%)\ %P
| set nocompatible
let g:CommandTMaxHeight = 20
" let g:easytags_suppress_ctags_warning = 1
let g:easytags_resolve_links = 1
let g:easytags_cmd = '/usr/local/bin/ctags'
let g:easytags_dynamic_files = 1
let g:UltiSnipsEditSplit = "horizontal"
let g:UltiSnipsExpandTrigger = "<c-tab>"
let g:UltiSnipsListSnippets = "<c-s-tab>"
if isdirectory($HOME . '/Dropbox/Notes')
let g:notes_directory = '~/Dropbox/Notes'
elseif isdirectory($HOME . '/Documents/Notes')
let g:notes_directory = '~/Documents/Notes'
endif
source ~/.vim/bundles.vim
syntax on
filetype plugin indent on
" For all text files set 'textwidth' to 78 characters.
autocmd FileType text setlocal textwidth=78
" When editing a file, always jump to the last known cursor position.
" Don't do it when the position is invalid or when inside an event handler
" (happens when dropping a file on gvim).
autocmd BufReadPost *
\ if line("'\"") > 0 && line("'\"") <= line("$") |
\ exe "normal! g`\"" |
\ endif
function! GitStatusLine()
if exists('g:loaded_fugitive')
return fugitive#statusline()
endif
return "(fugitive not loaded)"
endfunction
set statusline=%{GitStatusLine()}\ %<%f\ %h%m%r%=%-14.(%l,%c%V%)\ %P
|
Remove author from Javascript headers | " ftplugin/javascript.vim
" intelligent autocompleter
set omnifunc=javascriptcomplete#CompleteJS
" F1 comment line
map <F1> 0i//<esc>j
imap <F1> <esc>0i//<esc>j
" F2 uncomment line
map <F2> :s/^\/\///e<return>:noh<return>j
" F3 structured comment
map <F3> o<esc>i/<esc>79.yyp0O//<space>
imap <F3> <esc>o<esc>i/<esc>79.yyp0O//<space>
" F4 file header
map <F4> <esc>1GO// Creation Date: <esc>:r! date "+\%Y.\%m.\%d"<return><esc><esc>kJo// Author: Fernando L. Canizo - http://flc.muriandre.com/<esc>o<esc>0xxo<return><esc>kO"use strict";<enter><enter>
" use TAB character when TAB is pressed
set noexpandtab
" number of spaces to show for a TAB
set tabstop=4
" number of spaces for indent (>>, endfunction
set shiftwidth=4
" number of spaces for a tab in editing operations
set softtabstop=4
set textwidth=0
set smartindent
" TODO it would be nice to have this when on a comment, but it's not cool for code
set nowrap
set smartcase
colorscheme conanperlgray
" highlight unwanted spaces
call SpaceHighlightor()
| " ftplugin/javascript.vim
" intelligent autocompleter
set omnifunc=javascriptcomplete#CompleteJS
" F1 comment line
map <F1> 0i//<esc>j
imap <F1> <esc>0i//<esc>j
" F2 uncomment line
map <F2> :s/^\/\///e<return>:noh<return>j
" F3 structured comment
map <F3> o<esc>i/<esc>79.yyp0O//<space>
imap <F3> <esc>o<esc>i/<esc>79.yyp0O//<space>
" F4 file header
map <F4> <esc>1GO// Creation Date: <esc>:r! date "+\%Y.\%m.\%d"<return><esc>kJo<esc>0xxo<return><esc>kO"use strict";<esc>G
" use TAB character when TAB is pressed
set noexpandtab
" number of spaces to show for a TAB
set tabstop=4
" number of spaces for indent (>>, endfunction
set shiftwidth=4
" number of spaces for a tab in editing operations
set softtabstop=4
set textwidth=0
set smartindent
" TODO it would be nice to have this when on a comment, but it's not cool for code
set nowrap
set smartcase
colorscheme conanperlgray
" highlight unwanted spaces
call SpaceHighlightor()
|
Add Vim syntax support for Name and HexSequence tokens. | " Vim syntax file
" Language: Cretonne
" Maintainer: Jakob Stoklund Olesen <stoklund@2pi.dk
" Last Change: Sep 22, 2016
if version < 600
syntax clear
elseif exists("b:current_syntax")
finish
endif
syn keyword ctonHeader test isa set
syn keyword ctonDecl function stack_slot jump_table
syn keyword ctonFilecheck check sameln nextln unordered not regex contained
syn match ctonType /\<[bif]\d\+\(x\d\+\)\?\>/
syn match ctonEntity /\<\(v\|vx\|ss\|jt\|\)\d\+\>/
syn match ctonLabel /\<ebb\d+\>/
syn match ctonNumber /-\?\<\d\+\>/
syn match ctonNumber /-\?\<0x\x\+\(\.\x*\)\(p[+-]\?\d\+\)\?\>/
syn region ctonCommentLine start=";" end="$" contains=ctonFilecheck
hi def link ctonHeader Keyword
hi def link ctonDecl Keyword
hi def link ctonType Type
hi def link ctonEntity Identifier
hi def link ctonLabel Label
hi def link ctonNumber Number
hi def link ctonCommentLine Comment
hi def link ctonFilecheck SpecialComment
let b:current_syntax = "cton"
| " Vim syntax file
" Language: Cretonne
" Maintainer: Jakob Stoklund Olesen <stoklund@2pi.dk
" Last Change: Sep 22, 2016
if version < 600
syntax clear
elseif exists("b:current_syntax")
finish
endif
" Disable spell checking even in comments.
" They tend to refer to weird stuff like assembler mnemonics anyway.
syn spell notoplevel
syn keyword ctonHeader test isa set
syn keyword ctonDecl function stack_slot jump_table
syn keyword ctonFilecheck check sameln nextln unordered not regex contained
syn match ctonType /\<[bif]\d\+\(x\d\+\)\?\>/
syn match ctonEntity /\<\(v\|vx\|ss\|jt\|fn\|sig\)\d\+\>/
syn match ctonLabel /\<ebb\d+\>/
syn match ctonName /%\w\+\>/
syn match ctonNumber /-\?\<\d\+\>/
syn match ctonNumber /-\?\<0x\x\+\(\.\x*\)\(p[+-]\?\d\+\)\?\>/
syn match ctonHexSeq /#\x\+\>/
syn region ctonCommentLine start=";" end="$" contains=ctonFilecheck
hi def link ctonHeader Keyword
hi def link ctonDecl Keyword
hi def link ctonType Type
hi def link ctonEntity Identifier
hi def link ctonLabel Label
hi def link ctonName String
hi def link ctonNumber Number
hi def link ctonHexSeq Number
hi def link ctonCommentLine Comment
hi def link ctonFilecheck SpecialComment
let b:current_syntax = "cton"
|
Add path to show git status | " Main plugins
Plug 'w0rp/ale'
Plug 'jiangmiao/auto-pairs'
Plug 'jlanzarotta/bufexplorer'
Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
Plug 'junegunn/fzf', {'dir': '~/.fzf', 'do': './install --bin'}
Plug 'autozimu/LanguageClient-neovim', {'branch': 'next', 'do': 'bash install.sh'}
Plug 'preservim/nerdtree'
Plug 'altercation/vim-colors-solarized'
Plug 'lambdalisue/suda.vim'
Plug 'ervandew/supertab'
Plug 'SirVer/ultisnips'
Plug 'vim-airline/vim-airline'
Plug 'moll/vim-bbye'
Plug 'tpope/vim-commentary'
Plug 'tpope/vim-fugitive'
Plug 'tpope/vim-repeat'
Plug 'tpope/vim-surround'
Plug 'cespare/vim-toml'
" Plugin extras
Plug 'junegunn/fzf.vim'
Plug 'vim-airline/vim-airline-themes'
Plug 'honza/vim-snippets'
| " Main plugins
Plug 'w0rp/ale'
Plug 'jiangmiao/auto-pairs'
Plug 'jlanzarotta/bufexplorer'
Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
Plug 'junegunn/fzf', {'dir': '~/.fzf', 'do': './install --bin'}
Plug 'autozimu/LanguageClient-neovim', {'branch': 'next', 'do': 'bash install.sh'}
Plug 'preservim/nerdtree'
Plug 'altercation/vim-colors-solarized'
Plug 'lambdalisue/suda.vim'
Plug 'ervandew/supertab'
Plug 'SirVer/ultisnips'
Plug 'vim-airline/vim-airline'
Plug 'moll/vim-bbye'
Plug 'tpope/vim-commentary'
Plug 'tpope/vim-fugitive'
Plug 'tpope/vim-repeat'
Plug 'tpope/vim-surround'
Plug 'cespare/vim-toml'
" Plugin extras
Plug 'Xuyuanp/nerdtree-git-plugin'
Plug 'junegunn/fzf.vim'
Plug 'vim-airline/vim-airline-themes'
Plug 'honza/vim-snippets'
|
Remove fish filetype vim config | " c
autocmd BufNewFile,BufRead *.c,*.h call SetCOptions()
function SetCOptions()
setlocal filetype=c
setlocal colorcolumn=81
setlocal commentstring=//\ %s " prefer // over /*...*/ for single-line comments
endfunction
" fish
autocmd BufNewFile,BufRead *.fish call SetFishOptions()
function SetFishOptions()
setlocal filetype=fish
endfunction
" latex - fix "plaintex" filetype detection shit
autocmd BufNewFile,BufRead *.tex call SetLatexOptions()
function SetLatexOptions()
setlocal filetype=tex
endfunction
" rust
autocmd BufNewFile,BufRead *.rs call SetRustOptions()
function SetRustOptions()
setlocal filetype=rust
setlocal commentstring=//\ %s
endfunction
" typescript
autocmd BufNewFile,BufRead *.ts call SetTSOptions()
function SetTSOptions()
setlocal filetype=typescript
endfunction
" yaml
autocmd FileType yaml call SetYamlOptions()
function SetYamlOptions()
setlocal indentkeys-=<:>
endfunction
| " c
autocmd BufNewFile,BufRead *.c,*.h call SetCOptions()
function SetCOptions()
setlocal filetype=c
setlocal colorcolumn=81
setlocal commentstring=//\ %s " prefer // over /*...*/ for single-line comments
endfunction
" latex - fix "plaintex" filetype detection shit
autocmd BufNewFile,BufRead *.tex call SetLatexOptions()
function SetLatexOptions()
setlocal filetype=tex
endfunction
" rust
autocmd BufNewFile,BufRead *.rs call SetRustOptions()
function SetRustOptions()
setlocal filetype=rust
setlocal commentstring=//\ %s
endfunction
" typescript
autocmd BufNewFile,BufRead *.ts call SetTSOptions()
function SetTSOptions()
setlocal filetype=typescript
endfunction
" yaml
autocmd FileType yaml call SetYamlOptions()
function SetYamlOptions()
setlocal indentkeys-=<:>
endfunction
|
Add nvr command as VISUAL inside nvim | nnoremap <silent> <leader>gs :Gstatus<CR>
nnoremap <silent> <leader>gd :Gdiff<CR>
nnoremap <silent> <leader>gc :Gcommit<CR>
nnoremap <silent> <leader>gb :Gblame<CR>
nnoremap <silent> <leader>gl :Glog<CR>
nnoremap <silent> <leader>gp :Git push<CR>
nnoremap <silent> <leader>gu :Git pull<CR>
nnoremap <silent> <leader>gr :Gread<CR>
nnoremap <silent> <leader>gw :Gwrite<CR>
let g:signify_vcs_list = [ 'git', 'svn' ]
| nnoremap <silent> <leader>gs :Gstatus<CR>
nnoremap <silent> <leader>gd :Gdiff<CR>
nnoremap <silent> <leader>gc :Gcommit<CR>
nnoremap <silent> <leader>gb :Gblame<CR>
nnoremap <silent> <leader>gl :Glog<CR>
nnoremap <silent> <leader>gp :Git push<CR>
nnoremap <silent> <leader>gu :Git pull<CR>
nnoremap <silent> <leader>gr :Gread<CR>
nnoremap <silent> <leader>gw :Gwrite<CR>
let g:signify_vcs_list = [ 'git', 'svn' ]
if has('nvim')
let $VISUAL = 'nvr -cc split --remote-wait'
endif
|
Add vim-rhubarb to git layer | Plug 'tpope/vim-fugitive'
Plug 'tommcdo/vim-fugitive-blame-ext'
Plug 'airblade/vim-gitgutter'
Plug 'junegunn/gv.vim'
| Plug 'tpope/vim-fugitive'
Plug 'tpope/vim-rhubarb'
Plug 'tommcdo/vim-fugitive-blame-ext'
Plug 'airblade/vim-gitgutter'
Plug 'junegunn/gv.vim'
|
Add git add and commit leader commands | nnoremap <Leader>gb :Gblame<CR>
nnoremap <Leader>gd :Gdiff<CR>
| nnoremap <Leader>gb :Gblame<CR>
nnoremap <Leader>gd :Gdiff<CR>
nnoremap <Leader>ga :Gwrite<CR>
nnoremap <Leader>gc :Gcommit -v<CR>
|
Fix another executable callback typo | " Author: Tomota Nakamura <https://github.com/tomotanakamura>
" Description: clang linter for cpp files
call ale#Set('cpp_clang_executable', 'clang++')
call ale#Set('cpp_clang_options', '-std=c++14 -Wall')
function! ale_linters#cpp#clang#GetExecutable(buffer) abort
return ale#Var(a:buffer, 'cpp_clang_executable')
endfunction
function! ale_linters#cpp#clang#GetCommand(buffer) abort
let l:paths = ale#c#FindLocalHeaderPaths(a:buffer)
" -iquote with the directory the file is in makes #include work for
" headers in the same directory.
return ale#Escape(ale_linters#cpp#clang#GetExecutable(a:buffer))
\ . ' -S -x c++ -fsyntax-only '
\ . '-iquote ' . ale#Escape(fnamemodify(bufname(a:buffer), ':p:h')) . ' '
\ . ale#c#IncludeOptions(l:paths)
\ . ale#Var(a:buffer, 'cpp_clang_options') . ' -'
endfunction
call ale#linter#Define('cpp', {
\ 'name': 'clang',
\ 'output_stream': 'stderr',
\ 'executable_callback': 'ale_linters#cpp#clang#GetCommand',
\ 'command_callback': 'ale_linters#cpp#clang#GetCommand',
\ 'callback': 'ale#handlers#gcc#HandleGCCFormat',
\})
| " Author: Tomota Nakamura <https://github.com/tomotanakamura>
" Description: clang linter for cpp files
call ale#Set('cpp_clang_executable', 'clang++')
call ale#Set('cpp_clang_options', '-std=c++14 -Wall')
function! ale_linters#cpp#clang#GetExecutable(buffer) abort
return ale#Var(a:buffer, 'cpp_clang_executable')
endfunction
function! ale_linters#cpp#clang#GetCommand(buffer) abort
let l:paths = ale#c#FindLocalHeaderPaths(a:buffer)
" -iquote with the directory the file is in makes #include work for
" headers in the same directory.
return ale#Escape(ale_linters#cpp#clang#GetExecutable(a:buffer))
\ . ' -S -x c++ -fsyntax-only '
\ . '-iquote ' . ale#Escape(fnamemodify(bufname(a:buffer), ':p:h')) . ' '
\ . ale#c#IncludeOptions(l:paths)
\ . ale#Var(a:buffer, 'cpp_clang_options') . ' -'
endfunction
call ale#linter#Define('cpp', {
\ 'name': 'clang',
\ 'output_stream': 'stderr',
\ 'executable_callback': 'ale_linters#cpp#clang#GetExecutable',
\ 'command_callback': 'ale_linters#cpp#clang#GetCommand',
\ 'callback': 'ale#handlers#gcc#HandleGCCFormat',
\})
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.