Show full output of command :hi
in scratch window:
:Redir hi
Show full output of command :!ls -al
in scratch window:
You may want a linter plugin to lint your code in Vim but you probably don't need it. At least try the built-in way before jumping on the plugin bandwagon.
autocmd FileType <filetype> setlocal makeprg=<external command>
This autocommand tells Vim to use <external command>
when invoking :make %
in a <filetype>
buffer. You can add as many similar lines as needed for other languages.
FOREWORDS
I don't mean the snippet at the bottom of this gist to be a generic plug-n-play solution to your search needs. It is very likely to not work for you or even break things, and it certainly is not as extensively tested and genericised as your regular third-party plugin.
My goal, here and in most of my posts, is to show how Vim's features can be leveraged to build your own high-level, low-maintenance, workflows without systematically jumping on the plugins bandwagon or twisting Vim's arm.
This was tested on a ThinkPad P70 laptop with an Intel integrated graphics and an NVIDIA GPU:
lspci | egrep 'VGA|3D'
00:02.0 VGA compatible controller: Intel Corporation Device 191b (rev 06)
01:00.0 VGA compatible controller: NVIDIA Corporation GM204GLM [Quadro M3000M] (rev a1)
A reason to use the integrated graphics for display is if installing the NVIDIA drivers causes the display to stop working properly.
In my case, Ubuntu would get stuck in a login loop after installing the NVIDIA drivers.
This happened regardless if I installed the drivers from the "Additional Drivers" tab in "System Settings" or the ppa:graphics-drivers/ppa
in the command-line.
" :[range]SortGroup[!] [n|f|o|b|x] /{pattern}/ | |
" e.g. :SortGroup /^header/ | |
" e.g. :SortGroup n /^header/ | |
" See :h :sort for details | |
function! s:sort_by_header(bang, pat) range | |
let pat = a:pat | |
let opts = "" | |
if pat =~ '^\s*[nfxbo]\s' | |
let opts = matchstr(pat, '^\s*\zs[nfxbo]') |
// ==UserScript== | |
// @name Restore YouTube Scrollbar | |
// @namespace Violentmonkey Scripts | |
// @match https://www.youtube.com/* | |
// @grant none | |
// @version 1.0 | |
// @author https://github.com/lassekongo83 | |
// @description Make YouTube use your browser's default scrollbar | |
// ==/UserScript== |
nnoremap <silent> y :<C-U>call MarkAndSetOpfunc()<CR>g@ | |
vnoremap <silent> y :<C-U>call MarkYankAndJump()<CR> | |
function! MarkAndSetOpfunc() | |
let g:save_cursor = getpos(".") | |
set opfunc=YankAndJumpBack | |
endfunction | |
function! MarkYankAndJump() | |
let g:save_cursor = getpos(".") |
" Statusline & Tabline/Buffer line | |
" Dynamically getting the fg/bg colors from the current colorscheme, returns hex which is enough for me to use in Neovim | |
" Needs to figure out how to return cterm values too | |
let fgcolor=synIDattr(synIDtrans(hlID("Normal")), "fg", "gui") | |
let bgcolor=synIDattr(synIDtrans(hlID("Normal")), "bg", "gui") | |
" Tabline/Buffer line | |
set showtabline=2 | |
set tabline="%1T" |
#!/bin/bash | |
# simple script to preview files with the help of fzf | |
cwd=$(pwd) | |
# set up | |
nvr --nostart -cc 'let nvrp_buffer=""' | |
set_variables='mime_list=( "application/json" "text/" ); mime=$(file --mime-type {} | cut -d " " -f 2)' | |
f_is_text='for m in ${mime_list[@]}; do test "${mime#$m}" != "$mime" && break || false; done' |