how to copy codes in vi to clipboard
You need to use the clipboard register, which is *, so to copy a line of text into clipboard: “*yy To paste a line of text from the clipboard: “*p
You need to use the clipboard register, which is *, so to copy a line of text into clipboard: “*yy To paste a line of text from the clipboard: “*p
Java does not handle BOM properly. In fact Java handles a BOM like every other char. Found this: http://www.rgagnon.com/javadetails/java-handle-utf8-file-with-bom.html public static final String UTF8_BOM = “\uFEFF”; private static String removeUTF8BOM(String s) { if (s.startsWith(UTF8_BOM)) { s = s.substring(1); } return s; } May be I would use apache IO instead: http://commons.apache.org/proper/commons-io/apidocs/org/apache/commons/io/input/BOMInputStream.html
I presume you’re using vim as this is tagged as Linux. Try: :set nocompatible (You may want to configure your .vimrc with this by adding this command to it. Create a new .vimrc file if not already present in your home directory, run echo $HOME to check home directory path.)
In case someone’s wandering in here recently, IPython 5.0 switched from readline to prompt_toolkit, so an updated answer to this question is to pass an option: $ ipython –TerminalInteractiveShell.editing_mode=vi … or to set it globally in the profile configuration (~/.ipython/profile_default/ipython_config.py; create it with ipython profile create if you don’t have it) with: c.TerminalInteractiveShell.editing_mode=”vi”
As vim’s own help on set background says, “Setting this option does not change the background color, it tells Vim what the background color looks like. For changing the background color, see |:hi-normal|.” For example :highlight Normal ctermfg=grey ctermbg=darkblue will write in white on blue on your color terminal.
Once you’ve got expandtab on as per the other answers, the extremely convenient way to convert existing files according to your new settings is: :retab It will work on the current buffer.
=, the indent command can take motions. So, gg to get the start of the file, = to indent, G to the end of the file, gg=G.
:g/^$/d :g will execute a command on lines which match a regex. The regex is ‘blank line’ and the command is :d (delete)
Might not be one that 99% of Vim users don’t know about, but it’s something I use daily and that any Linux+Vim poweruser must know. Basic command, yet extremely useful. :w !sudo tee % I often forget to sudo before editing a file I don’t have write permissions on. When I come to save that … Read more
Replace All: :%s/foo/bar/g Find each occurrence of ‘foo’ (in all lines), and replace it with ‘bar’. For specific lines: :6,10s/foo/bar/g Change each ‘foo’ to ‘bar’ for all lines from line 6 to line 10 inclusive.